20.11.2018, 20:25
How do I do the following? Instead of kicking you to the warning 3/3, i sent you to coordinates (jail)
PHP код:
public KickTimer(playerid)
{
Kick(playerid);
return 1;
}
CMD:warn(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new giveplayerid, reason[50];
if(sscanf(params, "us[50]", giveplayerid, reason)) return SendClientMessage(playerid, 0xFFFFFFFF, "Correct usage: /warn [playerid/name] [reason]");
if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFFFFFFFF, "Player not connected.");
new string[150], sender[MAX_PLAYER_NAME], receiver[MAX_PLAYER_NAME];
GetPlayerName(playerid, sender, sizeof(sender));
GetPlayerName(giveplayerid, receiver, sizeof(receiver));
format(string, sizeof(string), "%s (%d) was warned by %s (%d), reason: %s (%d/3)", receiver, giveplayerid, sender, playerid, reason, Warns[giveplayerid]+1);
SendClientMessageToAll(0x00FFFFFF, string);
if(Warns[playerid] == 2)
{
format(string, sizeof(string), "%s (%d) was automatically kicked, reason: had 3 warnings", receiver, giveplayerid);
SendClientMessageToAll(0x00FFFFFF, string);
SetTimerEx("KickTimer", 1000, false, "i", giveplayerid);
}
else
{
Warns[giveplayerid] ++;
GameTextForPlayer(giveplayerid, "~r~warned~n~~w~check the chat", 5000, 6);
}
return 1;
}