Wysłany: 2016-03-26, 17:52
GamerHD11
Wiek: 24 Na forum: 4261 dni Posty: 259
Nick w MP: SzokoHD
Piwa : 23
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 ( grid , rowmarycha , ilosc , "" .. wynik .. " g." , false , false )
Wysłany: 2016-03-26, 17:56
AteX
Wiek: 26 Na forum: 4015 dni Posty: 927
Nick w MP: #AteX
Piwa : 8360
ileziola = getElementData ( localPlayer , "Marihuana" )
wynik = ileziola - 1
setElementData ( localPlayer , "Marihuana" , wynik )
guiGridListSetItemText ( grid , rowmarycha , ilosc , "" .. wynik .. " g." , false , false )
Wysłany: 2016-03-26, 18:11
GamerHD11
Wiek: 24 Na forum: 4261 dni Posty: 259
Nick w MP: SzokoHD
Piwa : 23
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 ( grid , rowmarycha , przedmiot ) then return end
rowmarycha = guiGridListAddRow ( grid )
iloscmarycha = getElementData ( localPlayer , "Marihuana" ) or 0
guiGridListSetItemText ( grid , rowmarycha , przedmiot , "Marihuana" , false , false )
guiGridListSetItemText ( grid , rowmarycha , ilosc , "" .. iloscmarycha .. " g" , false , false )
elseif getElementData ( localPlayer , "Marihuana" ) == 0 then
guiGridListRemoveRow ( rowmarycha , przedmiot )
guiGridListRemoveRow ( rowmarycha , ilosc )
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'
Wysłany: 2016-03-26, 18:17
AteX
Wiek: 26 Na forum: 4015 dni Posty: 927
Nick w MP: #AteX
Piwa : 8360
function sprMarycha ()
if getElementData ( localPlayer , "Marihuana" ) >= 1 then
if guiGridListGetItemText ( grid , rowmarycha , przedmiot ) then return end
rowmarycha = guiGridListAddRow ( grid )
iloscmarycha = getElementData ( localPlayer , "Marihuana" ) or 0
guiGridListSetItemText ( grid , rowmarycha , przedmiot , "Marihuana" , false , false )
guiGridListSetItemText ( grid , rowmarycha , ilosc , "" .. iloscmarycha .. " g" , false , false )
elseif getElementData ( localPlayer , "Marihuana" ) == 0 then
guiGridListRemoveRow ( grid , rowmarycha )
end
end
addEventHandler ( "onClientRender" , getRootElement (), sprMarycha )
Wysłany: 2016-03-26, 18:25
GamerHD11
Wiek: 24 Na forum: 4261 dni Posty: 259
Nick w MP: SzokoHD
Piwa : 23
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.
Wysłany: 2016-03-26, 18:32
AteX
Wiek: 26 Na forum: 4015 dni Posty: 927
Nick w MP: #AteX
Piwa : 8360
"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.
Wysłany: 2016-03-26, 18:45
GamerHD11
Wiek: 24 Na forum: 4261 dni Posty: 259
Nick w MP: SzokoHD
Piwa : 23
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 ( 781 , 272 , 334 , 546 , "Ekwipunek" , false )
guiWindowSetSizable ( okno , false )
grid = guiCreateGridList ( 9 , 21 , 315 , 441 , false , okno )
przedmiot = guiGridListAddColumn ( grid , "Przedmiot" , 0.5 )
ilosc = guiGridListAddColumn ( grid , "Ilo??" , 0.5 )
btnuzyj = guiCreateButton ( 10 , 472 , 155 , 60 , "U?yj" , false , okno )
btnwyrzuc = guiCreateButton ( 169 , 472 , 155 , 60 , "Wyrzu?" , false , okno )
guiSetVisible ( okno , false )
Sprawdzenie:
function sprMarycha ()
if getElementData ( localPlayer , "Marihuana" ) >= 1 then
if guiGridListGetItemText ( grid , rowmarycha , przedmiot ) then return end
rowmarycha = guiGridListAddRow ( grid )
iloscmarycha = getElementData ( localPlayer , "Marihuana" ) or 0
guiGridListSetItemText ( grid , rowmarycha , przedmiot , "Marihuana" , false , false )
guiGridListSetItemText ( grid , rowmarycha , ilosc , "" .. iloscmarycha .. " g" , false , false )
elseif getElementData ( localPlayer , "Marihuana" ) == 0 then
guiGridListRemoveRow ( grid , rowmarycha )
end
end
addEventHandler ( "onClientRender" , getRootElement (), sprMarycha )
Dzia?anie:
function uzyjMarycha ()
chose = guiGridListGetItemText ( grid , guiGridListGetSelectedItem ( grid ), 1 )
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 ( grid , rowmarycha , ilosc , "" .. wynik .. " g." , false , false )
pogoda = getWeather ()
setGameSpeed ( 0.6 )
muza = playSound ( "sound/reggae.mp3" , true )
setCameraShakeLevel ( 45 )
setWindVelocity ( 20 , 20 , 0 )
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 ( 0 , 255 ))
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 )
end , 5000 , 1 )
end
end
end
end
addEventHandler ( "onClientGUIClick" , btnuzyj , uzyjMarycha )
Wywala b??d w guiGridListGetTextItem
Tagi: nie :: odejmuje :: przedmiotu
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: