if(strcmp(cmd, "/ac", true, 3) == 0)// 3 is the length of /me { if(!strlen(cmdtext[3])) return SendClientMessage(playerid, COLOR_LIGHTRED, "USAGE: /ac [action]"); GetPlayerName(playerid, Aname, sizeof(Aname)); for(new i=0; i < MAX_PLAYERS; i++) { if(GetPlayerAdminLvl(i) >= 1) { if(IsPlayerConnected(i)) { format(string, sizeof(string), "[ ADMIN ] %s : %s",Aname,cmdtext[4]); printf(string); SendClientMessage(i,COLOR_LIGHTFLASHRED, string); } } } return 1; }
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Originally Posted by speedruntrainer
Hmm, look to another admin scripts.
Do at the top of your script: pawn Код:
|
if(strcmp(cmd, "/ac", true, 3) == 0) { tmp=strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTRED, "USAGE: /ac [action]"); return 1; } else if(strlen(tmp)) { GetPlayerName(playerid, Aname, sizeof(Aname)); for(new i=0; i < MAX_PLAYERS; i++) { if(GetPlayerAdminLvl(i) >= 1) { if(IsPlayerConnected(i)) { format(string, sizeof(string), "[ADMIN]%s: %s",Aname,tmp); printf(string); SendClientMessage(i,COLOR_LIGHTFLASHRED, string); return 1; } } } } }
Originally Posted by Angel φ
this is wrong : if(GetPlayerAdminLvl(i) >= 1)
All players will can to use that command |
if(strcmp(cmd, "/ac", true, 3) == 0) { tmp=strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTRED, "USAGE: /ac [action]"); return 1; } else if(strlen(tmp)) { GetPlayerName(playerid, Aname, sizeof(Aname)); for(new i=0; i < MAX_PLAYERS; i++) { if(GetPlayerAdminLvl(i) >= 1) { if(IsPlayerConnected(i)) { format(string, sizeof(string), "[ADMIN]%s: %s",Aname,tmp); printf(string); SendClientMessage(i,COLOR_LIGHTFLASHRED, string); return 1; } } } } }
tmp=strtok(cmdtext, idx);
tmp=bigstrtok(cmdtext, idx);
stock bigstrtok(const string[], &idx) { new length = strlen(string); while ((idx < length) && (string[idx] <= ' ')) { idx++; } new offset = idx; new result[128]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = string[idx]; idx++; } result[idx - offset] = EOS; return result; }