Jump to content

Destroy a vehicle Need Someone Pro!


Price.

Recommended Posts

Guys i need a little help when i reconnect gives me this error

56:Bad Argument @ 'getElementData' [Expected element at argument 1 ,got nill]

58:Bad Argument @ 'destroyerElement' [Expected element at argument 1 ,got nill]

the function:

     
                  function playerQuit() 
    local playerAcc = getPlayerAccount(source) 
    if ( playerAcc  ) then  
        getElementData(theVehicle,"destroyed") 
        getElementData(thePlayer,"destroyed") 
        destroyElement(theVehicle) 
        destroyElement(vehicleToStealBlip) 
    end 
end 
addEventHandler("onPlayerQuit", getRootElement(), playerQuit) 
addEventHandler("onPlayerLogout", getRootElement(), playerQuit) 

i want him, when he joins the blip is destroyed and the vehicle is destroyed too but only blip gets destroyed

EDIT: i've removed

getElementData(theVehicle,"destroyed")

getElementData(thePlayer,"destroyed")

Now tells me 56:Bad argument @ 'destroyerElement' [Expected element at argument 1, got nill]

Edited by Guest
Link to comment

here is the vehicle defination:

local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
  if (theVehicle) then 
   local vehicleData = getElementData(theVehicle,"destroyed") 
   local playerData = getElementData(thePlayer,"destroyed") 
   if (vehicleData == 1) and (playerData == 1) then 
    destroyElement(theVehicle) 
    destroyElement(vehicleToStealBlip) 
    givePlayerMoney(thePlayer, math.random(1000,1500)) 
    setElementData(thePlayer, "destroyed", 0) 
   end 
  

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...