Jump to content

Little Problem


Bilal135

Recommended Posts

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 ) 

Link to comment

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 ) 

Link to comment
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 ) 

Link to comment
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 ) 

Link to comment
  • Moderators

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.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...