SA-MP Forums Archive
Jail problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Jail problem (/showthread.php?tid=612321)



Jail problem - Hunud - 16.07.2016

idk but guys Do you know how to do that,when i jail player he left server and re-join and he will be in jail unit time left?


Re: Jail problem - Sjn - 16.07.2016

Save the player's remaining jail time in your saving system.


Re: Jail problem - UltraScripter - 16.07.2016

new InJail[MAX_PLAYERS]

in your cmd add :
InJail[playerid] = 1

and on player spawn

if(InJail[playerid] == 0) return 0;
if(InJail[playerid] == 1)
{
SetPlayerInterior(playerid, jailint);
SetPlayerPos(playerid, x, y, z);
}

But if you will restart the server it wont save so batter use it with your saving system


Re: Jail problem - Hunud - 16.07.2016

is that ok ?

stock LoginPlayer(playerid)
{

PlayerInfo[playerid][Jailed] = 1;
return 1;
}


Re: Jail problem - UltraScripter - 16.07.2016

no i meant like this:

in your jail cmd:

new Ini:File = INI_Open(handle);
INI_WriteInt(File, "jail", 1);
INI_Close(File);

And when unjail:

new Ini:File = INI_Open(handle);
INI_WriteInt(File, "jail", 0);
INI_Close(File);


Re: Jail problem - Hunud - 16.07.2016

But i want when player jailed and he left he will be jailed again unit time expire ;/


Re: Jail problem - UltraScripter - 16.07.2016

Use settimerex + callbacks


Re: Jail problem - gurmani11 - 16.07.2016

You will be needing a saving system. That may keep the value of jailed player to 1 or true(if its a bool) .
And, when player connects first you will need to clear the variables and booleans. Then fetch the jailed data/punishment data and save in that same variable
And then on player spawn you just check if player is jailed and if the value is 1 or true then teleport player to the jail coordinates. And voilб you just jailed player even after reconnecting to the server.