I'm having some problems with my gamemode's checkpoints. They are generated but after about 1 second and a half they disappear without any reason
I have no idea where the error is. This happens suddenly. I never needed checkpoints on my systems, but when I actually needed them I realized the error.
Код:
public OnPlayerEnterCheckpoint(playerid)
{
if (PlayerData[playerid][pTutorialStage])
{
DisablePlayerCheckpoint(playerid);
return 1;
}
if(TruckingCheck[playerid] >= 1 && PlayerData[playerid][pUnloading] == -1)
{
if (!IsPlayerInAnyVehicle(playerid))
{
SendErrorMessage(playerid, "Vocк nгo estб em um veнculo.");
return 1;
}
new vehicleid = GetPlayerVehicleID(playerid);
if (!IsLoadableVehicle(vehicleid))
{
SendErrorMessage(playerid, "Vocк nгo estб em um veнculo de entregas.");
}
new string[180];
format(string, sizeof(string), "Vocк ganhou $%d dуlares da missгo de caminhoneiro.", TruckingCheck[playerid]);
GiveMoney(playerid, TruckingCheck[playerid]);
TruckingCheck[playerid] = 0;
SendClientMessageEx(playerid, COLOR_LIGHTYELLOW, string);
DisablePlayerCheckpoint(playerid);
}
if (PlayerData[playerid][pCP])
{
DisablePlayerCheckpoint(playerid);
PlayerData[playerid][pCP] = 0;
}
if (ProcurandoCarro[playerid])
{
DisablePlayerCheckpoint(playerid);
GameTextForPlayer(playerid, "~G~VEICULO LOCALIZADO", 1000, 3);
}
if (PlayerData[playerid][pTask])
{
new id = -1;
if ((id = Entrance_Nearest(playerid)) != -1 && EntranceData[id][entranceType] == 2 && !PlayerData[playerid][pBankTask])
ShowPlayerFooter(playerid, "Pressione ~y~'F'~w~ para entrar no banco.");
if ((id = Business_Nearest(playerid)) != -1 && BusinessData[id][bizType] == 1 && !PlayerData[playerid][pStoreTask])
ShowPlayerFooter(playerid, "Pressione ~y~'F'~w~ para entrar na Suprimentos de varejo.");
if ((id = Entrance_Nearest(playerid)) != -1 && EntranceData[id][entranceType] == 1 && !PlayerData[playerid][pTestTask])
ShowPlayerFooter(playerid, "Pressione ~y~'F'~w~ para entrar na DMV.");
DisablePlayerCheckpoint(playerid);
}
if (PlayerData[playerid][pDrivingTest])
{
PlayerData[playerid][pTestStage]++;
if (PlayerData[playerid][pTestStage] < sizeof(g_arrDrivingCheckpoints)) {
SetPlayerCheckpoint(playerid, g_arrDrivingCheckpoints[PlayerData[playerid][pTestStage]][0], g_arrDrivingCheckpoints[PlayerData[playerid][pTestStage]][1], g_arrDrivingCheckpoints[PlayerData[playerid][pTestStage]][2], 3.0);
}
else
{
static
Float:health;
GetVehicleHealth(GetPlayerVehicleID(playerid), health);
if (health < 1000.0)
{
SendErrorMessage(playerid, "Vocк nгo passou no teste pois o veнculo estб danificado.");
GiveMoney(playerid, -1000);
}
else
{
GiveMoney(playerid, -150);
PlayerData[playerid][pDL] = 1;
SendSucessMessage(playerid, "Vocк passou no teste de direзгo e recebeu sua carteira de motorista.");
}
CancelDrivingTest(playerid);
}
}
else
{
new
vehicleid = GetPlayerVehicleID(playerid),
Float:health;
if (PlayerData[playerid][pWaypoint])
{
PlayerData[playerid][pWaypoint] = 0;
DisablePlayerCheckpoint(playerid);
PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][69]);
}
else if (PlayerData[playerid][pJob] == JOB_COURIER && !IsPlayerInAnyVehicle(playerid))
{
if (PlayerData[playerid][pLoading] && !PlayerData[playerid][pLoadCrate] && Job_NearestPoint(playerid) != -1)
{
PlayerData[playerid][pLoadCrate] = 1;
SetPlayerAttachedObject(playerid, 5, 3014, 1, 0.038192, 0.371544, 0.055191, 0.000000, 90.000000, 357.668670, 1.000000, 1.000000, 1.000000);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
ApplyAnimation(playerid, "CARRY", "liftup", 4.1, 0, 0, 0, 0, 0, 1);
//ShowPlayerFooter(playerid, "Aperte ~y~'N'~w~ perto de um caminhгo para colocar uma caixa.");
}
else if (PlayerData[playerid][pUnloading] != -1)
{
if (!PlayerData[playerid][pLoadCrate])
{
PlayerData[playerid][pLoadCrate] = 1;
ApplyAnimation(playerid, "CARRY", "liftup", 4.1, 0, 0, 0, 0, 0, 1);
SetPlayerAttachedObject(playerid, 4, 3014, 1, 0.038192, 0.371544, 0.055191, 0.000000, 90.000000, 357.668670, 1.000000, 1.000000, 1.000000);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
SetPlayerCheckpoint(playerid, BusinessData[PlayerData[playerid][pUnloading]][bizPos][0], BusinessData[PlayerData[playerid][pUnloading]][bizPos][1], BusinessData[PlayerData[playerid][pUnloading]][bizPos][2], 1.0);
//ShowPlayerFooter(playerid, "Leve a caixa atй a ~r~marca do mapa.");
CoreVehicles[PlayerData[playerid][pUnloadVehicle]][vehLoads]--;
}
else
{
static
Float:fX,
Float:fY,
Float:fZ,
string[64];
PlayerData[playerid][pLoadCrate] = 0;
ApplyAnimation(playerid, "CARRY", "putdwn", 4.1, 0, 0, 0, 0, 0, 1);
RemovePlayerAttachedObject(playerid, 4);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
switch (CoreVehicles[PlayerData[playerid][pUnloadVehicle]][vehLoadType])
{
case 1:
{
TruckingCheck[playerid] += 35;
GiveMoney(playerid, 35);
ShowPlayerFooter(playerid, "~g~$35~w~ foi adicionado em seu pagamento.");
}
case 2:
{
TruckingCheck[playerid] += 40;
GiveMoney(playerid, 40);
ShowPlayerFooter(playerid, "~g~$40~w~ foi adicionado em seu pagamento.");
}
case 3:
{
TruckingCheck[playerid] += 30;
GiveMoney(playerid, 30);
ShowPlayerFooter(playerid, "~g~$30~w~ foi adicionado em seu pagamento.");
}
case 4:
{
TruckingCheck[playerid] += 35;
GiveMoney(playerid, 35);
ShowPlayerFooter(playerid, "~g~$35~w~ foi adicionado em seu pagamento.");
}
case 5:
{
TruckingCheck[playerid] += 40;
GiveMoney(playerid, 40);
ShowPlayerFooter(playerid, "~g~$40~w~ foi adicionado em seu pagamento.");
}
case 6:
{
TruckingCheck[playerid] += 35;
GiveMoney(playerid, 35);
ShowPlayerFooter(playerid, "~g~$35~w~ foi adicionado em seu pagamento.");
}
}
if (CoreVehicles[PlayerData[playerid][pUnloadVehicle]][vehLoadType] == 5)
{
for (new i = 0; i < MAX_GAS_PUMPS; i ++) if (PumpData[i][pumpExists] && PumpData[i][pumpBusiness] == PlayerData[playerid][pUnloading]) {
PumpData[i][pumpFuel] += 100;
format(string, sizeof(string), "[Bomba de Gasolina]\n{FFFFFF}Litros: %d", i, PumpData[i][pumpFuel]);
UpdateDynamic3DTextLabelText(PumpData[i][pumpText3D], COLOR_DARKBLUE, string);
Pump_Save(i);
}
}
else
{
BusinessData[PlayerData[playerid][pUnloading]][bizProducts] += 20;
Business_Save(PlayerData[playerid][pUnloading]);
}
if (CoreVehicles[PlayerData[playerid][pUnloadVehicle]][vehLoads] > 0)
{
GetVehicleBoot(PlayerData[playerid][pUnloadVehicle], fX, fY, fZ);
SetPlayerCheckpoint(playerid, fX, fY, fZ, 1.0);
}
else
{
CoreVehicles[PlayerData[playerid][pUnloadVehicle]][vehLoads] = 0;
CoreVehicles[PlayerData[playerid][pUnloadVehicle]][vehLoadType] = 0;
PlayerData[playerid][pUnloading] = -1;
PlayerData[playerid][pUnloadVehicle] = INVALID_VEHICLE_ID;
DisablePlayerCheckpoint(playerid);
SendServerMessage(playerid, "Vocк entregou todas as caixas que estavam no veнculo.");
SendServerMessage(playerid, "Dirija-se com seu caminho, atй a marca em seu mapa, para receber o pagamento.");
SetPlayerCheckpoint(playerid, 2521.0376, -2090.3279, 13.4125, 5.0);
if (PlayerData[playerid][pShipment] != -1)
{
foreach (new i : Player) if (Business_IsOwner(i, PlayerData[playerid][pShipment])) {
SendServerMessage(playerid, "%s entregou uma caixa em %s.", ReturnName(playerid, 0), BusinessData[PlayerData[playerid][pShipment]][bizName]);
}
BusinessData[PlayerData[playerid][pShipment]][bizShipment] = 0;
Business_Save(PlayerData[playerid][pShipment]);
PlayerData[playerid][pShipment] = -1;
PlayerData[playerid][pDeliverShipment] = 0;
}
}
}
}
}
else if (PlayerData[playerid][pJob] == JOB_MINER && PlayerData[playerid][pMinedRock] && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CARRY)
{
new money = random(20) + 15;
SendSucessMessage(playerid, "Vocк recebeu $%d pela pedra vendida.", money);
GiveMoney(playerid, money);
PlayerData[playerid][pMinedRock] = 0;
PlayerData[playerid][pMineCount] = 0;
DisablePlayerCheckpoint(playerid);
RemovePlayerAttachedObject(playerid, 4);
SetPlayerAttachedObject(playerid, 4, 18634, 6, 0.156547, 0.039423, 0.026570, 198.109115, 6.364907, 262.997558, 1.000000, 1.000000, 1.000000);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
}
else if (PlayerData[playerid][pJob] == JOB_UNLOADER && IsPlayerInWarehouse(playerid) && GetVehicleModel(vehicleid) == 530 && CoreVehicles[vehicleid][vehLoadType] == 7)
{
GetVehicleHealth(vehicleid, health);
CoreVehicles[vehicleid][vehLoadType] = 0;
DestroyObject(CoreVehicles[vehicleid][vehCrate]);
CoreVehicles[vehicleid][vehCrate] = INVALID_OBJECT_ID;
DisablePlayerCheckpoint(playerid);
if (health < CoreVehicles[vehicleid][vehLoadHealth]) {
SendErrorMessage(playerid, "Vocк quebrou as caixas durante o processo.");
}
else {
SendServerMessage(playerid, "Vocк descarregou estб caixa, e recebeu $20 dуlares.");
GiveMoney(playerid, 20);
}
}
else if (PlayerData[playerid][pJob] == JOB_SORTER && PlayerData[playerid][pSorting] != -1)
{
if (PlayerData[playerid][pSortCrate])
{
PlayerData[playerid][pSortCrate] = 0;
RemovePlayerAttachedObject(playerid, 4);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
ApplyAnimation(playerid, "CARRY", "putdwn", 4.1, 0, 0, 0, 0, 0, 1);
SetPlayerCheckpoint(playerid, JobData[PlayerData[playerid][pSorting]][jobPoint][0], JobData[PlayerData[playerid][pSorting]][jobPoint][1], JobData[PlayerData[playerid][pSorting]][jobPoint][2], 1.0);
GiveMoney(playerid, 10);
ShowPlayerFooter(playerid, "Vocк ganhou ~g~$10~w~ dуlares pelo pacote.");
}
else
{
SetPlayerAttachedObject(playerid, 4, 1220, 5, 0.137832, 0.176979, 0.151424, 96.305931, 185.363006, 20.328088, 0.699999, 0.800000, 0.699999);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
ApplyAnimation(playerid, "CARRY", "liftup", 4.1, 0, 0, 0, 0, 0, 1);
SetPlayerCheckpoint(playerid, JobData[PlayerData[playerid][pSorting]][jobDeliver][0], JobData[PlayerData[playerid][pSorting]][jobDeliver][1], JobData[PlayerData[playerid][pSorting]][jobDeliver][2], 1.0);
PlayerData[playerid][pSortCrate] = 1;
ShowPlayerFooter(playerid, "Dirija-se o pacote atй a ~r~marca.");
}
}
}
return 1;
}
Up... Please help me