MAB Posted June 28, 2015 Share Posted June 28, 2015 the mta system can't know who is the player... all the function worked but the setElementData didn't so i added if thePlayer then .. now all the function isn't working function resetjob (thePlayer) if thePlayer then setElementData ( thePlayer, "fisher", false ) destroyElement ( boat ) destroyElement ( blip ) outputChatBox ( "It seems that your fishing boat exploded! Don't Worry you can start the job again!", hitElement, 255, 255, 0) outputChatBox ( "If your boat was destroyed by other player then take a screen shot [F12] and tell a mod or use /report!", hitElement, 255, 255, 0) end end addEventHandler ( "onVehicleExplode", boat, resetjob ) Link to comment
Walid Posted June 28, 2015 Share Posted June 28, 2015 You need to use getVehicleController() -- or getVehicleOccupant() Example function resetjob () local thePlayer = getVehicleController (source) if ( thePlayer ) then setElementData ( thePlayer, "fisher", false ) destroyElement (source) destroyElement ( blip ) outputChatBox ( "It seems that your fishing boat exploded! Don't Worry you can start the job again!", thePlayer, 255, 255, 0) outputChatBox ( "If your boat was destroyed by other player then take a screen shot [F12] and tell a mod or use /report!",thePlayer, 255, 255, 0) end end addEventHandler ( "onVehicleExplode", boat, resetjob ) Link to comment
MAB Posted June 28, 2015 Author Share Posted June 28, 2015 You need to use getVehicleController() -- or getVehicleOccupant() Example function resetjob () local thePlayer = getVehicleController (source) if ( thePlayer ) then setElementData ( thePlayer, "fisher", false ) destroyElement (source) destroyElement ( blip ) outputChatBox ( "It seems that your fishing boat exploded! Don't Worry you can start the job again!", thePlayer, 255, 255, 0) outputChatBox ( "If your boat was destroyed by other player then take a screen shot [F12] and tell a mod or use /report!",thePlayer, 255, 255, 0) end end addEventHandler ( "onVehicleExplode", boat, resetjob ) That is very nice but the problem is that thePlayer isn't in the boat....he left the boat then the boat was destroyed Link to comment
MisterQuestions Posted June 28, 2015 Share Posted June 28, 2015 When players enters a vehicle use setElementData(vehicle,"Player",playerElement or playerName) Then when vehicle explodes... tell to the; player element or search a player from saved name. Link to comment
MAB Posted June 28, 2015 Author Share Posted June 28, 2015 When players enters a vehicle use setElementData(vehicle,"Player",playerElement or playerName)Then when vehicle explodes... tell to the; player element or search a player from saved name. i don't understand that...but it is ok now.. i am done with that function i used a commandHandler 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