02.04.2011, 06:31
pawn Код:
CMD:achat(playerid, params[])
{
if(PlayerData[playerid][AdminLevel] > 0)
{
if(isnull(params)) return SendClientMessage(playerid,0xFF9900AA,"USAGE: /achat [text]");
new iStr[128+MAX_PLAYER_NAME+15]; //Place variables after error check -- Use only 1 appropriately sized string instead of 2
GetPlayerName(playerid,iStr,24); //Switch iName with iStr
format(iStr,sizeof(iStr),"[ADMIN CHAT] %s: %s",iStr,params); //format string BEFORE loop -- replace iName with iStr
for(new i = 0; i < MAX_PLAYERS; ++i) //Change 10 to MAX_PLAYERS
{
if((PlayerData[i][AdminLevel] > 0) && IsPlayerConnected(i) && !IsPlayerNPC(i)) //Change playerid to i -- Enclose conditionals appropriately
{
SendClientMessage(i,0xFF9900AA,iStr);
}
}
}
else return 0;
return 1;
}