03.12.2018, 16:33
So i have made a trucker job, it is quite simple so when i am entering the first checkpoint (JobTruckerCheckpoint =1) it is going a mess on the server, is spamming me with the money and messages that i've done the first delivery, but in command it is showing that if i'm entering cp 1 to disablecheckpointforplayer but...i don't understand what's happening. Here's a picture with the mess and the bug
Here's the dialog code and the onplayerentercheckpoint code
The global variables on the top
The dialog that is showing if i accept the job trucker
AND the last where it is the bug
Код HTML:
https://imgur.com/a/fFcKcWU
The global variables on the top
Код:
new JobTruckerCar[MAX_PLAYERS], JobTruckerTrailer[MAX_PLAYERS], JobTruckerCheckpoint[MAX_PLAYERS],
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_JOB_TRUCKER)
{
if(!response) return 1;
else
{
SCM(playerid, -1, "{FFFFFF}Livreaza marfa la destinatie. Ti-a fost setat un {FF8C8C}checkpoint.");
JobTruckerCar[playerid] = CreateVehicle(403, -80.4830, -1125.6293, 1.6220, 71, 174, 174, 2, 0);
JobTruckerTrailer[playerid] = CreateVehicle(435, -72.1607, -1129.0836, 1.7047, 69.3000, 1, 1, 2);
PutPlayerInVehicle(playerid, JobTruckerCar[playerid], 0);
AttachTrailerToVehicle(JobTruckerTrailer[playerid], JobTruckerCar[playerid]);
JobTruckerCheckpoint[playerid] = 1;
SetPlayerCheckpoint(playerid, 2220.1470, -2226.6965, 13.5698, 5);
}
}
return 1;
}
Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(JobTruckerCheckpoint[playerid] == 1)
{
if(!IsTrailerAttachedToVehicle(JobTruckerCar[playerid])) return SCM(playerid, COLOR_RED, "Trebuie sa ai un trailer atasat de camion.");
else
{
if(!IsPlayerInVehicle(playerid, JobTruckerCar[playerid])) return SCM(playerid, COLOR_RED, "Trebuie sa fii in camion-ul de job pentru a continua");
DisablePlayerCheckpoint(playerid);
new suma = 6000+random(3000), string[128];
GivePlayerMoney(playerid, suma);
format(string, sizeof(string), "{FFE7A1}Ai primit {90D490}$%d {FFE7A1}pentru livrarea trailer-ului.", suma);
SCM(playerid, 0xFFE7A1FF, string);
SCM(playerid, COLOR_CREM, "Mergi in checkpoint pentru a livra alt {FFFFFF}trailer{FFE7A1} sau coboara din {FFFFFF}camion {FFE7A1}pentru a renunta la job");
SetVehicleHealth(JobTruckerCar[playerid], 1000);
JobTruckerCheckpoint[playerid] = 2;
SetPlayerCheckpoint(playerid, 2205.2981, -2243.7776, 13.5698, 5);
}
}
if(JobTruckerCheckpoint[playerid] == 2)
{
if(!IsPlayerInVehicle(playerid, JobTruckerCar[playerid])) return SCM(playerid, COLOR_RED, "Trebuie sa fii in camion-ul de job pentru a continua");
else
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, -86.9922, -1125.9095, 1.1386, 5);
JobTruckerCheckpoint[playerid] = 3;
SCM(playerid, -1, "{FFFFFF}Livreaza marfa la destinatie. Ti-a fost setat un {FF8C8C}checkpoint.");
AttachTrailerToVehicle(JobTruckerTrailer[playerid], JobTruckerCar[playerid]);
}
}
if(JobTruckerCheckpoint[playerid] == 3)
{
if(!IsTrailerAttachedToVehicle(JobTruckerCar[playerid])) return SCM(playerid, COLOR_RED, "Trebuie sa ai un trailer atasat de camion.");
else
{
if(!IsPlayerInVehicle(playerid, JobTruckerCar[playerid])) return SCM(playerid, COLOR_RED, "Trebuie sa fii in camion-ul de job pentru a continua");
new suma = 6000+random(3000), string[128];
GivePlayerMoney(playerid, suma);
format(string, sizeof(string), "{FFE7A1}Ai primit {90D490}$%d {FFE7A1}pentru livrarea trailer-ului.", suma);
SCM(playerid, 0xFFE7A1FF, string);
DisablePlayerCheckpoint(playerid);
SetVehicleHealth(JobTruckerCar[playerid], 1000);
SCM(playerid, COLOR_CREM, "Mergi in checkpoint pentru a livra alt {FFFFFF}trailer{FFE7A1} sau coboara din {FFFFFF}camion {FFE7A1}pentru a renunta la job");
SetPlayerCheckpoint(playerid, -114.5124, -1121.5095, 2.8256, 5);
JobTruckerCheckpoint[playerid] = 4;
}
}
if(JobTruckerCheckpoint[playerid] == 4)
{
if(!IsPlayerInVehicle(playerid, JobTruckerCar[playerid])) return SCM(playerid, COLOR_RED, "Trebuie sa fii in camion-ul de job pentru a continua");
else
{
DisablePlayerCheckpoint(playerid);
SCM(playerid, -1, "{FFFFFF}Livreaza marfa la destinatie. Ti-a fost setat un {FF8C8C}checkpoint.");
AttachTrailerToVehicle(JobTruckerTrailer[playerid], JobTruckerCar[playerid]);
JobTruckerCheckpoint[playerid] = 1;
SetPlayerCheckpoint(playerid, 2220.1470, -2226.6965, 13.5698, 5);
}
}
return 1;
}

