| nikhilgupta345 |
08-04-2011 02:12 |
WC3FT Help
I have already posted in the wc3mods.net forums, but that forum is dead, so I put my post here and there.
I seem to have a problem with giving a player double XP if he has a certain shopmenu item.
PHP Code:
stock XP_Give( id, iBonusXP )
{
if ( !WC3_Check() || !id )
{
return 0;
}
// Make sure we have the minimum amount of players
if ( !XP_MinPlayers() )
{
return 0;
}
// Bonus calculated by:
// Bonus XP * (lvl of player/10 + 1.0)
// I.E. if Player is level 10, then it will be Bonus XP * 2.0
if ( iBonusXP != 0 )
{
new Float:fCurrentLevel = float( p_data[id][P_LEVEL] );
new Float:iLevelMultiplier = ( fCurrentLevel / 10.0 ) + 1.0;
new iRealBonusXP = floatround(iLevelMultiplier * iBonusXP);
if( ITEM_Has( id, ITEM_PENDANT ) )
{
iRealBonusXP *= 2;
}
p_data[id][P_XP] += iRealBonusXP;
XP_Check( id );
return iRealBonusXP;
}
return 0;
}
When I do this, for some reason the player gets half the XP rather than twice the XP.
If any of you are familiar with the WC3 coding, could you help me out?
|