//Under the /jail command add this for the player your placing in jail
//Might wanna replace playerid's
SetPVarInt(playerid, "ReleaseTimer", SetTimerEx("ReleaseFromJail", 200000, false, "i", playerid));
//This will be called for a player after the timer is over...
//Will be released after 2 minutes
stock ReleaseFromJail(playerid)
{
KillTimer(GetPVarInt(playerid, "ReleaseTimer"));
SpawnPlayer(playerid);
return 1;
}
|
Originally Posted by [___
PotH3Ad ]
pawn Код:
|
|
Originally Posted by hansen111
Do you people ever read the wiki ? , it would save you a lot of time. Also not many will help you when you cant be bothered to read a few lines in the wiki, i will however help this time because im bored:
https://sampwiki.blast.hk/wiki/SetTimerEx From wiki: Note: The function that should be called must be public. That means it has to be forwarded. So add this line in top of script: forward ReleaseFromJail(playerid); Also change the function from stock to public: public ReleaseFromJail(playerid) |
forward AutoUnjailAlcatraz();
public AutoUnjailAlcatraz()
{
for(new i=0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(Jailed[i] == 1 && InAlcatraz[i] == 1)
{
if (JailTime[i] > 0)
{
JailTime[i] --;
new jtime;
jtime = (JailTime[i]);
format(szstring, sizeof(szstring), "~w~ALCATRAZ~n~..JAILTIME..~n~ %d",jtime);
GameTextForPlayer(i, szstring, 3000,6);
JailTimeServed[i] ++;
}
if (JailTime[i] == 0)
{
GetPlayerName(i, pname, 24);
new timeserved;
timeserved = (JailTimeServed[i]);
SetPlayerPos(i,230.0633,121.7518,1010.2188);
SetPlayerFacingAngle(i,208.3710);
SetCameraBehindPlayer(i);
cannotescapejail[i] =0;
SendClientMessage(i, 0xA9A9A9AA, "|_Released From Alcatraz_|");
SendClientMessage(i,0x00C7FFAA,"You have been auto-released from Alcatraz. You are free to leave Alcatraz Island");
format(szstring, sizeof(szstring), "%s(%d) Has been auto-released from Alcatraz. Time Served: %d Seconds",pname,i,timeserved);
SendClientMessageToAll(0x00C7FFAA, szstring);
Jailed[i] = 0;
InAlcatraz[i] =0;
JailTimeServed[i] =0;
}
}
}
}
}