Raised This Month: $ Target: $400
 0% 

Xp problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kiarronis
Junior Member
Join Date: Jan 2022
Location: Argentina
Old 01-18-2022 , 16:24   Re: Xp problem
Reply With Quote #1

Quote:
Originally Posted by kiarronis View Post
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)
}

Last edited by kiarronis; 01-18-2022 at 16:24.
kiarronis is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode