17.04.2017, 21:10
1. You passed in the name of the player to the kick function instead of the id.
2. You were adding the Warning in an else statement. So it becomes 4 instead of 3.
This should fix it.
2. You were adding the Warning in an else statement. So it becomes 4 instead of 3.
This should fix it.
PHP код:
COMMAND:warn(playerid, params[])
{
if (Player[playerid][IsLoggedIn] == true)
{
if(IsPlayerAdmin(playerid))
{
new id, msg1[128], name[MAX_PLAYER_NAME], name1[MAX_PLAYER_NAME], reason[128];
if(sscanf(params, "us", id, reason)) return SendClientMessage(playerid, -1, "Invalid Syntax, Usage: /warn (id) (Reason");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "That player doesn't exist!");
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, name1, sizeof(name1));
format(msg1, sizeof(msg1), "{FFFFFF}(INFO): {FF8F17}You have been warned by admin %s(%d) for %s", name, playerid, reason);
SendClientMessage(id, -1, msg1);
format(msg1, sizeof(msg1), "{FFFFFF}(PUBLIC INFO): {FF8F17}%s has been warned by %s(%d) for %s", name1, name, playerid, reason);
SendClientMessageToAll(-1, msg1);
Player[playerid][TotalWarns]++;
if(Player[playerid][TotalWarns] == 3)
{
SetTimerEx("WarnTimerKick", 500, false, "i", id);
//SendClientMessage(name1, -1, "{FFFFFF}(INFO): {FF8F17}You have been kicked for forbbiden level of warns!");
format(msg1, sizeof(msg1), "{FFFFFF}(PUBLIC INFO): {FF8F17}%s has been kicked for forbbiden level of warns!", name1);
SendClientMessageToAll(-1, msg1);
}
} else SendClientMessage(playerid, -1, "You are no admin");
} else SendClientMessage(playerid, -1, "You are no logged");
return 1;
}
forward WarnTimeKick(id);
public WarnTimeKick(id)
{
Kick(id);
}