Questions about checkpoints...
#1

It's been over a year since i did anytihng to do with checkpoints.. To be honest it was jsut simple stuff with one checkpoint, so there was no need to identify sepperate ones..


Anyway..

I'm wanting to make 1 checkpoint at the moment, which will vanish if a player gets a certain distance away from it, and re-appear when the player gets a certain distance within it.

I figure it may be something to do with using a function to chekc the distance between the centre point of where the checkpoint will be created, and the players position.. Like a radius check on a timer.

The problem im having though is actually checking which checkpoint the player is in.

For example, at the moment i only need to create 1 checkpoint, but in future i will be needing maybe 20 in total..

I would prefer not to use a checkpoint streamer by someone else, because it would involve too many functions that i dont need, i jsut want to make something simple and effective. I just don't know where to start and how to identify each checkpoint.

It would be helpful if there was such a thing as GetPlayerCheckpoint but i checked the wiki and it doesnt exist.
Reply
#2

Do this in a timer or something:

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z)) //Refer to here wiki.sa-mp.com/wiki/IsPlayerInRangeOfPoint
{
  SetPlayerCheckpoint(BLAH BLAH BLAH)
}

if(!IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z))
{
  DestroyPlayerCheckpoint(playerid)
}
Reply
#3

Quote:
Originally Posted by [HiC
TheKiller ]
Do this in a timer or something:

pawn Код:
// code..
You could just do this:
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z)) SetPlayerCheckpoint(...);
else DisablePlayerCheckpoint(...);
Reply
#4

for multiply checkpoints and to check which checkpoint the player enters, easily use an array for making checkpoints:
pawn Код:
//global:
#define MAX_CPS 20 //Ofcourse change this to the max amount of checkpoints you want.

new
  gCheckpoints[ MAX_CPS ];
Then the check if player is close enough (you can make that part yourself, lol)
pawn Код:
gCheckpoints[ 0 ] = SetPlayerCheckpoint(...);
//gCheckpoints[ 1 ] = SetPlayerCheckpoint(...); for next, etc.
Then for a check which checkpoint the player enters:
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
  if(PlayerToPoint(2.0, playerid, 0.0, 0.0, 0.0)) //Search for the function
  { //This is "eg." gCheckpoints[ 0 ] 's location (x, y, z)
     //Stuff
  }
  return 1;
}
Good luck!
* It was kinda bad explained, but I hope you understand what I mean *
Reply
#5

Quote:
Originally Posted by lrZ^ aka LarzI
Good luck!
* It was kinda bad explained, but I hope you understand what I mean *
you forgot something important, SetPlayerCheckpoint returns only IsPlayerConnected
Reply
#6

Thanks guys, thats helped me a lot, I'll work on it and see wha ti can come up with..

Again thanks to all replies
Reply
#7

Quote:
Originally Posted by ♣ ⓐⓢⓢ
Quote:
Originally Posted by lrZ^ aka LarzI
Good luck!
* It was kinda bad explained, but I hope you understand what I mean *
you forgot something important, SetPlayerCheckpoint returns only IsPlayerConnected
lol, my bad :P
then my code is pretty useless x'D
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)