command(oprison, playerid, params[])
{
new Name[128], string[128], time, Reason[128];
if(sscanf(params, "zdz", Name, time, Reason))
{
if(Player[playerid][AdminLevel] >= 6)
{
SendClientMessage(playerid, WHITE, "SYNTAX: /oprison [name] [time] [reason]");
SendClientMessage(playerid, GREY, "NOTE: This command is CaSe SeNsItIvE.");
}
}
else
{
if(Player[playerid][AdminLevel] >= 6)
{
if(strlen(Name) >= 3 && strlen(Name) < MAX_PLAYER_NAME+1)
{
format(string, sizeof(string), "Accounts/%s.ini", Name);
if(fexist(string))
{
if(dini_Int(string, "AdminLevel") < Player[playerid][AdminLevel])
{
dini_IntSet(string, "PrisonDuration", time);
dini_IntSet(string, "PrisonID", 1);
format(string, sizeof(string), "Prison: %s has been prisoned by %s, reason: %s (%d minutes).", Name, GetName(playerid), Reason, time);
SendClientMessageToAll(RED, string);
format(string, sizeof(string), "%s has offine prisoned %s", GetName(playerid), Name);
SendToAdmins(ADMINORANGE, string, 1);
}
else
{
SendClientMessage(playerid, WHITE, "You can't prison a higher level admins' account.");
}
}
else
{
SendClientMessage(playerid, WHITE, "Account not found.");
}
}
}
}
}
if(Player[i][PrisonID] >= 1)
{
if(Player[i][PrisonDuration] >= 1)
{
new string[128];
Player[i][PrisonDuration]--;
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~ ~R~%d seconds (%d minutes)", Player[i][PrisonDuration], SecondsToMinutes(Player[i][PrisonDuration]));
GameTextForPlayer(i, string, 1000, 3);
}
else
{
if(Player[i][PrisonID] == 1)
{
Player[i][PrisonDuration] = 0;
Player[i][PrisonID] = 0;
SetPlayerPos(i, SpawnX, SpawnY, SpawnZ);
SetPlayerVirtualWorld(i, SpawnWorld);
SetPlayerInterior(i, SpawnInt);
SendClientMessage(i, WHITE, "You have been released from Admin Prison.");
TogglePlayerControllable(i, true);
}
else
{
Player[i][PrisonDuration] = 0;
Player[i][PrisonID] = 0;
SetPlayerPos(i, 1480.5245, -1777.0061, 3281.7954);
SetPlayerVirtualWorld(i, SpawnWorld);
SetPlayerInterior(i, Groups[1][HQInteriorID]);
SendClientMessage(i, WHITE, "You have been released from Jail.");
TogglePlayerControllable(i, true);
}
}
}
}
}
return 1;
}
Player[i][PrisonDuration]
pawn Code:
|