if (equal(sAction,"Spawned_With_The_Bomb")) { g_iPlayerRole[id] = PLR_BOMB_CARRIER; new iBonusXP = XP_Give( id, SPAWN_BOMB ); if ( iBonusXP != 0 && get_pcvar_num( CVAR_wc3_show_objectives ) ) { client_print( id, print_chat, "%s You have been awarded %d XP for spawning with the bomb", g_MODclient, iBonusXP ); } }
Pavizdį parodyt galit kaip padaryt, kad jeigu žaidėjas turi flagą kokį nors gauna 2x daugiau exp, kitu atvėju gauna normaliai exp.
Na tai galvok logiškai. XP_Give gauna kiek xp taškų bus pridėta, perkeliama į iBonusXP kintamąjį.
Tai dabar tiesiog reikia sąlygos, jei žaidėjas vip, tai reikia tuos xp padauginti iš 2.
if (equal(sAction,"Spawned_With_The_Bomb")) { g_iPlayerRole[id] = PLR_BOMB_CARRIER; new iBonusXP = XP_Give( id, SPAWN_BOMB ); if(get_user_flags(id) & ADMIN_LEVEL_H) iBonusXP *= 2 if ( iBonusXP != 0 && get_pcvar_num( CVAR_wc3_show_objectives ) ) { client_print( id, print_chat, "%s You have been awarded %d XP for spawning with the bomb", g_MODclient, iBonusXP ); } }
O dar paprasčiau, tiesiog XP_Give funkcijoje iš karto padauginti iš 2. Nereikės viso kodo redaguoti.
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); p_data[id][P_XP] += iRealBonusXP; XP_Check( id ); return iRealBonusXP; } return 0;}
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); p_data[id][P_XP] += iRealBonusXP; XP_Check( id ); return iRealBonusXP; } return 0;}
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(get_user_flags(id) & ADMIN_LEVEL_H) iRealBonusXP *= 2; p_data[id][P_XP] += iRealBonusXP; XP_Check( id ); return iRealBonusXP; } return 0;}