21.04.2012, 05:04
I have scripted an AdminChat command. But when typed in-game, nothing happens. No errors in PAWN or in Console. Here is the script
Код:
if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0 || strcmp(cmd, "//", 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[128]; 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, "{33CCFF}USAGE:{FFFFFF} (/a)dmin [admin chat]"); return 1; } if (PlayerInfo[playerid][pAdmin] == 1) return format(string, sizeof(string), "*[Junior Administrator]%s : %s", sendername, playerid, result); else if (PlayerInfo[playerid][pAdmin] == 2) return format(string, sizeof(string), "*[General Administrator]%s : %s", sendername, playerid, result); else if (PlayerInfo[playerid][pAdmin] == 3) return format(string, sizeof(string), "*[Senior Administrator]%s : %s", sendername, playerid, result); else if (PlayerInfo[playerid][pAdmin] == 4) return format(string, sizeof(string), "*[Head Administraotr]%s : %s", sendername, playerid, result); else if (PlayerInfo[playerid][pAdmin] >= 1337) return format(string, sizeof(string), "*[Executive]%s : %s", sendername, result); if (PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_GRAD5, "You are not authorized to use this command"); { SendAdminMessage(COLOR_GREEN, string); } printf("Admin %s: %s", sendername, result); } return 1; }