08.02.2018, 10:41
Try this:
Код:
new bool:IsLoggedIn[MAX_PLAYERS]; forward AutoUnjail(); //OnGameModeInit SetTimer("AutoUnjail", 1020, 1); //OnPlayerDissconnect IsLoggedIn[playerid] = false; // when player successfully logs in IsLoggedIn[playerid] = true; //AutoJail as this calls in every second public AutoUnjail() { for(new i;i<MAX_PLAYERS;i++) { if(IsPlayerConnected(i)) { if(IsLoggedIn[i]) { if(PlayerInfo[i][Jailed] == 1) { if(PlayerInfo[i][LJailTime] > 0) { new string[24]; format(string, sizeof(string), "~w~JAILTIME..~n~ %d",PlayerInfo[i][LJailTime]); GameTextForPlayer(i, string, 1000, 6); //------------------------------------------------------ PlayerInfo[i][LJailTime] --; JailTimeServed[i] ++; } else if(PlayerInfo[i][LJailTime] == 0) { new pname[MAX_PLAYER_NAME], string[97]; GetPlayerName(i, pname, MAX_PLAYER_NAME); format(string, sizeof(string), "%s (%d) has been released from jail. JailTime Served: %d Seconds", pname, i, JailTimeServed[i]); SendClientMessageToAll(0x00C7FFAA, string); SendClientMessage(i,0x00C7FFAA,"You have been released from jail. You are free to leave the area."); //------------------------------------------------------ SetPlayerInterior(i,3); SetPlayerPos(i,210.5272,146.3341,1003.0234); SetPlayerFacingAngle(i,179.4662); SetCameraBehindPlayer(i); cannotescapejail[i] = 0; PlayerInfo[i][Jailed] = 0; JailTimer[i] = -1; JailTimeServed[i] =0; } } } } } return 1; }