MAB Posted June 28, 2015 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 ) You can find me here.
Walid Posted June 28, 2015 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 ) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
MAB Posted June 28, 2015 Author 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 You can find me here.
MisterQuestions Posted June 28, 2015 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. "El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más". Att: -|TG|-Mister[Q]<.
MAB Posted June 28, 2015 Author 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 You can find me here.
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