Multiple Checkpoints
#1

How can i add multiple checkpoints? because i do one, it works then i add another then the first one dont work
i have this

Код:
    SetPlayerCheckpoint(playerid, -23.50, -55.64, 1003.55, 6);
    SetPlayerCheckpoint(playerid, 197.40, 168.23, 1003.02, 3);
    SetPlayerCheckpoint(playerid, 378.39, -114.98, 1001.49, 5);
Reply
#2

You can only set one checkpoint at a time. However, you can use a streamer to steam the checkpoint that is closest to the player at the current time. Check out the Streamer Plugin:

https://sampforum.blast.hk/showthread.php?tid=102865

CreateDynamicCP
Reply
#3

Okay, i have streamer plugin, i did a look around the forum for stuff about CreateDynamicCP And nothing says anything about checkpoint that is closest to the player at the current time.
Reply
#4

You need to utilize the CreateDynamicCP function, which comes in the include file with the Streamer Plugin download. Include that file to your scripts source
pawn Код:
#include <streamer>
and replace all your CreateCheckpoint functions with CreateDynamicCP, changing/adding parameters as necessary. You will then be able to process what happens when a player enters the different checkpoints under the custom callbacks;; OnPlayerEnterDynamicCP and OnPlayerExitDynamicCP.

Read more in the streamer topic for more information, such as installation steps and other usages.
Reply
#5

so say i have edited this code
Код:
native CreateDynamicCP(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 100.0);
would that still go under checkpoint part of PAWNO or would it go at the top?
Reply
#6

You will not need to edit the include file (streamer.inc) itself. You need to edit the script you are using the SetPlayerCheckpoint functions in. Navigate to that script, and replace the SetPlayerCheckpoint functions with the name CreateDynamicCP. Make sure to also add the include to the script (which I showed above), and completely install the rest of the plugin (which can be found on it's thread).

So for example, say your old script looked like this:
pawn Код:
#include <a_samp>

public OnPlayerSpawn( playerid )
{
   SetPlayerCheckpoint( playerid, 0.00, 0.00, 0.00, 5.0 );
   SetPlayerCheckpoint( playerid, 1.00, 1.00, 1.00, 5.0 );
   SetPlayerCheckpoint( playerid, 2.00, 2.00, 2.00, 5.0 );
   return 1;
}
It should now look like:
pawn Код:
#include <a_samp>
#include <streamer>

public OnPlayerSpawn( playerid )
{
   CreateDynamicCP( playerid, 0.00, 0.00, 0.00, 5.0 );
   CreateDynamicCP( playerid, 1.00, 1.00, 1.00, 5.0 );
   CreateDynamicCP( playerid, 2.00, 2.00, 2.00, 5.0 );
   return 1;
}
Note: That is just an example. I have no clue what your real source code looks like
Reply
#7

Right okay, so they work when you do the command inside them, but they are not visible?
Reply
#8

Would you mind privately sending me your source code? I will add them to your script for you, and try to explain more in-depth there.
Reply
#9

Okay, i sent you the source code
Reply
#10

use something like this
of course if you will

PHP код:
#include <a_samp>
#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
new SomeJob[256]; //edit this
public OnFilterScriptInit()
{
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/job"cmdtexttrue10) == 0)
    {
            
SomeJob[playerid] = 1;
            
SetPlayerCheckpoint(playerid,1246.2437,-1847.1620,13.5907,5);// 1. cp (checkpoint) change the cordinates
            
Return 1;  
    }
    return 
0;
}  
    
public 
OnPlayerEnterCheckpoint(playerid)
{  
    if(
SomeJob[playerid] == 1){
         
SomeJob[playerid] = 2;
         
SetPlayerCheckpoint(playerid,1042.0785,-1760.6067,13.5953,5);2. cp (checkpointchange the cordinates
         
return 1;
      }
    if(
SomeJob[playerid] == 2){
         
SomeJob[playerid] = 3;
         
SetPlayerCheckpoint(playerid,1042.0785,-1760.6067,13.5953,5);3. cp (checkpointchange the cordinates
         
return 1;
      }
//and if your last check point is you add this
    
if(SomeJob[playerid] == 3){
         
SomeJob[playerid] = 0;
         
DisablePlayerCheckpoint(playerid);
         return 
1;
      }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)