|
Veteran Member
Join Date: Apr 2017
Location: Brazil
|
09-30-2018
, 18:17
Re: Top Flags [27/09/2018]
|
#30
|
Quote:
Originally Posted by Bugsy
You need to review the function in entirety when making a change. You should not be exiting the function within the loop based on a condition that affects 1 player, replace the return X with continue.
Code:
for(new i; i < iNum; i++ )
{
id = iPlayers [i ]
if(get_user_flags(id ) & iFlagsRestrictToCheck )
return PLUGIN_HANDLED <- replace with continue, and indent. //If you want to require the player to have ALL of the flags in the cvar, replace with the below.
//Your code will skip them if they have one or more of the flags and not require all. If this is how you want it then disregard.
if ( ( get_user_flags(id ) & iFlagsRestrictToCheck ) == iFlagsRestrictToCheck )
continue;
iRank = get_user_stats (id, stats, bodyhits )
get_user_name(id, szName, charsmax (szName ))
if(iRank <= get_pcvar_num(VarRank ))
{
if(!isTop [id ])
{
client_print_color (id, print_team_red, "^x04[TopFlags]^x03: You are on^x04 TOP%d^x03 and have won the^x04 VIP flags.", get_pcvar_num(VarRank ))
client_print_color (0, print_team_red, "^x04[TopFlags]^x03: %s is in^x04 TOP%d^x03 and won the^x04 VIP flags.", szName, get_pcvar_num(VarRank ))
remove_user_flags(id, ADMIN_USER )
set_user_flags(id, flags )
isTop [id ] = true
}
//Remove this
return PLUGIN_HANDLED }
else
{
if(isTop [id ])
{
client_print_color (id, print_team_red, "^x04[TopFlags]^x03: You left the^x04 TOP%d^x03 and lost the^x04 VIP flags.", get_pcvar_num(VarRank ))
client_print_color (0, print_team_red, "^x04[TopFlags]^x03: %s left the^x04 TOP%d^x03 and lost the^x04 VIP flags.", szName, get_pcvar_num(VarRank ))
remove_user_flags(id, flags )
set_user_flags(id, ADMIN_USER )
isTop [id ] = false
}
}
}
|
Thanks for all the notes Bugsy, I believe I have learned a lot from this, I guarantee that in my next "adventures" I will be better.
__________________
Quote:
Originally Posted by fysiks
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
|
https://iceeedr.com.br/
|
|
|
|