added amb845 - reports custom flags now
authorDavid Anderson <dvander@alliedmods.net>
Sun Aug 26 20:04:01 2007 +0000 (2007-08-26)
changeset 13761d799689de9a
parent 1375 b7acfca8070d
child 1377 723de5e67879
added amb845 - reports custom flags now
plugins/basecommands.sp
     1.1 --- a/plugins/basecommands.sp	Sun Aug 26 19:51:24 2007 +0000
     1.2 +++ b/plugins/basecommands.sp	Sun Aug 26 20:04:01 2007 +0000
     1.3 @@ -342,7 +342,7 @@
     1.4  #define FLAG_STRINGS		14
     1.5  new String:g_FlagNames[FLAG_STRINGS][20] =
     1.6  {
     1.7 -	"reservation",
     1.8 +	"res",
     1.9  	"admin",
    1.10  	"kick",
    1.11  	"ban",
    1.12 @@ -358,18 +358,42 @@
    1.13  	"cheat"
    1.14  };
    1.15  
    1.16 +CustomFlagsToString(String:buffer[], maxlength, flags)
    1.17 +{
    1.18 +	decl String:joins[6][6];
    1.19 +	new total;
    1.20 +	
    1.21 +	for (new i=_:Admin_Custom1; i<=_:Admin_Custom6; i++)
    1.22 +	{
    1.23 +		if (flags & (1<<i))
    1.24 +		{
    1.25 +			IntToString(i - _:Admin_Custom1 + 1, joins[total++], 6);
    1.26 +		}
    1.27 +	}
    1.28 +	
    1.29 +	ImplodeStrings(joins, total, ",", buffer, maxlength);
    1.30 +	
    1.31 +	return total;
    1.32 +}
    1.33 +
    1.34  FlagsToString(String:buffer[], maxlength, flags)
    1.35  {
    1.36 -	decl String:joins[FLAG_STRINGS][20];
    1.37 +	decl String:joins[FLAG_STRINGS+1][32];
    1.38  	new total;
    1.39  
    1.40  	for (new i=0; i<FLAG_STRINGS; i++)
    1.41  	{
    1.42  		if (flags & (1<<i))
    1.43  		{
    1.44 -			strcopy(joins[total++], 20, g_FlagNames[i]);
    1.45 +			strcopy(joins[total++], 32, g_FlagNames[i]);
    1.46  		}
    1.47  	}
    1.48 +	
    1.49 +	decl String:custom_flags[32];
    1.50 +	if (CustomFlagsToString(custom_flags, sizeof(custom_flags), flags))
    1.51 +	{
    1.52 +		Format(joins[total++], 32, "custom(%s)", custom_flags);
    1.53 +	}
    1.54  
    1.55  	ImplodeStrings(joins, total, ", ", buffer, maxlength);
    1.56  }