Hi, i had a problem here. I've finished making an Job script (Trucking Mission) and its work good. But! i have some little problem here, iam not sure the problem is from script because the script is looks good, i think i have problem from plugins or others. Here is the problem info :
When i enter the Trucking CP, its show dialog with 1 option "Start Mission". When click start, player will be put on Tanker vehicle to start the mission. But when i already enter the car, the Dialog is showing again (so if player click Start Mission again then will spawn 2 Tanker vehicles). Idk whats wrong with this script ? i already try with new script like (pizza boy, bus mission) and its same. below i put some line of trucking script :
Код:
#define DIALOG_TMIS_START 18549
#define RCP_TMIS 16
#define RCP_TMISF 17
#define CP_TYPE_TMIS 18
new IsInTMis[MAX_PLAYERS];
temp1 = CreateDynamicCP(-76.8202, -1136.7112, 1.0781, 1.0, 0, 0, -1, 50.0);
cptype[temp1][0] = CP_TYPE_TMIS;
if(dialogid == DIALOG_TMIS_START)
{
if(response)
{
if(listitem == 0)
{
new tvar = CreateVehicle(514, -76.1636, -1128.9650, 1.7267, 69.9965, 0, 0, 30000, 0);
PutPlayerInVehicle(playerid, tvar, 0);
SendClientMessage(playerid, COLOR_YELLOW, "A marker has been set on your map, go there to get the Shipment.");
SetPlayerRaceCheckpoint(playerid, 1, 274.4175, 1408.9670, 10.1056, 0, 0, 0, 5.0);
gPlayerRaceCheckpointStatus[playerid] = RCP_TMIS;
IsInTMis[playerid]=1;
selawa[playerid]=1;
SetTimerEx("HexHax", 30000, false, "i", playerid);
printf("%s has started trucking mission.", playername);
}
}
}
case CP_TYPE_TMIS:
{
ShowPlayerDialog2(playerid, DIALOG_TMIS_START, DIALOG_STYLE_LIST, "Trucking Mission", "Start Mission", "Select", "Cancel");
}
case RCP_TMIS:
{
new rand = random(sizeof(tfl));
SendClientMessage(playerid, COLOR_YELLOW, "You have got the shipment, now make your way to the dealer.");
SetPlayerRaceCheckpoint(playerid, 1, tfl[rand][0], tfl[rand][1], tfl[rand][2], 0, 0, 0, 5.0);
gPlayerRaceCheckpointStatus[playerid] = RCP_TMISF;
}
case RCP_TMISF:
{
new str[256];
new tvar = TruckFCost;
format(str, sizeof(str), "Congratulations! You have handed the shipment and got $%d.", tvar);
SendClientMessage(playerid, COLOR_GREEN, str);
DisablePlayerRaceCheckpoint(playerid);
gPlayerRaceCheckpointStatus[playerid] = 0;
IsInTMis[playerid]=0;
GivePlayerMoney(playerid, tvar);
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
printf("%s has finished trucking mission and got $%d.", name, tvar);
DestroyVehicle(GetPlayerVehicleID(playerid));
RemovePlayerFromVehicle(playerid);
dini_IntSet(AddDirFile(dir_userfiles, name), "Trucking", dini_Int(AddDirFile(dir_userfiles, name), "Trucking")+1);
}
You're already tracking if someone is doing a trucker mission or not, so that's good. Now what you can do with that tracking variable (IsInTMis), is to make a check if someone enters the start checkpoint, if they're already in a trucking mission, simply do nothing and ignore it. If they're not on a mission then you can show the dialog.