[Include] Simple Checkpoint Streamer
#1

[3Play : Checkpoint Streamer Library]
Include File Features:
  • Simple Checkpoint Streaming
  • Optimized Scripting Method
  • Advanced Checkpoint Options (Interior, Virtual World, Owner)
  • Single User Checkpoint Streaming
  • The simpliest Checkpoint Identifier ever

How does it work?
In the following example, I will create a simple bank checkpoint inside the City Planning Dpt. at Las Venturas

1. We need the include statement at the top of the script in order to include the CheckpointManager.inc
pawn Код:
#include <a_samp>
#include <CheckpointManager>
2. Here I will define a number that identifies my Checkpoint right next to the includes
pawn Код:
// Checkpoint Definitions
#define BANK_CITYPLANNING        0
3. Somewhere inside GameModeInit, I will create my checkpoint and set its interior to 3 (City Planning Dpt Interior ID)
pawn Код:
// Add Checkpoints
    // Note: GLOBAL_OWNER_ID is defined at CheckpointManager.inc as -1
    CreateCheckpoint(GLOBAL_OWNER_ID, BANK_CITYPLANNING, 362.2479, 173.5770, 1008.3828);
    SetCheckpointInterior(BANK_CITYPLANNING, 3);

    // Initializing the CheckpointManager
    StartCheckpointSeeking();
    (...)
4. Very important: You need to call "VerifyCheckpoint" method at OnPlayerEnterCheckpoint. Like this:
pawn Код:
public OnPlayerEnterCheckpoint(playerid){
    VerifyCheckpoint(playerid); // Asks the ChpManager to check this checkpoint and fire the next function
    return 1;
}
This will make the ChpManager check which checkpoint the player has entered and fire a more specified function:
pawn Код:
public OnCheckpointEnter(playerid, checkpointid){
    switch(checkpointid)
    {
      // BANKS
      case BANK_CITYPLANNING: // The checkpoint ID we specified when we created the checkpoint
      {
        SendClientMessage(playerid, COLOR_MESSAGE, "Welcome to the San Andreas Bank");
        SendClientMessage(playerid, COLOR_MESSAGE, "To deposit money type «/bank deposit [ammount]»");
        SendClientMessage(playerid, COLOR_MESSAGE, "To withraw money type «/bank withraw [ammount]»");
        SendClientMessage(playerid, COLOR_MESSAGE, "To request a loan type «/bank loan [ammount]»");
      }
    }
    return 1;
}
Simple isn't it?

Functions Included:
CreateCheckpoint(ownerid, chpid, FloatosX, FloatosY, FloatosZ); Creates a checkpoint
SetCheckpointInterior(chpid, interiorid); Sets the checkpoint interior
SetCheckpointVirtualWorld(chpid, VirtualWorldID); Sets the checkpoint virtual world
ToggleCheckpointActive(chpid, bool:active); Makes the checkpoint active or innactive
ChangeCheckpointOwner(chpid, owner); Changes the checkpoint owner
RemoveCheckpoint(chpid); Removes a checkpoint
StartCheckpointSeeking(); Makes the manager start seeking for nearby checkpoints
StopCheckpointSeeking(); Makes the manager stop seeking for nearby checkpoints
VerifyCheckpoint(playerid); Must be called at OnPlayerEnterCheckpoint


Source Download:
Version 0.1.1b

- Fixed a major Checkpoint Streaming Bug. Download please
Reply
#2

REALLY NICE
But the post looks some gaotic!
Reply
#3

Quote:
Originally Posted by Oxside
REALLY NICE
But the post looks some gaotic!
Agreed.
Reply
#4

Quote:
Originally Posted by Damien [T-RP
]
Quote:
Originally Posted by Oxside
REALLY NICE
But the post looks some gaotic!
Agreed.
Sorry lol.
It was my first release. I kinda didn't knew how to do it xD
Reply
#5

VERY VERY COOL!!!!!
THANKS!
Reply
#6

hello sorry for my bad english
then already superb include

I add a function when we exit the CP see below

