Bryan321 Posted January 12, 2018 Share Posted January 12, 2018 Olá, Estou com o seguinte problema, á cada vez que um player morre dentro do veiculo, aparece a seguinte mensagem no debugscript WARNING: \carro.lua:20: Bad argument @'destroyElement' [Expected element at argument 1, got nil] Porem na tal linha o argumento já está setado para source Gostaria de saber como posso resolver isso local Veiculo = { 411,411} Drzika = {} function CreateVehicle (source) if getElementData (source, "Pegou", true) then outputChatBox ('#ffffff*#BF6F14Aguarde 20 Segundos para Pegar um Carro Novamente.',source,255,255,255,true) return end if isElement(Drzika[source]) then destroyElement (Drzika[source]) Drzika[source] = nil end local x,y,z = getElementPosition (source) local Cars = Veiculo[math.random(#Veiculo)] Drzika[source] = createVehicle (Cars,x,y,z) warpPedIntoVehicle (source,Drzika[source]) --outputChatBox ('#000000[ #00bfffVEICULO#000000 ] - #FFFFFF'..getPlayerName(source)..' #6C6C6CPegou um Carro digitando #00bffa/carro', root, 255, 255, 255, true) setElementData (source, "Pegou",true) setTimer (setElementData, 20000, 1, source, "Pegou", false) end addCommandHandler ("carro", CreateVehicle) function DestroyVeiculo () destroyElement (Drzika[source]) end addEventHandler ("onPlayerLogout", root, DestroyVeiculo) addEventHandler ("onPlayerQuit", root, DestroyVeiculo) addEventHandler ("onPlayerWasted", root, DestroyVeiculo) Link to comment
DNL291 Posted January 12, 2018 Share Posted January 12, 2018 Use a checagem isElement na função DestroyVeiculo e também corrija a função getElementData, que deve ser assim: (getElementData( source, "Pegou" ) == true) Link to comment
Bryan321 Posted January 17, 2018 Author Share Posted January 17, 2018 Ainda continuou dando o mesmo erro no debugscript, Coloquei o elemento antes do destroyElement, e finalmente parou de dar esse erro function DestroyVeiculo () if Drzika[source] then destroyElement(Drzika[source]) end end Mesmo Assim, muito obrigado pelo ajuda DNL! Link to comment
#RooTs Posted January 17, 2018 Share Posted January 17, 2018 if isElement(Drzika[source]) then Usa isso man Link to comment
xeon17 Posted January 22, 2018 Share Posted January 22, 2018 On 17/01/2018 at 21:03, #RooTs said: if isElement(Drzika[source]) then Usa isso man Cala boca seu viado Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now