05.01.2011, 23:32
I suggest you use zmcd but if you must use strcmp alone then...
Edit: Damn got ninja'd
pawn Код:
if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/c", 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[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: (/c) [admin chat]");
return 1;
}
format(string, sizeof(string), "*%d Admin %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (PlayerInfo[i][pAdmin] >= 1)
{
SendAdminMessage(i, COLOR_LIGHTGREEN, string);
}
}
format(string,sizeof(string), "Server - AdminChat [%d] %s: %s",playerid, sendername, result);
}
return 1;
}