Код:
CMD:jail(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 1)return NisiAdmin(playerid);
{
new id,time,reason[100], string[128],PlayerName[MAX_PLAYER_NAME],GPlayerName[MAX_PLAYER_NAME]; ----->> 1379 line
if(sscanf(params,"dds",id,time,reason)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /jail [playerid] [vrijeme] [razlog]");// this is sscanf routine , d=integer and s= string
if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Igrac nije ukljucen");// now we are checking if the targetid is online ! = not and id= targetid and if the id isnt on will send the message etc
if(Jailed[id] == 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: Igrac je vec zatvoren");// 1 jailed 0 is not jailed
GetPlayerName(id, PlayerName, sizeof(PlayerName));// the jailed person id
GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName));// the admin id
format(string, sizeof(string), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Razlog: %s", PlayerName, id, time, reason);
SendClientMessageToAll(COLOR_YELLOW, string);//%s = name . %d = number
SetPlayerPos(id, 197.5662, 175.4800, 1004.0);//player pos
SetPlayerHealth(id, 9999999999.0);//player cannot be killed
ResetPlayerWeapons(id);//resets his weapons
JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id);//jail timer
}
return 1;
}
CMD:unjail(playerid,params[])
{
new id;
if(PlayerInfo[playerid][pAdmin] < 4)return NisiAdmin(playerid);
{//checks if the player is admin
if(sscanf(params,"u",id)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /unjail <playerid>");//sscanf routine
if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected.");//checks if the targetid is connected
if(Jailed[id] == 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not jailed.");//checks if the id is jailed and if he isnt it will send an error.
Jailed[id] = 0;// sets his jail to 0 = unjailed
SetPlayerInterior(id, 0);//normal int
SetPlayerVirtualWorld(id, 0);//normal vw
SpawnPlayer(id);//respawns player
SetPlayerHealth(id, 100);//sets his health back as 100
KillTimer(JailTimer[id]);//kills the timer
}
return 1; ------->> 1409 line
}