/jail problem help---rep++
#1

why when jailed player reconnect he is unjailed HOW TO FIX

Code:
public OnPlayerSpawn(playerid)
{

     if(pInfo[playerid][Jailed]==1)
 	{
 	SetPlayerInterior(playerid, 3);
 	SetPlayerPos(playerid,197.5860,174.6970,1003.0234);
 	ResetPlayerWeapons(playerid);
 	Jtimer[playerid] = SetTimerEx("Unjail",60000,0,"d",playerid);
 	}
    if(Captured[playerid][CAPZONE] == 0 && IsPlayerCapturing[playerid][CAPZONE] == 1)
    {
    LeavingCAPZONE(playerid);
    }
    TextDrawHideForPlayer(playerid, CountText[playerid]);
    SetPlayerHealth(playerid, 99999);
    SetTimerEx("SpawnProtection", 10000, false, "i", playerid);
    SendClientMessage(playerid, RED, "Anti-Spawn kill protection");
    SetTimerEx("SpawnProtection1", 3000, false, "i", playerid);
    TogglePlayerControllable(playerid, false);
    SendClientMessage(playerid, -1, "You are being processed, please wait!");
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerInterior(playerid, 0);
    TextDrawHideForPlayer(playerid, Welcome);
	TextDrawHideForPlayer(playerid, register1);
Code:
CMD:jail(playerid, params[])
{
    if(pInfo[playerid][pLevel] >= 1)
    {
        new id, time = 0, reason[50];
        if(isnull(params)) return SendClientMessage(playerid, yellow, "Usage: /Jail <Player ID> <Minutes> <Reason>");
        sscanf(params, "uis[50]", id, time, reason);
        if(IsPlayerConnected(id) && id != playerid)
        {
            if(pInfo[id][Jailed] == 1) return SendClientMessage(playerid,red,"This player is already jailed. see /jailed");
            if(pInfo[playerid][pLevel] <= pInfo[id][pLevel]) return ShowMessage(playerid, red, 6);
            if(!isnull(reason) && time == 0)
		    format(Jstring,sizeof(Jstring),"Administrator %s has jailed player '%s' | Reason: %s",GetName(playerid),GetName(id),reason);
		    else if(!isnull(reason) && time >= 1) format(Jstring,sizeof(Jstring),"Administrator %s has jailed '%s' for %d minutes (reason: %s)",GetName(playerid),GetName(id), time, reason);
		    else if(isnull(reason) && time >= 1) format(Jstring,sizeof(Jstring),"Administrator %s has jailed '%s' for %d minutes",GetName(playerid),GetName(id), time);
		    else format(Jstring,sizeof(Jstring),"Administrator %s has jailed '%s'",GetName(playerid),GetName(id));
		    CommandToAdmins(playerid,"jail");
		    SendClientMessageToAll(red,Jstring);
		    pInfo[id][Jailed] = 1;
		    TogglePlayerControllable(id, false);
		    new Float:x, Float:y, Float:z;
			GetPlayerPos(id,x,y,z);
			SetPlayerCameraPos(id,x+7,y,z+5);
			SetPlayerCameraLookAt(id,x,y,z);
			JPlayer[id] = SetTimerEx("JailPlayer",3000,0,"d",id);
			if(GetPlayerState(id) == PLAYER_STATE_ONFOOT) SetPlayerSpecialAction(id,SPECIAL_ACTION_HANDSUP);
		    if(time >= 1)
			{
		    	Jtimer[id] = SetTimerEx("Unjail",time*1000*60,0,"u",id);
		    }
			return 1;
		}
		else return ShowMessage(playerid, red, 3);
    }
    else return ShowMessage(playerid, red, 1);
}
Code:
SaveStatus(playerid)
{
    new Jfile[100],str[60],year,month,day,hour,mins,sec;
    new seconds = gettime() - pInfo[playerid][ConnectedTime] + pInfo[playerid][TotalSecs];
    getdate(year, month, day);
    gettime(hour,mins,sec);
    format(str, 60,"%d/%d/%d at %d:%d:%d", day,month,year,hour,mins,sec);
	format(Jfile, 100, ACCOUNTS_PATH, GetName(playerid));
	new INI:ACCOUNT = INI_Open(Jfile);
	INI_WriteInt(ACCOUNT, "Score", GetPlayerScore(playerid));
	INI_WriteInt(ACCOUNT, "Cash", GetPlayerMoney(playerid));
	INI_WriteInt(ACCOUNT, "Kills", pInfo[playerid][Kills]);
	INI_WriteInt(ACCOUNT, "Deaths", pInfo[playerid][Deaths]);
	INI_WriteInt(ACCOUNT, "TotalSeconds", seconds);
	INI_WriteString(ACCOUNT, "TotalSpentTime", ConvertTime(seconds,mins,hour,day));
	INI_WriteString(ACCOUNT, "LastSeen", str);
	INI_WriteInt(ACCOUNT, "Jailed", pInfo[playerid][Jailed]);
	INI_Close(ACCOUNT);
}
Code:
public LoginPlayer(playerid, name[], value[])
{
    INI_Int("Level", pInfo[playerid][pLevel]);
    INI_Int("Donator", pInfo[playerid][Donator]);
    INI_Int("Banned", pInfo[playerid][Banned]);
    INI_Int("Kills", pInfo[playerid][Kills]);
    INI_Int("Deaths", pInfo[playerid][Deaths]);
    INI_Int("Muted", pInfo[playerid][Muted]);
    INI_Int("Score", pInfo[playerid][Score]);
    INI_Int("Cash", pInfo[playerid][Cash]);
    INI_Int("Skin", pInfo[playerid][Skin]);
    INI_String("LastLoggedIP", pInfo[playerid][IP], 16);
    INI_Int("TotalSeconds", pInfo[playerid][TotalSecs]);
    INI_Int( "Jailed",pInfo[playerid][Jailed] );
    return 1;
}
Reply
#2

bump HELP??
Reply
#3

use bool instead of int, it's clear to see it it.
Reply
#4

what you mean?
Reply
#5

bump
Reply
#6

bump
Reply
#7

show the player saving,
and change this to :
Code:
    if(pInfo[playerid][Jailed]==1)
 	{
 	SetPlayerInterior(playerid, 3);
 	SetPlayerPos(playerid,197.5860,174.6970,1003.0234);
 	ResetPlayerWeapons(playerid);
 	Jtimer[playerid] = SetTimerEx("Unjail",60000,0,"d",playerid);
        print("jailed");
 	}
and jail yourself, relog and see if it prints jailed
Reply
#8

again same problem i don't know where is player saving

Code:
SaveStatus(playerid)
{
    new Jfile[100],str[60],year,month,day,hour,mins,sec;
    new seconds = gettime() - pInfo[playerid][ConnectedTime] + pInfo[playerid][TotalSecs];
    getdate(year, month, day);
    gettime(hour,mins,sec);
    format(str, 60,"%d/%d/%d at %d:%d:%d", day,month,year,hour,mins,sec);
	format(Jfile, 100, ACCOUNTS_PATH, GetName(playerid));
	new INI:ACCOUNT = INI_Open(Jfile);
	INI_WriteInt(ACCOUNT, "Score", GetPlayerScore(playerid));
	INI_WriteInt(ACCOUNT, "Cash", GetPlayerMoney(playerid));
	INI_WriteInt(ACCOUNT, "Kills", pInfo[playerid][Kills]);
	INI_WriteInt(ACCOUNT, "Deaths", pInfo[playerid][Deaths]);
	INI_WriteInt(ACCOUNT, "TotalSeconds", seconds);
	INI_WriteString(ACCOUNT, "TotalSpentTime", ConvertTime(seconds,mins,hour,day));
	INI_WriteString(ACCOUNT, "LastSeen", str);
	INI_WriteInt(ACCOUNT, "Jailed", pInfo[playerid][Jailed]);
	INI_Close(ACCOUNT);
}
Reply
#9

bump
Reply
#10

bump!!!!!!!
Reply
#11

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)