Ernis456 Posted April 25, 2010 Share Posted April 25, 2010 (edited) I have problem with car respawning script. When I run this script and destroy car : function respawnVehicle( vehicle ) spawnVehicle ( vehicle, getElementData( vehicle, "posX" ), getElementData( vehicle, "posY" ), getElementData( vehicle, "posZ" ), getElementData( vehicle, "rotX" ), getElementData( vehicle, "rotY" ), getElementData( vehicle, "rotZ" ) ) end function onVehicleSpawn () local x,y,z = getElementPosition (source) setElementData (source,"posX",x) setElementData (source,"posY",y) setElementData (source,"posZ",z) end addEventHandler ("onVehicleExplode",getRootElement(),onVehicleSpawn) function onVehicleExplode () setTimer( respawnVehicle, 5000, 1, source ) end addEventHandler("onVehicleExplode", getRootElement(), onVehicleExplode) I getting error in console : [15:24:20] WARNING: spawn.lua: Bad 'element' pointer @ 'getElementData'(1) - Line: 2 [15:24:20] WARNING: spawn.lua: Bad 'element' pointer @ 'spawnVehicle'(1) - Line: 2 How Can I fix it ? Another question: I Have created Team Cops. Why setPlayerTeam ( playerWhoUses, "Cops" ) doesn't work for me ? Edited April 25, 2010 by Guest Link to comment
karlis Posted April 25, 2010 Share Posted April 25, 2010 sory for doublepost, i did it since you are online,and you could not see edit you can use https://wiki.multitheftauto.com/wiki/RespawnVehicle Link to comment
Ernis456 Posted April 26, 2010 Author Share Posted April 26, 2010 sory for doublepost, i did it since you are online,and you could not see edityou can use https://wiki.multitheftauto.com/wiki/RespawnVehicle Code in that web doesn't work for me . Link to comment
Dark Dragon Posted April 26, 2010 Share Posted April 26, 2010 for your first problem, the bad element pointer can actually only mean that the element was destroyed (maybe by another script). try to stop all resources which could have something to do with vehicles (play,broph,freeroam). if everything else fails you could simply try to use createVehicle instead of spawnVehicle, actually i have never seen that function being used before. the second parameter of setPlayerTeam is a team element use getTeamFromName("Cops") or save the team element in a variable when you create it. 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