Checkpoint problem (Unable to disable and set new)
#1

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.

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;
Reply
#2

What I noticed is you don't have prints where you actually disable or set the next checkpoint. I would put prints there, because if the print gets called it is a problem with the way you are using the Checkpoints, if they don't get called then their is a problem with either your if statements or your variables.
Reply
#3

Quote:
Originally Posted by CNMike
Посмотреть сообщение
What I noticed is you don't have prints where you actually disable or set the next checkpoint. I would put prints there, because if the print gets called it is a problem with the way you are using the Checkpoints, if they don't get called then their is a problem with either your if statements or your variables.
I'll find that you're also Incorrect, as you can see above the code that sets the checkpoints position (after disabling it) and above the 'IsPlayerInRangeOfPoint' there is actually and print, and that works fine. So frankly I don't know what the hell you're on about.

And even if i put a print before, after or in the middle of Disable and Set lines it'll still print whats in that function as its actually the two lines there that aren't working.

Edit: But being the complete idiot that i am, may have actually missed something
Edit Two: Nevermind the edit above, still the issue is persistant.
Reply
#4

Sometimes, checkpoints give you problems when you try to create a new one that is a different size then the first one. I don't see where you originally call your checkpoint but it could be a problem to look into. If you see every single print message that you made above, then I would personally comment out the check point creation and create a temp one with static coordinates. However, if the old checkpoint doesn't even disable it might be problem with how you orignally called your first checkpoint.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)