Checkpoints
#1

Hey I disabled the Yellow door marker. I want to replac them with Checkpoints basicaly Im trying to figure out how to create a checkpoint to teleport you to an interior and teleport you back from the marker you have entered before. For example there are 2 cluckin bell's and I want a player to exit were he has entred.
Reply
#2

use PlayerToPoint basics & the checkpoint thingy, scroll down at the right list..!

Sorry iam lazy to put PlayerToPoint definition and the checkpoint too
Reply
#3

Il try and search for it This is my first time working with cp
Reply
#4

Let me help you with that.

https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint - SetPlayerCheckpoint definition. Note: A player can only have 1 checkpoint at a time.

And the player to point definition:
pawn Код:
stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    new Float:oldposx, Float:oldposy, Float:oldposz;
    new Float:tempposx, Float:tempposy, Float:tempposz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    tempposx = (oldposx - x);
    tempposy = (oldposy - y);
    tempposz = (oldposz - z);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
    {
        return 1;
    }
    return 0;
}
----

You'd better use pickups. This way they will remain permanently there, and you can display more than 1. Create a pickup at the entrance using CreatePickup. And use the OnPlayerEnterPickup in combination with PlayerToPoint to set the player's interior.

https://sampwiki.blast.hk/wiki/CreatePickup - CreatePickup Definition
https://sampwiki.blast.hk/wiki/OnPlayerPickUpPickup - OnPlayerPickUpPickup Dedinition
Reply
#5

Yea but only when a player is at a sertain distance.
Reply
#6

Sorry for the double post but can any one suggest a CP stream which can do somthing like this.

Enter Check point (1) Setplayer to checkpoint (2)
Re-enter Chechpoint (2) Setplayer to Checkpoint (1)

Enter Check point (3) Setplayer to checkpoint (4)
Re-enter Chechpoint (4) Setplayer to Checkpoint (3)

ect
Reply
#7

You can do that yourself:
1) Create a global variable keeping track of the players checkpoint stuats
2) Set a checkpoint
3) When they enter the checkpoint, set their next checkpoint and increas the variables value
Reply
#8

So somthing like this.

pawn Код:
new CheckStatus[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
    SetPlayerCheckpoint(playerid, 2609.8323,1129.0747,10.6719, 3.0);
    CheckStatus[playerid] = 1;
    return 1;
}


public OnPlayerEnterCheckpoint(playerid)
{
  if(CheckStatus[playerid] == 1)
  {
   SetPlayerPos(playerid, 2587.2661,1146.1643,10.8203);
   CheckStatus[playerid] = 2;
   SetPlayerCheckpoint(playerid, 2587.2661,1146.1643,10.8203, 3.0);
  }

  if(CheckStatus[playerid] == 2)
  {
  SetPlayerPos(playerid, 2609.8323,1129.0747,10.6719);
  CheckStatus[playerid] = 1;
  }
  return 1;
}
Reply
#9

Exactly
Reply
#10

Aight there is a little fault with that :P When I entred check point one it did teleport me to checkpoint 2 but when I entred checkpoint 2 I teleported next to Checkpont 1 but checkpoint 1 did not appear. Also I want it the checkpoint to appear 0.2 miles away
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)