pawn Код:
#include <a_samp>
#include <CheckpointManager>
#define CP_1 0
#define CP_2 1
#define CP_3 2
#define CP_4 3
#define CP_5 4
pawn Код:
public OnGameModeInit()
{
    CreateCheckpoint(GLOBAL_OWNER_ID, CP_1, 1958.3783,1343.1572,15.3746);
    CreateCheckpoint(GLOBAL_OWNER_ID, CP_2, 2031.7180,1366.5226,10.8203);
    CreateCheckpoint(GLOBAL_OWNER_ID, CP_3, 1988.9958,1422.4563,9.1094);
    CreateCheckpoint(GLOBAL_OWNER_ID, CP_4, 1957.9187,1447.3143,10.8203);
    CreateCheckpoint(GLOBAL_OWNER_ID, CP_5, 1910.4789,1496.8055,13.6717);
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    StartCheckpointSeeking();
    return 1;
}
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
  VerifyCheckpoint(playerid);
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
  VerifyCheckpointe(playerid);
    return 1;
}
pawn Код:
public OnCheckpointEnter(playerid, checkpointid){
    switch(checkpointid)
    {
     
      case CP_1:
      {
        SendClientMessage(playerid, 0xFFFFFFAA, "enter CP_1 ");

      }
      case CP_2:
      {
        SendClientMessage(playerid, 0xFFFFFFAA, "enter CP_2 ");

      }
      case CP_3:
      {
        SendClientMessage(playerid, 0xFFFFFFAA, "enter CP_3 ");

      }
      case CP_4:
      {
        SendClientMessage(playerid, 0xFFFFFFAA, "enter CP_4 ");

      }
      case CP_5:
      {
        SendClientMessage(playerid, 0xFFFFFFAA, "enter CP_5 ");

      }
    }
    return 1;
}
pawn Код:
public OnCheckpointEXIT(playerid, checkpointid){
    switch(checkpointid)
    {

      case CP_1:
      {
        SendClientMessage(playerid, 0xFFFFFFAA, "exit CP_1 de test");

      }
      case CP_2:
      {
        SendClientMessage(playerid, 0xFFFFFFAA, "exit CP_2 de test");

      }
      case CP_3:
      {
        SendClientMessage(playerid, 0xFFFFFFAA, "exit CP_3 de test");

      }
      case CP_4:
      {
        SendClientMessage(playerid, 0xFFFFFFAA, "exit CP_4 de test");

      }
      case CP_5:
      {
        SendClientMessage(playerid, 0xFFFFFFAA, "exit CP_5 de test");

      }
    }
    return 1;
}
Reply
#7

can you add checkpoint size?
Reply
#8

Here you are:

http://blantas.paste.lt/paste/093419...902253927576bb


I added a size parameter:
Код:
CreateCheckpoint(ownerid, chpid, Float:posX, Float:posY, Float:posZ, Float:size);
Reply
#9

Interesting. Nice release. I'll probably use this.
Reply
#10

Quote:

Here you are:

http://blantas.paste.lt/paste/093419...902253927576bb


I added a size parameter:
Code:

CreateCheckpoint(ownerid, chpid, FloatosX, FloatosY, FloatosZ, Floatize);


Wink

thank you very much
Reply
#11

Good work, but could you explain me how do I make a command only available when player is in marker / checkpoint?
Reply
#12

Quote:

Good work, but could you explain me how do I make a command only available when player is in marker / checkpoint?

if (strcmp(cmdtext, "/command", true)==0)
{
if(IsPlayerInCheckpoint(playerid))
{
//do anything here
return 1;
}

here

https://sampwiki.blast.hk/wiki/IsPlayerInCheckpoint
Reply
#13

in the version with checkpoint size don't be added the checkpoint exit

but here is it

Reply
#14

Quote:
Originally Posted by mr.b
in the version with checkpoint size don't be added the checkpoint exit

but here is it

Are you drunk?
Reply
#15

Quote:
Originally Posted by mr.b
Quote:

Good work, but could you explain me how do I make a command only available when player is in marker / checkpoint?

if (strcmp(cmdtext, "/command", true)==0)
{
if(IsPlayerInCheckpoint(playerid))
{
//do anything here
return 1;
}

here

https://sampwiki.blast.hk/wiki/IsPlayerInCheckpoint
I know that, but if I have many checkpoints, and only available in ONE of them.
Reply
#16

Quote:

Good work, but could you explain me how do I make a command only available when player is in marker / checkpoint?


if (strcmp(cmdtext, "/command", true)==0)
{
if(IsPlayerInCheckpoint(playerid))
{
//do anything here
return 1;
}

here Cheesy

https://sampwiki.blast.hk/wiki/IsPlayerInCheckpoint

I know that, but if I have many checkpoints, and only available in ONE of them.

at the top
Quote:

new cp1;

OnGameModeInit
Quote:

cp1 = CreateCheckpoint(ownerid, chpid, FloatosX, FloatosY, FloatosZ, Floatize);

command
Quote:

if (strcmp(cmdtext, "/command", true)==0)
{
if(IsPlayerInCheckpoint(playerid)==cp1)
{
//do anything here
return 1;
}

Reply
#17

Good !
Reply
#18

Well, thanks anyway
Reply
#19

Is it true I can only create one checkpoint per interior? I tried to create too and the first created only appeared

EDIT: Solved
Reply
#20

Hmm,
look at my code:
Code:
#include <a_samp>
#include <CheckpointManager>
Includes Ofc.
Define:
Code:
#define STORE_ONE 0
OnGamemodeInit:
Code:
	CreateCheckpoint(GLOBAL_OWNER_ID, STORE_ONE, 2214.2620,2526.0508,10.8203);
	StartCheckpointSeeking();
OnPlayerEnterCheckpoint:
Code:
VerifyCheckpoint(playerid);
OnCheckpointEnter..
Code:
public OnCheckpointEnter(playerid, checkpointid){
	switch(checkpointid)
	{
	  case STORE_ONE: //Line 986,This is where the error is!!
	  {
			SetPlayerHealth(playerid,105);
	  }
	}
	return 1;
}
Error:
Code:
C:\Users\Avi\Desktop\Dm server\gamemodes\Dm-S.pwn(986) : error 008: must be a constant expression; assumed zero
Any help?
Thanks in advance
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)