SA-MP Forums Archive
Checkpoints - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Checkpoints (/showthread.php?tid=84095)



Checkpoints - 6tynine - 28.06.2009

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.


Re: Checkpoints - Moustafa - 28.06.2009

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

Sorry iam lazy to put PlayerToPoint definition and the checkpoint too


Re: Checkpoints - 6tynine - 28.06.2009

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


Re: Checkpoints - Cezar - 28.06.2009

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


Re: Checkpoints - 6tynine - 28.06.2009

Yea but only when a player is at a sertain distance.


Re: Checkpoints - 6tynine - 28.06.2009

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


Re: Checkpoints - Grim_ - 28.06.2009

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



Re: Checkpoints - 6tynine - 28.06.2009

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;
}



Re: Checkpoints - Grim_ - 28.06.2009

Exactly


Re: Checkpoints - 6tynine - 28.06.2009

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