Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2016-03-26, 17:52


GamerHD11







Wiek: 24
Na forum: 4261 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

Witam mam problem. Ustawi?em sobie przed funkcjami w skrypcie, ?eby mi nadawa?o elementDate na 5, no i gdy u?ywam przedmiotu to mi odejmuije i mam ilo?? przedmiotu r?wn? 4, ale gdy nast?pnym razem u?yje to ju? mi nie odejmuje -1 do ilo?ci.

ileziola getElementData(localPlayer"Marihuana")
wynik ileziola 1
guiGridListSetItemText(gridrowmarychailosc""..wynik.." g."falsefalse)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-26, 17:56


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

ileziola getElementData(localPlayer"Marihuana")
wynik ileziola 1
setElementData(localPlayer,"Marihuana",wynik)
guiGridListSetItemText(gridrowmarychailosc""..wynik.." g."falsefalse)


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-26, 18:11


GamerHD11







Wiek: 24
Na forum: 4261 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

O dzi?ki, dzia?a i jeszcze jedno, wywala mi bledy i gdy mam 0 to sie nie usuwa row

function sprMarycha()
if getElementData(localPlayer"Marihuana") >= 1 then
if guiGridListGetItemText(gridrowmarychaprzedmiotthen return end
rowmarycha guiGridListAddRow(grid)
iloscmarycha getElementData(localPlayer"Marihuana") or 0
guiGridListSetItemText(gridrowmarychaprzedmiot"Marihuana"falsefalse)
guiGridListSetItemText(gridrowmarychailosc""..iloscmarycha.." g"falsefalse)
elseif getElementData(localPlayer"Marihuana") == 0 then
guiGridListRemoveRow(rowmarychaprzedmiot)
guiGridListRemoveRow(rowmarychailosc)
end
end
addEventHandler("onClientRender"getRootElement(), sprMarycha)


B?ad w DB3 jest wlasnie w obu RemoveRow i pisze expected gui-element at argument 1, got number '0'

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-26, 18:17


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

function sprMarycha()
if getElementData(localPlayer"Marihuana") >= 1 then
if guiGridListGetItemText(gridrowmarychaprzedmiotthen return end
rowmarycha guiGridListAddRow(grid)
iloscmarycha getElementData(localPlayer"Marihuana") or 0
guiGridListSetItemText(gridrowmarychaprzedmiot"Marihuana"falsefalse)
guiGridListSetItemText(gridrowmarychailosc""..iloscmarycha.." g"falsefalse)
elseif getElementData(localPlayer"Marihuana") == 0 then
guiGridListRemoveRow(grid,rowmarycha)
end
end
addEventHandler("onClientRender"getRootElement(), sprMarycha)


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-26, 18:25


GamerHD11







Wiek: 24
Na forum: 4261 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

Teraz usuwa wszystkie row'y, a nie jeden. Nie ma DB3

Usuwa wszystkie rowy, kt?re s? pod tym kt?rego jest 0 i go te? usuwa.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-26, 18:32


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

"GamerHD11" napisał/a:

Teraz usuwa wszystkie row'y, a nie jeden. Nie ma DB3

Usuwa wszystkie rowy, kt?re s? pod tym kt?rego jest 0 i go te? usuwa.


Nwm jak to wygl?da w grze i co chcesz za bardzo osi?gn??, ale skoro usuwa to ju? wiesz co trzeba zrobi?. Pierwszy argument w guiGridListRemoveRow to gridlista, a drugi row. Pokombinuj, a jak dalej nie b?dziesz m?g? sobie da? rady to pisz.

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-26, 18:45


GamerHD11







Wiek: 24
Na forum: 4261 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

Nie ogarniam wszystko powinno si? zgadza?, gridLista ma zmienn? grid, a row ma zmienn? rowmarycha, poprostu chodzi o to, ?e jak marihuana jest pierwsza na gridli?cie to si? usuwa i inne itemy, kt?re by?y pod ni?.

GUI:
okno guiCreateWindow(781272334546"Ekwipunek"false)
        guiWindowSetSizable(oknofalse)
        grid guiCreateGridList(921315441falseokno)
        przedmiot guiGridListAddColumn(grid"Przedmiot"0.5)
        ilosc guiGridListAddColumn(grid"Ilo??"0.5)   
        btnuzyj guiCreateButton(1047215560"U?yj"falseokno)
        btnwyrzuc guiCreateButton(16947215560"Wyrzu?"falseokno)
        guiSetVisible(oknofalse)


Sprawdzenie:

function sprMarycha()
if getElementData(localPlayer"Marihuana") >= 1 then
if guiGridListGetItemText(gridrowmarychaprzedmiotthen return end
rowmarycha guiGridListAddRow(grid)
iloscmarycha getElementData(localPlayer"Marihuana") or 0
guiGridListSetItemText(gridrowmarychaprzedmiot"Marihuana"falsefalse)
guiGridListSetItemText(gridrowmarychailosc""..iloscmarycha.." g"falsefalse)
elseif getElementData(localPlayer"Marihuana") == 0 then
guiGridListRemoveRow(grid,rowmarycha)
end
end
addEventHandler("onClientRender"getRootElement(), sprMarycha)


Dzia?anie:

function uzyjMarycha()
chose guiGridListGetItemText gridguiGridListGetSelectedItem grid ), )
if chose == "Marihuana" then
if getElementData(localPlayer"Marihuana") >= 1 then
if getElementData(localPlayer"tripmar") == false then
setElementData(localPlayer"tripmar"true)
ileziola getElementData(localPlayer"Marihuana")
wynik ileziola 1
setElementData(localPlayer,"Marihuana",wynik)
guiGridListSetItemText(gridrowmarychailosc""..wynik.." g."falsefalse)
pogoda getWeather()
setGameSpeed(0.6)
muza playSound("sound/reggae.mp3"true)
setCameraShakeLevel(45)
setWindVelocity(20200)
setHeatHaze(255)
setWaveHeight(50)
setWeather(0)
setGravity(0.006)
setSkyGradient(math.random(0,255), math.random(0,255), math.random(0,255), math.random(0,255), math.random(0,255), math.random(0,255))
setWaterColor(math.random(0,255), math.random(0,255), math.random(0,255), math.random(0255))
setSunColor(math.random(0,255), math.random(0,255), math.random(0,255), math.random(0,255), math.random(0,255), math.random(0,255))
setFogDistance(math.random(0,500))
setTimer(function()
setElementData(localPlayer"tripmar"false)
resetSkyGradient()
resetWaterColor()
resetFogDistance()
resetWindVelocity()
resetSunColor()
resetHeatHaze()
setGravity(0.008)
setGameSpeed(1)
stopSound(muza)
setWeather(pogoda)
setWaveHeight(0)
setCameraShakeLevel(1)
end50001)
end
end
end
end
addEventHandler("onClientGUIClick"btnuzyjuzyjMarycha)


Wywala b??d w guiGridListGetTextItem

Postaw piwo autorowi tego posta
 

 
Tagi: nie :: odejmuje :: przedmiotu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Nie odejmuje przedmiotu Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku