Quote:
Originally Posted by kiarronis
Sorry, im newbie. Here is the code
|
This is the part of xp kill.
Code:
//This function is the ONLY way this plugin should add/subtract XP to a player
//There are checks to prevent overflowing
//To take XP away just send the function a negative (-) number
localAddXP(id, xp)
{
new playerXP = gPlayerXP[id]
new newTotal = playerXP + xp
if ( xp > 0 && newTotal < playerXP ) {
// Max possible signed 32bit int
gPlayerXP[id] = 2147483647
}
else if ( xp < 0 && (newTotal < -1000000 || newTotal > playerXP) ) {
gPlayerXP[id] = -1000000
}
else {
gPlayerXP[id] = newTotal
}
}
//----------------------------------------------------------------------------------------------
//native sh_add_kill_xp(id, victim, Float:multiplier = 1.0)
public _sh_add_kill_xp()
{
new id = get_param(1)
new victim = get_param(2)
// Stupid check - but checking prevents crashes
if ( id < 1 || id > gServersMaxPlayers || victim < 1 || victim > gServersMaxPlayers ) return
//new Float:mult = get_param_f(3)
localAddXP(id,floatround(get_param_f(3) * gXPGiven[gPlayerLevel[victim]]))
displayPowers(id, false)
}