Jail evade
#1

When someone gets sent to jail IG, they have a timer depending on how wanted they are. But a lot of people just log out and log in to evade jail.


How can I save the amount of Jail time a player has? So if they some how die in jail, or if they log out How can I save the timer, and when they respawn they get sent to jail once again with the remaining time?
Reply
#2

You can store the remaining jail time in a variable, save it into the user file and send the player back to prison when he or she relogs.
Reply
#3

Lol yeah, I know like what is needed to do it, but


How do i actually do it? Lol.


I have a register saving system. Using Dudb
Reply
#4

Here is part of my Jail code.




This is how the players time and stuff is handled


pawn Код:
if(GetPlayerWantedLevel(giveplayerid) >=4 && GetPlayerWantedLevel(giveplayerid) <=5) {
    new rnd;
    rnd = random(sizeof (ArrestedSpawn));
    SetPlayerInterior(giveplayerid,6);
    SetPlayerVirtualWorld(giveplayerid,0);
    SetPlayerPos(giveplayerid, ArrestedSpawn[rnd][0], ArrestedSpawn[rnd][1], ArrestedSpawn[rnd][2]);
    SetPlayerFacingAngle(giveplayerid, ArrestedSpawn[rnd][3]);
    format(szstring, sizeof(szstring), "Wanted suspect %s(%d) has been captured and sent to jail! ",pname,giveplayerid,oname,playerid);
    SendClientMessageToAll(0x00C7FFAA, szstring);
    SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_You Have Been Arrested_|");
    SendClientMessage(giveplayerid,0x00C7FFAA, szstring);
    SendClientMessage(giveplayerid,0x00C7FFAA,"You will be auto-released from jail or a Police Officer/Jail Turnkey can release you early");
    SendClientMessage(giveplayerid,0x00C7FFAA,"If jail life sucks for you... Why not try /escape");
    printf("%s", szstring);
    SendClientMessage(giveplayerid,0xFF7F50AA,"If you leave the server while you are in jail you WILL be banned");
    GivePlayerMoney(playerid,1500);
    Jailed[giveplayerid] =1;
    StoleCopCarRecent[giveplayerid] =0;
    triedtoescaperecent[giveplayerid] =1;
    ResetPlayerWeapons(giveplayerid);
    JailTime[giveplayerid] =80;
    JailTimeServed[giveplayerid] =0;
    SetPlayerWantedLevel(giveplayerid,0);
    oscore = GetPlayerScore(playerid);
    SetPlayerScore(playerid, oscore +1);
    return 1;
  }
Reply
#5

I'm also looking for something like this
Reply
#6

Bump, anyone? please.
Reply
#7

well you have jailtime as a PVar and it runs off a timer that decreases their time every second so, someone with 1minute in jail has a variable of 60 which decreases every second and when they quit save that variable.
then when they load data it checks if their jailtime variable is above 0 and if it is then puts them in jail.
ofc when the variable reaches 0 it removes them from jail or w/e you want it to do
Reply
#8

What i'm trying to do is save the jail time into there file so if they log out, and log in, the time continues from where they left off.



I need help with the code, I have no idea how to do it
Reply
#9

I just told you how to do it, if you want the actual code request it in the script request thread
Reply
#10

Quote:
Originally Posted by cessil
I just told you how to do it, if you want the actual code request it in the script request thread
Well, I already knew how to do it.

also, even if I do ask in the request thread, it won't even be bothered. All i need is some sort of start that i can build upon.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)