06.02.2011, 13:54
(
Last edited by ilikenuts; 02/01/2014 at 06:06 PM.
)
*removed*
if (strcmp("/kick", cmdtext, true, 10) == 0)
{
Kick(playerid);
SendClientMessage(playerid, 0x0000FFAA,"/kick <id> <reason>");
if(!IsPlayerAdmin(playerid))
SendClientMessage(playerid, 0xAA3333AA,"You Are Not Admin.");
return 1;
}
Sorry, but this is a big fail. Check your kick command for example. You type /kick. It has no validation rules. You are then kicked (the player that typed the command) - then it checks to see if you're admin and if your not it tells you otherwise. First off; Thats not logical, secondly, it wont allow you to kick anyone but yourself. This goes for most of the admin commands i have seen, i havent had time to check them all. Example; pawn Code: if (strcmp("/kick", cmdtext, true, 10) == 0) { Kick(playerid); SendClientMessage(playerid, 0x0000FFAA,"/kick <id> <reason>"); if(!IsPlayerAdmin(playerid)) SendClientMessage(playerid, 0xAA3333AA,"You Are Not Admin."); return 1; } Oh, and - to make it worse, "/kick" (and NULL) is not 10 characters long. However, nice attempt. |
if(strcmp(cmd, "/kick", true) == 0){
new tmp[256];
tmp = strtok(cmdtext, idx);
if(strlen(tmp)){
SendClientMessage(playerid, COLOR_ORANGE, "Usage: /kick [playerid]");
return 1;
}
new victim;
victim = strval(tmp);
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
new playername2[MAX_PLAYER_NAME];
GetPlayerName(victim, playername2, sizeof(playername2));
new string[128];
format(string, sizeof(string), "The Admin %s kicked you!", playername);
SendClientMessage(victim, COLOR_RED, string);
Kick(victim);
format(string, sizeof(string), "You kicked %s", playername2);
SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "The Admin %s Kicked the player %s", playername, playername2);
SendClientMessageToAll(COLOR_RED, string);
return 1;
}
if(strcmp(cmd, "/kick", true) == 0){
new tmp[256], tmp2[256];
tmp = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
if(strlen(tmp)){
SendClientMessage(playerid, COLOR_ORANGE, "Usage: /kick [playerid] [reason]");
return 1;
}
if(strlen(tmp2)){
SendClientMessage(playerid, COLOR_ORANGE, "Usage: /kick [playerid] [reason]");
return 1;
}
new victim, reason;
victim = strval(tmp);
reason = strval(tmp2);
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
new playername2[MAX_PLAYER_NAME];
GetPlayerName(victim, playername2, sizeof(playername2));
new string[128];
format(string, sizeof(string), "The Admin %s kicked you! reason: %s", playername, cmdtext[6]);
SendClientMessage(victim, COLOR_RED, string);
Kick(victim);
format(string, sizeof(string), "You kicked %s. reason: %s", playername2, cmdtext[5]);
SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "The Admin %s Kicked the player %s. reason: %s", playername, playername2, cmdtext[6]);
SendClientMessageToAll(COLOR_RED, string);
return 1;
}