SA-MP Forums Archive
Problem OnPlayerEnterCheckpoint - on connect - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem OnPlayerEnterCheckpoint - on connect (/showthread.php?tid=660617)



Problem OnPlayerEnterCheckpoint - on connect - None1337 - 08.11.2018

So, i have a problem. When a player connect to server, OnPlayerEnterCheckpoint is called and I don't know why.

I've already put 'DisablePlayerCheckpoint(playerid)' to 'OnPlayerConnect'. This problem is just for a few players. But that wasn't before. probably because of they modpack (mods) or what?

Here is a log:

https://pastebin.com/aw27hG8c

Код:
public OnPlayerEnterCheckpoint(playerid)
{
          printf("[debug] OnPlayerEnterCheckpoint(%d) - npc: %d", playerid, IsPlayerNPC(playerid));
          return 1;
}



Re: Problem OnPlayerEnterCheckpoint - on connect - Gforcez - 08.11.2018

Do you destroy all checkpoints on OnGameModeExit or disable checkpoints for the player on OnPlayerDisconnect? There might be some left over checkpoints that get called by the server, but are invisible even when you call DisablePlayerCheckpoint in OnPlayerConnect.

Just a though, not sure if this will solve your issue.


Re: Problem OnPlayerEnterCheckpoint - on connect - None1337 - 08.11.2018

Quote:
Originally Posted by Gforcez
Посмотреть сообщение
Do you destroy all checkpoints on OnGameModeExit or disable checkpoints for the player on OnPlayerDisconnect? There might be some left over checkpoints that get called by the server, but are invisible even when you call DisablePlayerCheckpoint in OnPlayerConnect.

Just a though, not sure if this will solve your issue.
I did that, still the problem is.


Re: Problem OnPlayerEnterCheckpoint - on connect - None1337 - 09.11.2018

Bump


Re: Problem OnPlayerEnterCheckpoint - on connect - v1k1nG - 09.11.2018

Code


Re: Problem OnPlayerEnterCheckpoint - on connect - Ermanhaut - 09.11.2018

I always had issues with SAMP checkpoints, then i tried streamer and it worked for a while.
But the checkpoints were all buggy and the system usually didn't work.
After a lot of tries, i came up with a solution and it's working fine.

pawn Код:
// First, you want to create an enum to declare the types of the checkpoints:

#if !defined INVALID_CHECKPOINT_ID
  #define INVALID_CHECKPOINT_ID -1
#endif

enum {
  JOB_POINT = 1,
  CARGO_JOB,
  CARGO_LOAD_1,
  CARGO_UNLOAD_1,
  // etc
};

// Then, create a player's variable to keep track of the current checkpoint that is beeing showed to him.

playerCheckpoint[MAX_PLAYERS] = { INVALID_CHECKPOINT_ID, ... };

// Here's an exemple of use:

CMD:cargojob(playerid) {
  playerCheckpoint[playerid] = CARGO_JOB;
  return SetPlayerCheckpoint(playerid, /*the checkpoint coordinates and size*/);
}

public OnPlayerEnterCheckpoint(playerid) {

  switch(playerCheckpoint[playerid]) {
    case INVALID_CHECKPOINT_ID: return 0;
    case CARGO_JOB: {
      playerCheckpoint[playerid] = INVALID_CHECKPOINT_ID; // Do this first, otherwise the checkpoint can be called twice.
      ShowPlayerDialog(playerid, DIALOG_CARGO_JOB, /*you know the rest*/);
    }
  }
}