18.08.2015, 08:30
Hi,
I've made an kick script
When i kick myself (for testing) it works correctly but when i try to connect again, server says "Server closed the connection.".
In
what should i write? (playerid or targetid?)
[/PHP]
I've made an kick script
When i kick myself (for testing) it works correctly but when i try to connect again, server says "Server closed the connection.".
PHP код:
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;
}
PHP код:
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
Kick(playerid);
return 1;
}
Код:
Kick(playerid);
[/PHP]