09/01/2022 17:08
boa tarde. estou com um problema que tem hora que o player não foi preso por ninguem ele vai logar e diz que ele esta preso porém ele spawna normalmente.. ai o player reloga e nasce na cadeia como se tivesse sido preso mas não foi..
segue todo o codigo de prisão tanto por policial como por admin
ONPLAYERCONNECT
SISTEMA DE CADEIA ADMIN
SISTEMA DE CADEIA POLICIAL
O SISTEMA DE CADEIA POLICIAL ESTA EM INCLUDE E O SISTEMA DE PRISÃO ADM ESTA NO GAMEMODE.. MAS OS DOIS ESTÃO VERIFICANDO CERTO PELO QUE EU OLHEI.. ALGUEM PODE ME AJUDAR A DESCOBRIR PORQUE DESSE BUG INTERMITENTE.
segue todo o codigo de prisão tanto por policial como por admin
Código PHP:
if(IsPlayerJailed(playerid) || IsPlayerInChainAdmin(playerid))
{
static commandsAllowed[][11] = {
"/admins",
"/ranking",
"/afks",
"/presoscmd"
}, i;
for(i = 0; i < sizeof(commandsAllowed); i++)
{
if(!isnull(cmdtext) && (strfind(cmdtext, commandsAllowed[i][0], true) != -1))
return true;
}
SendClientMessage(playerid, COLOR_RED, TEXT_PLAYER_JAILED_CANT_USE_CMD);
return false;
}
else if(IsPlayerPoliceTarget(playerid))
{
static commandsForbidden[][15] = {
"/v",
"/car",
"/Aerolv",
"/Aerols",
"/Aerosf",
"/Lv",
"/Sf",
"/Ls",
"/Oficina",
"/Mappack",
"/Bigear",
"/Drift2",
"/Drift3",
"/Drift4",
"/Drift5",
"/Drift6",
"/Drift7",
"/Drift8",
"/Drift9",
"/Drift10",
"/DriftCity",
"/Twin",
"/Twin2",
"/Chilliad",
"/Stunt",
"/Circuito",
"/Chilliad",
"/Parkour",
"/Parkour2",
"/Parkour3",
"/Nrgparkour1",
"/Nrgparkour2",
"/Drop1",
"/Drop2",
"/Drag",
"/Praia",
"/Rdograu",
"/ir",
"/goto",
"/Mundo",
"/Jetpack",
"/Skin",
"/Veh",
"/Lvap",
"/Sfap",
"/Lspa",
"/Mp",
"/Kill",
"/Cg",
"/larmas",
"/Eagle",
"/DM",
"/Area51",
"/Favela",
"/Favela2",
"/Favela3",
"/Favelasf",
"/Afk",
"/Mundo",
"/cr",
"/irp",
"/r",
"/sp",
"/s",
"/arenapvp"
}, i;
for(i = 0; i < sizeof(commandsForbidden); i++)
{
if(!isnull(cmdtext) && (strfind(cmdtext, commandsForbidden[i][0], true) != -1))
{
SendClientMessage(playerid, COLOR_RED, TEXT_PLAYER_TARGET_CANT_USE_CMD);
return false;
}
}
return true;
}
return true;
}
ONPLAYERCONNECT
Código PHP:
ResetPlayerChainAdmin(playerid);
ResetPlayerJail(playerid);
if(playerConnectedNow[playerid])
{
playerConnectedNow[playerid] = false;
SetTimerEx("LoadPlayerChainAdmin", 300, false, "i", playerid);
GetPlayerPos(playerid, playerAFKCheck[playerid][E_PLAYER_AFK_POS][0], playerAFKCheck[playerid][E_PLAYER_AFK_POS][1], playerAFKCheck[playerid][E_PLAYER_AFK_POS][2]);
SetTimerEx("CheckPlayerAfk", CHECK_PLAYER_AFK_TIME, true, "i", playerid);
SetTimerEx("CheckPlayerWeaponHack", 700, false, "i", playerid);
checkPlayerNameTimer[playerid] = SetTimerEx("CheckPlayerNameAltered", 1000, true, "i", playerid);
ContaPlayer[playerid][Score] = GetPlayerScore(playerid);
if(MundoDM[playerid])
{
new weapons[13][2], i;
for (i = 0; i <= 12; i++)
GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
ResetPlayerWeapons(playerid);
for(i = 0; i <= 12; i++)
{
if(weapons[i][0] == 46 || weapons[i][0] == 43)
GivePlayerWeapon(playerid, weapons[i][0], weapons[i][1]);
}
}
}
SISTEMA DE CADEIA ADMIN
Código PHP:
IsPlayerInChainAdmin(playerid)
return playerChainAdmin[playerid][E_PLAYER_IN_CHAIN];
static PutPlayerInChainAdmin(playerid, time)
{
time = gettime() + time;//(60 * time);
playerChainAdmin[playerid][E_PLAYER_IN_CHAIN] = true;
playerChainAdmin[playerid][E_PLAYER_CHAIN_TIME] = time;
SetPlayerWantedLevel(playerid, 0);
if(IsPlayerCuffed(playerid))
UnshacklePlayer(playerid, REASON_NONE);
if(IsPlayerArrasted(playerid))
ChangePlayerArrestedState(playerid, GetPlayerArrastedMe(playerid), REASON_ADMIN);
if(IsPlayerApproached(playerid))
ChangePlayerApproachedState(playerid, GetPlayerApproachedMe(playerid), REASON_ADMIN);
TogglePlayerControllable(playerid, true);
SetPlayerTeam(playerid, TEAM_JAIL);
SetPlayerClass(playerid, PLAYER_CLASS_CIVIL);
SetPlayerVirtualWorld(playerid, 6666);
SetPlayerInterior(playerid, 6);
ResetPlayerWeapons(playerid);
SetPlayerPos(playerid, prisionPosition[0], prisionPosition[1], prisionPosition[2]);
SetPlayerFacingAngle(playerid, prisionPosition[3]);
SetPlayerHealth(playerid, 99999);
SetCameraBehindPlayer(playerid);
SetTimerEx("ShowPlayerPrisionTime", 900, false, "iii", playerid, time, 1);
}
static RemovePlayerFromChainAdmin(playerid)
{
SetPlayerClass(playerid, PLAYER_CLASS_CIVIL);
SetPlayerInterior(playerid, 0);
ResetPlayerChainAdmin(playerid);
SavePlayerChainAdmin(playerid);
SpawnPlayer(playerid);
SetPlayerHealth(playerid, 100.0);
GameTextForPlayer(playerid, "Livre", 1, 3);
}
ResetPlayerChainAdmin(playerid)
{
playerChainAdmin[playerid][E_PLAYER_IN_CHAIN] = false;
playerChainAdmin[playerid][E_PLAYER_CHAIN_TIME] = 0;
}
call:LoadPlayerChainAdmin(playerid)
{
if(!IsPlayerConnected(playerid))
return;
if(dir_exists(DIRECTORY_CHAIN_ADMIN))
{
new file[9 + MAX_PLAYER_NAME + 1];
format(file, sizeof(file), PLAYER_FILE_CHAIN_ADMIN_CFG, Nome(playerid));
if(DOF2_FileExists(file))
{
playerChainAdmin[playerid][E_PLAYER_IN_CHAIN] = DOF2_GetBool(file, "inChainAdmin");
playerChainAdmin[playerid][E_PLAYER_CHAIN_TIME] = DOF2_GetInt(file, "chainTime");/* + gettime();*/
if(playerChainAdmin[playerid][E_PLAYER_IN_CHAIN] && playerChainAdmin[playerid][E_PLAYER_CHAIN_TIME] > 0)
{
SendClientMessage(playerid, COLOR_YELLOW, TEXT_PLAYER_JAIL_INCOMPLETE);
PutPlayerInChainAdmin(playerid, playerChainAdmin[playerid][E_PLAYER_CHAIN_TIME]);
}
else
{
ResetPlayerChainAdmin(playerid);
DOF2_RemoveFile(file);
DOF2_SaveFile();
}
}
}
}
static SavePlayerChainAdmin(playerid)
{
new file[9 + MAX_PLAYER_NAME + 1];
format(file, sizeof(file), PLAYER_FILE_CHAIN_ADMIN_CFG, Nome(playerid));
if(!(playerChainAdmin[playerid][E_PLAYER_IN_CHAIN] && GetPlayerChainAdminTime(playerid) > 0))
{
if(DOF2_FileExists(file))
{
DOF2_RemoveFile(file);
DOF2_SaveFile();
}
return;
}
if(!DOF2_FileExists(file))
DOF2_CreateFile(file);
DOF2_SetBool(file, "inChainAdmin", playerChainAdmin[playerid][E_PLAYER_IN_CHAIN]);
DOF2_SetInt(file, "chainTime", GetPlayerChainAdminTime(playerid));
DOF2_SaveFile();
}
static GetPlayerChainAdminTime(playerid)
{
new time = gettime();
return (playerChainAdmin[playerid][E_PLAYER_CHAIN_TIME] < time) ? (0) : (playerChainAdmin[playerid][E_PLAYER_CHAIN_TIME] - time);
}
SISTEMA DE CADEIA POLICIAL
Código PHP:
call:ShowPlayerPrisionTime(playerid, timeArrested, type)//0 - Jail | 1 - Chain Admin
{
if(!IsPlayerConnected(playerid))
return;
if(!type)
{
if(!playerJail[playerid][E_PLAYER_JAILED])
return;
}
else
{
if(!IsPlayerInChainAdmin(playerid))
return;
}
if(gettime() >= timeArrested)
{
SetPlayerTeam(playerid, GetTeamOfPlayer(playerid));
SetPlayerInterior(playerid,0);
SetPlayerWorld(playerid, 0);
SpawnPlayer(playerid);
ResetPlayerJail(playerid);
ResetPlayerChainAdmin(playerid);
SavePlayerJail(playerid);
GameTextForPlayer(playerid, "", 1, 3);
return;
}
new time[16 + 12 + 1];
format(time, sizeof(time), TEXT_TIME_PRISION, TimeConvert(timeArrested));
GameTextForPlayer(playerid, time, 1300, 3);
SetTimerEx("ShowPlayerPrisionTime", 900, false, "iii", playerid, timeArrested, type);
}
call:LoadPlayerJail(playerid)
{
if(!IsPlayerConnected(playerid))
return;
if(dir_exists(DIRECTORY_JAIL))
{
new file[9 + MAX_PLAYER_NAME + 1];
format(file, sizeof(file), PLAYER_FILE_JAIL_CFG, GetNameOfPlayer(playerid));
if(DOF2_FileExists(file))
{
playerJail[playerid][E_PLAYER_JAILED] = DOF2_GetBool(file, "jailed");
playerJail[playerid][E_PLAYER_JAIL_TIME] = DOF2_GetInt(file, "jailTime") + gettime();
if(playerJail[playerid][E_PLAYER_JAILED] && playerJail[playerid][E_PLAYER_JAIL_TIME] > 0)
{
SendClientMessage(playerid, COLOR_YELLOW, TEXT_PLAYER_JAIL_INCOMPLETE);
PutPlayerInPrision(playerid, -1, -1);
return;
}
else
{
ResetPlayerJail(playerid);
DOF2_RemoveFile(file);
DOF2_SaveFile();
}
}
}
CheckPlayerState(playerid);
}
O SISTEMA DE CADEIA POLICIAL ESTA EM INCLUDE E O SISTEMA DE PRISÃO ADM ESTA NO GAMEMODE.. MAS OS DOIS ESTÃO VERIFICANDO CERTO PELO QUE EU OLHEI.. ALGUEM PODE ME AJUDAR A DESCOBRIR PORQUE DESSE BUG INTERMITENTE.