SA-MP Forums Archive
[Include] Simple Checkpoint Streamer - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [Include] Simple Checkpoint Streamer (/showthread.php?tid=70963)

Pages: 1 2


[Include] Simple Checkpoint Streamer - -zriptarusk - 29.03.2009

[3Play : Checkpoint Streamer Library]
Include File Features:
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


Re: [Include] Simple Checkpoint Manager - Oxside - 03.04.2009

REALLY NICE
But the post looks some gaotic!


Re: [Include] Simple Checkpoint Manager - T RP [Tomorrows-RP.co.uk] - 03.04.2009

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


Re: [Include] Simple Checkpoint Manager - -zriptarusk - 03.04.2009

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


Re: [Include] Simple Checkpoint Manager - MazaHACKa - 09.04.2009

VERY VERY COOL!!!!!
THANKS!


Re: [Include] Simple Checkpoint Streamer - cristab - 14.06.2009

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



Re: [Include] Simple Checkpoint Streamer - mr.b - 10.09.2009

can you add checkpoint size?


Re: [Include] Simple Checkpoint Streamer - Blantas - 10.09.2009

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



Re: [Include] Simple Checkpoint Streamer - Calgon - 10.09.2009

Interesting. Nice release. I'll probably use this.


Re: [Include] Simple Checkpoint Streamer - mr.b - 10.09.2009

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


Re: [Include] Simple Checkpoint Streamer - Jakku - 12.09.2009

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


Re: [Include] Simple Checkpoint Streamer - mr.b - 13.09.2009

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


Re: [Include] Simple Checkpoint Streamer - mr.b - 13.09.2009

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

but here is it




Re: [Include] Simple Checkpoint Streamer - Blantas - 13.09.2009

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?


Re: [Include] Simple Checkpoint Streamer - Jakku - 13.09.2009

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.


Re: [Include] Simple Checkpoint Streamer - mr.b - 13.09.2009

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




Re: [Include] Simple Checkpoint Streamer - mihais17 - 13.09.2009

Good !


Re: [Include] Simple Checkpoint Streamer - Jakku - 13.09.2009

Well, thanks anyway


Re: [Include] Simple Checkpoint Streamer - Jakku - 14.09.2009

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

EDIT: Solved


Re: [Include] Simple Checkpoint Streamer - [XST]O_x - 21.09.2009

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