Jump to content

How to differentiate a vehicle created by player from a vehicle created by map?


Lord Henry

Recommended Posts

  • Other Languages Moderators

ERROR: idlevehicles.lua:34: table index is nil
Warning: idlevehicles.lua:34: Bad argument @ 'destroyElement' [Expected element at argument 1, got nil]

function onPlayerDeathHandler(totalAmmo, killer, killerWeapon, bodypart, stealth)
    local thePlayer = source
    timers[theVehicle] = setTimer( isVehicleStatic(theVehicle) and respawnVehicle or destroyElement, 20000, 1, theVehicle )--line 34
end
addEventHandler( "onPlayerWasted", root, onPlayerDeathHandler)

 

Link to comment

The error says all.

well... don't you have an hex editor? if not you can download one like HXD and pasting the hex code in a new blank file,

otherwise take the script, set the priority on high (or still above normal - default priority) to the handler of deaths, and 

timers[theVehicle] = setTimer( isVehicleStatic(theVehicle) and respawnVehicle or destroyElement, 20000, 1, theVehicle )
--replace to
local theVehicle = pedsOccupiedVehicles[source]
timers[theVehicle] = setTimer( isVehicleStatic(theVehicle) and respawnVehicle or destroyElement, 20000, 1, theVehicle )

 

Edited by LoPollo
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...