CMD:kick(playerid, params[])
{
new
targetid,
Reason[50],
AdminName[MAX_PLAYERS],
TargetName[MAX_PLAYER_NAME],
kickmsg[128];
if(PlayerInfo[pAdmin][playerid]>=1)
{
if(sscanf(params, "us[50]", targetid, Reason)) return SendClientMessage(playerid, 0xE90A0AFF, "[CMD] /kick [playerid] [reason]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xE90A0AFF, "[ERROR] Invalid player ID.");
GetPlayerName(playerid, AdminName, sizeof(AdminName));
GetPlayerName(targetid, TargetName, sizeof(TargetName));
format(kickmsg, sizeof(kickmsg), "[ADMIN] Admin %s has kicked %s [Reason: %s]", AdminName, TargetName, Reason);
SendClientMessageToAll(0xE90A0AFF, kickmsg);
SetTimerEx("KickPlayer", 500, 1, "i", playerid);
}
else
{
SendClientMessage(playerid, 0xE90A0AFF, "[ERROR] You are not authorized.");
}
return 1;
}
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
Kick(playerid);
return 1;
}
Kick(playerid);
CMD:kick(playerid,params[])
{
new targetid,Reason[50],AdminName[MAX_PLAYER_NAME],TargetName[MAX_PLAYER_NAME],kickmsg[145];
if(PlayerInfo[pAdmin][playerid] >= 1)
{
if(sscanf(params,"us[50]",targetid,Reason))return SendClientMessage(playerid,0xE90A0AFF,"[CMD] /kick [playerid] [reason]");
if(!IsPlayerConnected(targetid))return SendClientMessage(playerid,0xE90A0AFF,"[ERROR] Invalid player ID.");
GetPlayerName(playerid,AdminName,MAX_PLAYER_NAME);
GetPlayerName(targetid,TargetName,MAX_PLAYER_NAME);
format(kickmsg,sizeof kickmsg,"[ADMIN] Admin %s has kicked %s [Reason: %s]",AdminName,TargetName,Reason);
SendClientMessageToAll(0xE90A0AFF,kickmsg);
SetTimerEx("KickPlayer",500,0,"i",targetid);
return 1;
}
SendClientMessage(playerid,0xE90A0AFF,"[ERROR] You are not authorized.");
return 1;
}
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
Kick(playerid);
return 1;
}
Write it like this:
PHP код:
|