02.06.2020, 11:04
PHP Code:
CMD:kick(playerid, params[])
{
if(pInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, WHITE, "Server: Unknown command.");
new stringadm[144];
new str[144], id, reason[144];
if(pInfo[playerid][pLogin] == 0) return SendClientMessage(playerid, RED, "Register or Login first before using this command!");
if(pInfo[playerid][pAdmin] >= 1)
{
if(sscanf(params, "us[30]", id, reason)) return SendClientMessage(playerid, RED, "USAGE: /kick [id] [reason]");
if (pInfo[id][pAdmin] > pInfo[playerid][pAdmin]) return SendClientMessage(playerid, RED, "ERROR: You cannot Kick Admins who are a higher Rank than you.");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "ERROR: Invalid ID!");
if(id == playerid) return SendClientMessage(playerid, RED, "You cannot kick yourself!");
format(str, sizeof(str), "%s (%d) has been kicked by %s (%d) | Reason: %s", GetName(id), id, GetName(playerid), playerid, reason);
SendClientMessageToAll(RED, str); // informs all players somebody has been kicked.
format(str, sizeof(str), "You have kicked %s (%d) | Reason: %s", GetName(id), id, reason);
SendClientMessage(playerid, RED, str); // Informs the staff who kicked, they've kicked someone
format(str, sizeof(str), "%s (%d) kicked you | Reason: %s", GetName(playerid), id, reason);
SendClientMessage(id, RED, str); // informs the kicked person they've been kicked.
SetTimerEx("kickdelays", 3000, false, "i", id); // delay the kick
format(stringadm,sizeof(stringadm),"[ADM]: %s used /kick",GetName(playerid));
SendToAdmin(COLOR_ADM,stringadm);
}
else return SendClientMessage(playerid, WHITE, "Server: Unknown command.");
return 1;
}
PD: Why do you have a forward ''KickTimer''? According to your code, you don't use it