23.07.2015, 18:42
pawn Код:
if(strcmp(cmd, "/adminchat", true) == 0 || strcmp(cmd, "/a", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[264];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /(a)dmin©hat [chat]");
return 1;
}
for (new i; i<=MAX_PLAYERS; i++)
{
if(strfind(result, GetName(i), true) != -1)
{
if(ChatSound[i] != 1) continue;
if(PlayerInfo[i][pAdmin] < 1) continue;
PlayerPlaySound(i,21000,0,0,0);
}
}
new gradul[50];
if(PlayerInfo[playerid][pAdmin] > 0 ) { gradul = "Incepгtor"; }
if(PlayerInfo[playerid][pAdmin] > 1 ) { gradul = "General"; }
if(PlayerInfo[playerid][pAdmin] > 2 ) { gradul = "Experimentat"; }
if(PlayerInfo[playerid][pAdmin] > 3 ) { gradul = "Manager"; }
format(string, sizeof(string), "{E3B74D}[Administrator %s] %s vг spune:{9E9E9E} %s", gradul, GetName(playerid), result);
if (PlayerInfo[playerid][pAdmin] != 0)
{
SendAdminMessage(COLOR_YELLOW2, string);
}
}
return 1;
}
i don't use sscanf..