27.09.2015, 17:24 
	
	
	
		Hello i have Problйm in Jail system When i die he spawn again and When he disconnect like when he die.
i want when he die he back to Jail and When he Disconnect and back he back to Jail Again help me.
	
	
	
	
i want when he die he back to Jail and When he Disconnect and back he back to Jail Again help me.
PHP код:
new JailTimer[MAX_PLAYERS];// for the timer
enum
{
    Jailed,
}
OnPlayerconnect
    PlayerInfo[playerid][Jailed] = 0;
OnPlayerspawn
    if (PlayerInfo[playerid][Jailed] == 1)
    {
        SetPlayerInterior(playerid,6);
        SetPlayerPos(playerid,264.1542,77.6009,1001.0391);
    }
OnPlayerDeath
    if (PlayerInfo[playerid][Jailed] == 1)
    {
          SetPlayerInterior(playerid,6);
          SetPlayerPos(playerid,264.1542,77.6009,1001.0391);
    }
CMD:jail(playerid,params[])
{
    if (PlayerInfo[playerid][Admin] < 2) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You are not authorized to use this command!");
    new id,time,reason[100],PlayerName[MAX_PLAYER_NAME],GPlayerName[MAX_PLAYER_NAME],szString[128];
    if(sscanf(params,"dds",id,time,reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /jail <playerid> <time> <reason>");
    if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected.");
    if(PlayerInfo[id][Jailed] == 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is already jailed.");
    GetPlayerName(id, PlayerName, sizeof(PlayerName));
    GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName));
    format(szString, sizeof(szString), "Admin %s(%d) has  jailed you for %d minutes; Reason: %s", GetPlayerNameEx(playerid), id, time, reason);
    SendClientMessage(id,0x00D9ADFF, szString);
    SetPlayerInterior(id, 6);
    SetPlayerVirtualWorld(id, 10);
    SetPlayerPos(id, 264.1542,77.6009,1001.0391);
    ResetPlayerWeapons(id);
    JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id);
    return 1;
}
CMD:unjail(playerid,params[])
{
         new id;
         if (PlayerInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You are not authorized to use this command!");
        if(sscanf(params,"u",id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /unjail <playerid>");//sscanf routine
        if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected.");//checks if the targetid is connected
        PlayerInfo[id][Jailed] = 0;// sets his jail to 0 = unjailed
        SetPlayerInterior(id, 0);//normal int
        SetPlayerVirtualWorld(id, 0);//normal vw
        SpawnPlayer(id);//respawns player
        SetPlayerHealth(id, 100);//sets his health back as 100
        KillTimer(JailTimer[id]);//kills the timer
        return 1;
} 



 +rep and Ty