Bilal135 Posted May 17, 2015 Posted May 17, 2015 It should give 5xp on player kill, and 10 xp, on headshot. But it won't give any xp. function rewardOnWasted ( ammo, killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then if bodypart == 9 then triggerServerEvent("addUserEXP", resourceRoot, killer, 10) else triggerServerEvent("addUserEXP", resourceRoot, killer, 5) end end end addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) "Get busy living or get busy dying"
Walid Posted May 17, 2015 Posted May 17, 2015 the code is already server side and you are trying to use TriggerServerEvent. ??? Try to use "onClientPlayerWasted" 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
Bilal135 Posted May 17, 2015 Author Posted May 17, 2015 Well, I used onClientPlayerWasted, and still doesnt work. function rewardOnWasted ( ammo, killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then if bodypart == 9 then triggerServerEvent("addUserEXP", resourceRoot, killer, 10) else triggerServerEvent("addUserEXP", resourceRoot, killer, 5) end end end addEventHandler ( "onClientPlayerWasted", getRootElement(), rewardOnWasted ) "Get busy living or get busy dying"
Bilal135 Posted May 17, 2015 Author Posted May 17, 2015 Nevermind, fixed my self. "Get busy living or get busy dying"
WhoAmI Posted May 17, 2015 Posted May 17, 2015 function rewardOnWasted ( killer, _, bodypart ) if ( killer ~= source ) then if bodypart == 9 then triggerServerEvent("addUserEXP", resourceRoot, killer, 10) else triggerServerEvent("addUserEXP", resourceRoot, killer, 5) end end end addEventHandler ( "onClientPlayerWasted", root, rewardOnWasted )
Walid Posted May 17, 2015 Posted May 17, 2015 Well, I used onClientPlayerWasted, and still doesnt work. onClientPlayerWasted there is no ammo argument. function rewardOnWasted (killer, weapon, bodypart ) if (killer and isElement(killer) and getElementType(killer) == "player" and killer ~= source ) then if bodypart == 9 then triggerServerEvent("addUserEXP", resourceRoot, killer, 10) else triggerServerEvent("addUserEXP", resourceRoot, killer, 5) end end end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), rewardOnWasted ) 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
Bilal135 Posted May 17, 2015 Author Posted May 17, 2015 Nevermind, fixed my self. btw, onClientPlayerWasted is never safe. "Get busy living or get busy dying"
Walid Posted May 17, 2015 Posted May 17, 2015 what do you mean by this btw, onClientPlayerWasted is never safe. 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
Moderators IIYAMA Posted May 19, 2015 Moderators Posted May 19, 2015 He means that clientside code is running on the players their pc, so it is edit able. Yet, I haven't seen any hackers successfully do anything with it. But: Using onPlayerWasted serverside would be more effective because it uses less bandwidth. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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