06.11.2014, 20:07
Well the title gives you an general idea on whats wrong, but basically when someone does the command /work it creates a checkpoint of three pre-defines places Start and Finish and when someone enter's that checkpoint it 'Spams' the console with all the prints that i've currently got in place but doesn't actually set the next Checkpoint or disable the current one before setting.
I've actually go no idea on why this is happening but hopefully someone can shed some light on the situation, and hopefully not some time wasting noob, that the forum seems to be flooded with.
Important Note: before anyone else asks for 'PlayerCPInformation' and 'JobInformation' it can be found below the code thats below this text.
I've actually go no idea on why this is happening but hopefully someone can shed some light on the situation, and hopefully not some time wasting noob, that the forum seems to be flooded with.
Important Note: before anyone else asks for 'PlayerCPInformation' and 'JobInformation' it can be found below the code thats below this text.
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
print("Someone entered a checkpoint, checking what one");
if(PlayerCPInformation[playerid][MissionCheckPoint] == 1 && AccountInformation[playerid][CurrentlyWorking] > -1)
{
print("Someone entered a mission checkpoint");
if(GetPlayerVehicleID(playerid) == AccountInformation[playerid][WorkingVehicleID])
{
print("The vehicle it was started in is valid");
new job = AccountInformation[playerid][CurrentlyWorking];
if(JobInformation[job][JobEndPoint] && !IsPlayerInRangeOfPoint(playerid, 20, JobInformation[job][F_START][0], JobInformation[job][F_START][1], JobInformation[job][F_START][2]))
{
new dist = JobInformation[job][JobDistance];
AccountInformation[playerid][CurrentlyWorking] = -1;
DisablePlayerCheckpoint(playerid);
for(new j = 0; j < MAX_SERVER_JOBS; j ++)
{
if(JobInformation[j][JobLinked] == JobInformation[job][JobLinked]) dist += JobInformation[j][JobDistance];
}
new string[128];
format(string,sizeof(string), "[WORK]: Congratulations you have successfully completed a mission, and you have travelled a total of '%d Metres'", dist);
SendClientMessage(playerid, COLOR_WHITE, string);
} else {
print("No End point for this checkpoint, finding the next location");
new njid = NextMissionStep(playerid, AccountInformation[playerid][CurrentlyWorking]);
if(njid > -1)
{
print("Found the next section, calculating the distance (if needed) and setting the next checkpoint.");
if(!IsPlayerInRangeOfPoint(playerid, 20, JobInformation[job][F_START][0], JobInformation[job][F_START][1], JobInformation[job][F_START][2]))
{
new dist = Distance(JobInformation[job][F_START][0], JobInformation[job][F_START][1], JobInformation[job][F_START][2], JobInformation[job][F_END][0], JobInformation[job][F_END][1], JobInformation[job][F_END][2]);
AccountInformation[playerid][MissionTotalDistance] += dist;
}
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, JobInformation[njid][F_START][0], JobInformation[njid][F_START][1],JobInformation[njid][F_START][2], 15);
AccountInformation[playerid][CurrentlyWorking] = JobInformation[njid][JobID];
} else {
SendClientMessage(playerid, COLOR_LIGHTRED, "There seems to be an issue with finding the next step in the job, that is either ('The End Point' or 'Next Checkpoint')");
SendClientMessage(playerid, COLOR_LIME, "Your balance has been updated with the total amount of money for the distance you've flown so far!");
}
}
} else {
SendClientMessage(playerid, COLOR_LIGHTRED, "You must finish the mission in the vehicle you started it in");
}
} else {
SendClientMessage(playerid, COLOR_LIGHTRED, "You're not currently doing a mission");
}
}
pawn Код:
{
MissionCheckPoint,
}
new PlayerCPInformation[MAX_PLAYERS][PlayerCPInfo];
enum JobInfo
{
JobID,
JobSlotUsed,
JobLinked,
JobDistance,
JobStep,
JobEndPoint,
Float: F_START[3],
Float: F_END[3],
};
new JobInformation[MAX_SERVER_JOBS][JobInfo];
JobInformation[1][F_START][0] = 1.9260,
JobInformation[1][F_START][1] = -41.4742,
JobInformation[1][F_START][2] = 2.0921;
JobInformation[1][F_END][0] = 310.0681,
JobInformation[1][F_END][1] = 2029.8296,
JobInformation[1][F_END][2] = 16.6159;
JobInformation[1][JobID] = 1;
JobInformation[1][JobLinked] = 1;
JobInformation[1][JobStep] = 1;
JobInformation[1][JobEndPoint] = 0;
JobInformation[2][F_START][0] = 1.9260,
JobInformation[2][F_START][1] = -41.4742,
JobInformation[2][F_START][2] = 2.0921;
JobInformation[2][F_END][0] = 310.0681,
JobInformation[2][F_END][1] = 2029.8296,
JobInformation[2][F_END][2] = 16.6159;
JobInformation[2][JobID] = 2;
JobInformation[2][JobLinked] = 1;
JobInformation[2][JobStep] = 2;
JobInformation[2][JobEndPoint] = 0;
JobInformation[3][F_START][0] = 1.9260,
JobInformation[3][F_START][1] = -41.4742,
JobInformation[3][F_START][2] = 2.0921;
JobInformation[3][F_END][0] = 310.0681,
JobInformation[3][F_END][1] = 2029.8296,
JobInformation[3][F_END][2] = 16.6159;
JobInformation[3][JobID] = 3;
JobInformation[3][JobLinked] = 1;
JobInformation[3][JobStep] = 3;
JobInformation[3][JobEndPoint] = 1;