Need a offline prison
#1

Can someone give me a offline prison..
(Command that can /prison offline players.)
Reply
#2

If you use a database, make the command search for the player and use variables for checks, etc..

Not that hard if you know what you're doing.
Reply
#3

Quote:
Originally Posted by FreAkeD
Посмотреть сообщение
If you use a database, make the command search for the player and use variables for checks, etc..

Not that hard if you know what you're doing.
I tried but is not working...
Reply
#4

assuming you save jailtime
erm, this might help you
cmdprision(playerid,params[])
{
//check for params "Usage: /oprision (FULLNAME) (time)"
//set the jailtime to the "time" in the player's save file
}

OnPlayerConnect(playerid)
{
if(//jailtime != 0)
{
JailPlayer(playerid)
}
return 1;
}
Reply
#5

My code.

Код:
public CmdOffPrison(playerid, nick[], seconds)
{
    if(!cache_num_rows()) return SendClientMessage(playerid,COLOR_GREY," Account not found");
    if(cache_get_field_content_int(0, "IsJail")) return SendClientMessage(playerid,COLOR_GREY," Player already is prison!");
    if(cache_get_field_content_int(0, "Level") < 3 && seconds > 600) return SendClientMessage(playerid,COLOR_GREY," Player lower at 3 level, can prison only on 600 seconds");
	AccWriteInt(nick,"IsJail", 4);
	AccWriteInt(nick,"JailTime", seconds);
	ASendMes(1,COLOR_LIGHTRED," Admin %s move to prison %s offline, to %i seconds",getName(playerid), nick, seconds);
	new sectext[12];
	format(sectext, sizeof(sectext), "%d", seconds);
	AdmLog(playerid, "offprison", nick, sectext);
	return 1;
}

CMD:offprison(playerid, params[])
{
	if(!AcceptWrite(playerid)) return 1;
	if(pData[playerid][IsAdmin] <= 1) return 1;
	new nick[MAX_PLAYER_NAME], priseconds;
	if(sscanf(params, "s[24]d",nick,priseconds)) return SendClientMessage(playerid, COLOR_WHITE, " Usage: /offprison [nick] [seconds]");
	mysql_format(MySQLConnect, httpquery,sizeof(httpquery),"SELECT * FROM `accounts` WHERE BINARY `Nick` = '%e' LIMIT 1",nick);
	mysql_tquery(MySQLConnect, httpquery, "CmdOffPrison", "isi", playerid, nick, priseconds);
	return 1;
}
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)