aboodehoms2014 Posted August 21, 2016 Share Posted August 21, 2016 Hi all i tried to make script thats your vehicle fixed auto when you kill anyone for shooter servers but i dont know what the problem if anyone can help me please function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) if ( attacker ) and ( attacker ~= source ) then local veh = getPedOccupiedVehicle(attacker) fixVehicle(veh) end end addEventHandler ( "onPlayerWasted" Link to comment
StefanAlmighty Posted August 21, 2016 Share Posted August 21, 2016 The function you gave is incomplete: function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) if ( attacker ) and ( attacker ~= source ) then local veh = getPedOccupiedVehicle(attacker) fixVehicle(veh) end end addEventHandler ( "onPlayerWasted" I wrapped the code you sent into LUA tags so it's easier for you to read. From first glance everything looks fine except from the event handler which is incomplete, try changing it to: addEventHandler("onPlayerWasted", getRootElement(), rewardOnWasted) Take a look here and look at the required arguments: https://wiki.multitheftauto.com/wiki/AddEventHandler Link to comment
aboodehoms2014 Posted August 21, 2016 Author Share Posted August 21, 2016 The function you gave is incomplete: function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) if ( attacker ) and ( attacker ~= source ) then local veh = getPedOccupiedVehicle(attacker) fixVehicle(veh) end end addEventHandler ( "onPlayerWasted" I wrapped the code you sent into LUA tags so it's easier for you to read. From first glance everything looks fine except from the event handler which is incomplete, try changing it to: addEventHandler("onPlayerWasted", getRootElement(), rewardOnWasted) Take a look here and look at the required arguments: https://wiki.multitheftauto.com/wiki/AddEventHandler Thanks so much i will try it now Link to comment
aboodehoms2014 Posted August 21, 2016 Author Share Posted August 21, 2016 The function you gave is incomplete: function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) if ( attacker ) and ( attacker ~= source ) then local veh = getPedOccupiedVehicle(attacker) fixVehicle(veh) end end addEventHandler ( "onPlayerWasted" I wrapped the code you sent into LUA tags so it's easier for you to read. From first glance everything looks fine except from the event handler which is incomplete, try changing it to: addEventHandler("onPlayerWasted", getRootElement(), rewardOnWasted) Take a look here and look at the required arguments: https://wiki.multitheftauto.com/wiki/AddEventHandler it didnt work Link to comment
Captain Cody Posted August 21, 2016 Share Posted August 21, 2016 Should work just fine function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) if attacker and attacker ~= source then local veh = getPedOccupiedVehicle(attacker) fixVehicle(veh) end end addEventHandler("onPlayerWasted",root, rewardOnWasted) Link to comment
aboodehoms2014 Posted August 21, 2016 Author Share Posted August 21, 2016 Should work just fine function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) if attacker and attacker ~= source then local veh = getPedOccupiedVehicle(attacker) fixVehicle(veh) end end addEventHandler("onPlayerWasted",root, rewardOnWasted) it didnt work Link to comment
KariiiM Posted August 22, 2016 Share Posted August 22, 2016 It will be triggered untill you are wasted. Link to comment
StefanAlmighty Posted August 22, 2016 Share Posted August 22, 2016 function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) if attacker and attacker ~= source then local veh = getPedOccupiedVehicle(attacker) if veh then fixVehicle(veh) else outputChatBox("The player you killed was not in a vehicle.", attacker, 255, 0, 0) end end end addEventHandler("onPlayerWasted",root, rewardOnWasted) This should help determine why it isn't working. Remember as Karim said this is triggered when the player dies. Link to comment
aboodehoms2014 Posted August 22, 2016 Author Share Posted August 22, 2016 function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) if attacker and attacker ~= source then local veh = getPedOccupiedVehicle(attacker) if veh then fixVehicle(veh) else outputChatBox("The player you killed was not in a vehicle.", attacker, 255, 0, 0) end end end addEventHandler("onPlayerWasted",root, rewardOnWasted) This should help determine why it isn't working. Remember as Karim said this is triggered when the player dies. thanks i will test it now , do you have skype ? 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