Need a offline prison
#6

[/PHP]
CMDprison(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 3) // Your variable
{
new string[128], name[MAX_PLAYER_NAME], minutes, reason[64];
if(sscanf(params, "s[24]ds[64]", name, minutes, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /oprison [player name] [time (minutes)] [reason]");

new giveplayerid = ReturnUser(name);
if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin])
{
SendClientMessageEx(playerid, COLOR_WHITE, "You can't use this command on this account");
return 1;
}
SetPlayerArmedWeapon(giveplayerid, 0);

if(GetPVarInt(giveplayerid, "IsInArena") >= 0)
{
LeavePaintballArena(giveplayerid, GetPVarInt(giveplayerid, "IsInArena"));
}

GameTextForPlayer(giveplayerid, "~w~Welcome to ~n~~r~Fort DeMorgan", 5000, 3);
ResetPlayerWeaponsEx(giveplayerid);
format(string, sizeof(string), "AdmCmd: %s has been prisoned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
Log("logs/admin.log", string);
SendClientMessageEx(playerid, COLOR_WHITE, "The person is online and has been prisoned!");
format(string, sizeof(string), "AdmCmd: %s has been prisoned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
SendClientMessageToAllEx(COLOR_LIGHTRED, string);
PlayerInfo[giveplayerid][pWantedLevel] = 0;
SetPlayerWantedLevel(giveplayerid, 0);
PlayerInfo[giveplayerid][pJailTime] = minutes*60;
SetPVarInt(giveplayerid, "_rAppeal", gettime()+60); format(PlayerInfo[giveplayerid][pPrisonReason], 128, "[OOC][PRISON] %s", reason);
format(PlayerInfo[giveplayerid][pPrisonedBy], MAX_PLAYER_NAME, "%s", GetPlayerNameEx(playerid));
PhoneOnline[giveplayerid] = 1;
SetPlayerInterior(giveplayerid, 1);
PlayerInfo[giveplayerid][pInt] = 1;
new rand = random(sizeof(OOCPrisonSpawns));
Streamer_UpdateEx(giveplayerid, OOCPrisonSpawns[rand][0], OOCPrisonSpawns[rand][1], OOCPrisonSpawns[rand][2]);
SetPlayerPos(giveplayerid, OOCPrisonSpawns[rand][0], OOCPrisonSpawns[rand][1], OOCPrisonSpawns[rand][2]);
SetPlayerSkin(giveplayerid, 50);
SetPlayerColor(giveplayerid, TEAM_APRISON_COLOR);
Player_StreamPrep(giveplayerid, OOCPrisonSpawns[rand][0], OOCPrisonSpawns[rand][1], OOCPrisonSpawns[rand][2], FREEZE_TIME);
}
else
{
new tmpName[24], tmpPrisonedBy[24], tmpPrisonReason[64], query[512];
format(tmpPrisonReason, 64, "[OOC][PRISONACC] %s", reason);
format(tmpPrisonedBy, 24, "%s", GetPlayerNameEx(playerid));
mysql_escape_string(name, tmpName);
mysql_escape_string(tmpPrisonReason, tmpPrisonReason);

SetPVarString(playerid, "OnPrisonAccount", tmpName);
SetPVarString(playerid, "OnPrisonAccountReason", tmpPrisonReason);

format(string, sizeof(string), "Attempting to prison %s's account for %d minutes...", tmpName, minutes);
SendClientMessageEx(playerid, COLOR_YELLOW, string);

format(query,sizeof(query),"UPDATE `accounts` SET `PrisonReason` = '%s', `PrisonedBy` = '%s', `JailTime` = %d WHERE `PermBand` < 3 AND `Band` < 1 AND `AdminLevel` < %d AND `Username` = '%s'", tmpPrisonReason, tmpPrisonedBy, minutes*60, PlayerInfo[playerid][pAdmin], tmpName);
mysql_function_query(MainPipeline, query, false, "OnPrisonAccount", "i", playerid);
}
}
return 1;
}[/PHP]
Reply


Messages In This Thread
Need a offline prison - by Vizi - 04.02.2016, 07:37
Re: Need a offline prison - by FreAkeD - 04.02.2016, 07:50
Re: Need a offline prison - by Vizi - 04.02.2016, 08:22
Re: Need a offline prison - by xTURBOx - 04.02.2016, 08:44
Re: Need a offline prison - by povargek - 04.02.2016, 08:53
Re: Need a offline prison - by TopShooter - 04.02.2016, 08:57

Forum Jump:


Users browsing this thread: 1 Guest(s)