09.07.2016, 07:08
pawn Код:
CMD:jail(playerid, params[])
{
if(IsPlayerAdmin(playerid)) // if is admin player
{
new reason[36];
if(sscanf(params, "uis[100]", params[0], params[1], reason)) return SendClientMessage(playerid, -1, "usage: /jail [playerid] [time] [reason]");
if(jailed[params[0]][player_jailed] != true) // The player jailed not is already jailed
{
if(params[1] >= 10)
{
if(strlen(reason) >= 3 && strlen(reason) < 36) // The reason is valid, 3 - 35 charactes
{
new INI:File = INI_Open(players_jailed(params[0])); // save data jailed
INI_SetTag(File, "Information Jail");
INI_WriteString(File, "Admin", Name(playerid));
INI_WriteString(File, "Reason", reason);
INI_WriteInt(File, "Time", params[1]*1);
INI_Close(File);
new i_admin[24];
GetPlayerName(playerid, i_admin, 24);
jailed[params[0]][administrator] = i_admin;
jailed[params[0]][time_jailed] = params[1]*1;
jailed[params[0]][reason_jailed] = reason;
jailed[params[0]][player_jailed] = true;
defer animation_jail(params[0]);
defer timer_jail(params[0]);
new string[156];
format(string, sizeof(string), "** %s has been jailed %d seconds by administrator %s. reason: %s", Name(params[0]), params[1]*1, Name(playerid), reason);
SendClientMessageToAll(-1, string);
}
else
{
SendClientMessage(playerid, -1, "Reason incorrect, mнn 3 characters, max 35");
}
}
else
{
SendClientMessage(playerid, -1, "Time incorrect, min 10 seconds");
}
}
else
{
SendClientMessage(playerid, -1, "The player that you have entered is already in prison");
}
}
else
{
SendClientMessage(playerid, -1, "You need to be administrator(rcon) to use this command");
}
return 1;
}