Wysłany: 2017-06-10, 15:22
Atroth
Wiek: 23 Na forum: 3677 dni Posty: 1089
Nick w MP: Atroth
Piwa : 4808
local marker = createMarker ( 2483.181640625 ,- 1667.2297363281 , 12.34375 , "cylinder" , 1.2 , 0 , 0 , 0 , 200 )
local marker2 = createMarker ( 2472.7873535156 ,- 1666.2014160156 , 12.311030387878 , "cylinder" , 4.5 , 0 , 0 , 0 , 200 )
local paczka = {}
local poziom = nil
addEventHandler ( "onResourceStart" , root , function()
for k , v in pairs ( getElementsByType ( "player" )) do
bindKey ( v , "h" , "down" , paczka1 , v )
bindKey ( v , "h" , "down" , usuwanie , v )
end
end )
function paczka1 ( thePlayer )
if isElementWithinMarker ( thePlayer , marker ) then
local x , y , z = getElementPosition ( thePlayer )
paczka [ thePlayer ] = createObject ( 1220 , x , y , z )
attachElements ( paczka [ thePlayer ], thePlayer , 0 , 0.6 , 0.6 )
setPedAnimation ( thePlayer , "CARRY" , "liftup" )
setTimer (function()
setPedAnimation ( thePlayer , "CARRY" , "crry_prtial" , 1 , true )
end , 800 , 1 )
setElementCollisionsEnabled ( paczka [ thePlayer ], false )
toggleControl ( thePlayer , "enter_exit" , false )
toggleControl ( thePlayer , "sprint" , false )
toggleControl ( thePlayer , "crouch" , false )
setElementData ( thePlayer , "praca:paczki" , true )
end
end
function usuwanie ( thePlayer )
if isElementWithinMarker ( thePlayer , marker2 ) then
if paczka [ thePlayer ] and isElement ( paczka [ thePlayer ]) then
destroyElement ( paczka [ thePlayer ])
paczka [ thePlayer ] = nil
local kasa = math . random ( 1 , 10 )
givePlayerMoney ( thePlayer , kasa )
setTimer (function()
setPedAnimation ( thePlayer , "CARRY" , "liftup" )
setTimer (function()
local poziom = getElementData ( thePlayer , "praca:paczki" )
setPedAnimation ( thePlayer , false )
toggleControl ( thePlayer , "enter_exit" , true )
toggleControl ( thePlayer , "sprint" , true )
toggleControl ( thePlayer , "crouch" , true )
setElementData ( thePlayer , "praca:paczki" , poziom + 1 )
outputChatBox ( "Dzisiaj od?o?y?e? " .. poziom )
end , 800 , 1 )
end , 50 , 1 )
end
end
end
DB3:
[15:21] ERROR: paczki\paczki.lua:57: attempt to perform arithmetic on local 'poziom' (a boolean value)
a to jest linijka:
setElementData ( thePlayer , "praca:paczki" , poziom + 1 )
Podpis
Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018
Wysłany: 2017-06-10, 16:58
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
Rookspack , Gracz nie ma tej elementdaty 'poziom' dlatego zwraca false 'boolean'.
local poziom = getElementData ( thePlayer , "praca:paczki" ) or 0
B??du nie powinno by? ale za to poziom b?dzie = 0.
Wysłany: 2017-06-10, 17:18
Atroth
Wiek: 23 Na forum: 3677 dni Posty: 1089
Nick w MP: Atroth
Piwa : 4808
marcin778 , Hmmm, nadal te samo DB3.
Podpis
Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018
Wysłany: 2017-06-10, 17:21
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
setTimer (function( thePlayer )
local poziom = getElementData ( thePlayer , "praca:paczki" ) or 0
setPedAnimation ( thePlayer , false )
toggleControl ( thePlayer , "enter_exit" , true )
toggleControl ( thePlayer , "sprint" , true )
toggleControl ( thePlayer , "crouch" , true )
setElementData ( thePlayer , "praca:paczki" , poziom + 1 )
outputChatBox ( "Dzisiaj od?o?y?e? " .. poziom )
end , 800 , 1 , thePlayer )
Wysłany: 2017-06-10, 17:22
Atroth
Wiek: 23 Na forum: 3677 dni Posty: 1089
Nick w MP: Atroth
Piwa : 4808
marcin778 , Nadal
Podpis
Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018
Wysłany: 2017-06-10, 17:29
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
setTimer (function( thePlayer )
local poziom = getElementData ( thePlayer , "praca:paczki" ) or 0
setPedAnimation ( thePlayer , false )
toggleControl ( thePlayer , "enter_exit" , true )
toggleControl ( thePlayer , "sprint" , true )
toggleControl ( thePlayer , "crouch" , true )
setElementData ( thePlayer , "praca:paczki" , tonumber ( poziom )+ 1 )
outputChatBox ( "Dzisiaj od?o?y?e? " .. poziom )
end , 800 , 1 , thePlayer )
Wysłany: 2017-06-10, 17:32
Atroth
Wiek: 23 Na forum: 3677 dni Posty: 1089
Nick w MP: Atroth
Piwa : 4808
marcin778 , Tymczasem: ...
db3:
[17:31] ERROR: paczki\paczki.lua:55: attempt to perform arithmetic on a nil value
Podpis
Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018
Wysłany: 2017-06-10, 17:33
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
setTimer (function( thePlayer )
local poziom = getElementData ( thePlayer , "praca:paczki" ) or 0
setPedAnimation ( thePlayer , false )
toggleControl ( thePlayer , "enter_exit" , true )
toggleControl ( thePlayer , "sprint" , true )
toggleControl ( thePlayer , "crouch" , true )
if tonumber ( poziom ) ~= nil then
setElementData ( thePlayer , "praca:paczki" , tonumber ( poziom ) + 1 )
outputChatBox ( "Dzisiaj od?o?y?e? " .. poziom )
end
end , 800 , 1 , thePlayer )
Mo?e zwyczajnie nadaj mu t? elementdate?
Ostatnio zmieniony przez marcin778 2017-06-10, 17:34, w całości zmieniany 1 raz
Wysłany: 2017-06-10, 17:34
Atroth
Wiek: 23 Na forum: 3677 dni Posty: 1089
Nick w MP: Atroth
Piwa : 4808
marcin778 , Dalej to samo :C .
Podpis
Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018
Wysłany: 2017-06-10, 17:35
marcin778
Krytyk serwerów MTA
Wiek: 24 Na forum: 4149 dni Posty: 2268
Nick w MP: Marcineg
Piwa : 4662
Wysłany: 2017-06-10, 17:42
Atroth
Wiek: 23 Na forum: 3677 dni Posty: 1089
Nick w MP: Atroth
Piwa : 4808
Close. Dzi?ki marcin778 .
Podpis
Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018
Tagi: punkty :: doświadczenia
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: