27.04.2010, 22:02
Here are two functions I use frequently .. infact, to say the least I use them in all my Admin command .. and there's alot. So .. to make my life easier, I'd like to add a "prefix" of sorts to these that will be sent before the actual string.. here's the functions:
Say I want to add the prefix "Admin Alert: " to them before the string itself .. is this how I would do it?
pawn Код:
stock MessageToMods(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1) if (PlayerInfo[i][Level] >= 2) SendClientMessage(i, color, string);
}
return 1;
}
stock MessageToAdmins(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1) if (PlayerInfo[i][Level] >= 3) SendClientMessage(i, color, string);
}
return 1;
}
pawn Код:
stock MessageToAdmins(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new str[128];
format(str, sizeof(str), "Admin Message: %s", string);
if(IsPlayerConnected(i) == 1) if (PlayerInfo[i][Level] >= 3) SendClientMessage(i, color, str);
}
return 1;
}