[Include] Checkpoint Management
#1

Checkpoint Management (v2)
Manage checkpoints with ease!
Good Morning all,
I'd like to present you with "Checkpoint Management".
The Brief
It allows you to manage your checkpoints accordingly with their position, size, whether a player is in someone else's checkpoint, and allows you to make a player checkpoint the same as someone else's. I made it after reading this thread. And thought it would be good to make it. However, i'm not sure it would be good for much else!

The Functions
Okay, so there's eight functions, all using the same data, as otherwise they could just be any old function. Anyway, here i will explain what they are and do.

pawn Код:
SetPlayerCheckpoint(playerid, Float:x, Float:y, Float:z, Float:size)
/*
     Returns 1, always.
     The original function, documented on the SAMP Wiki, stated that the original returned no specific value.
*/
This function is pretty obvious, create the player checkpoint. It's usage is the same as the original function, however the return values have changed. This function creates 5 PVars, 3 for the x, y, z co-ordinates, 1 for the size, and one to tell the script/functions that feed off the data, that the checkpoint has been created.

pawn Код:
DisablePlayerCheckpoint(playerid)
/*
     Returns 1, always.
     The original document information, states that the original function did not return any specific value.
*/
This function simply disables the players checkpoint, it also removes the PVars that are created when making a checkpoint, and turns the initiation variable to 0 (off, checkpoint doesn't exist)

pawn Код:
GetPlayerCheckpointPos(playerid, &Float:__x, &Float:__y, &Float:__z)
/*
     Returns
     0 if the players checkpoint is disabled / non-existant.
     1 otherwise.

     This is a new function.
*/
This function, allows you to get a players checkpoint co-ordinates. It works in the same way as GetPlayerPos, with 3 variables needing to be created for the data to get put in them. This function will only work if the checkpoint is active (otherwise it will return 0).

pawn Код:
GetPlayerCheckpointSize(playerid, &Float:__size)
/*
     Returns
     0 if the players checkpoint is disabled / non-existant.
     1 otherwise

     This is a new function.
*/
This function, returns the size of the checkpoint. I'm not too sure what this could be used for unless you wanted to use it to get a decent radius for the function following this.

pawn Код:
IsPlayerInRangeOfCheckpoint(playerid, Float:range)
/*
     Returns
     -1 if the players checkpoint does not exist
     0 if they are not in range of their checkpoint
     1 if they are in range of their checkpoint

     This is a new function
*/
This function is alot like IsPlayerInRangeOfPoint, however only needs to arguments. It simply runs a check to see if a player is in range of they checkpoint, but checks it on a range you give it.

pawn Код:
IsPlayerInOthersCheckpoint(playerid, playerid2)
/*
     Returns
     -1 if playerid2's checkpoint does not exist
     1 if playerid is in playerid2's checkpoint
     0 if they are not

     This is a new function
*/
This function is pretty simple, it just checks to see if playerid, is in playerid2's checkpoint. I'm not too sure what this could be used for, but i thought i'd add it in anyway, i'm sure someone will find a use.

pawn Код:
SetPlayerCPAsPlayerCP(playerid, setplayerid)
/*
     Returns
     0 if playerid's checkpoint does not exist
     1 otherwise.    

     This is a new function
*/
This function simply puts setplayerid's checkpoint in the same place, with the same size, as playerid's checkpoint. Again i'm not too sure what this could be used for, but i'm sure it'll be useful for someone.

pawn Код:
CreateCheckpointHere(playerid, Float:size)
/*
     Returns
     1, always.

     This is a new function
*/
All this function does, is creates the checkpoint where the player is standing, again i'm not sure what this could be used for, and i'm not sure if a use will be found for it. But it could have a use, i suppose. (Note: If a player is already stood in the checkpoint when it is created, OnPlayerEnterCheckpoint will not be called)

pawn Код:
Float:GetDistanceToPlayerCheckpoint(playerid)
/*
     Returns:
     -1 if the checkpoint is inactive.
     otherwise, the distance to the checkpoint.
*/
This function returns the distance to the checkpoint from their current position. It will return -1(.0) if the checkpoint is not enabled.

The Download Link
http://pastebin.com/iKhkhE2k
You can download the include from the download link above. (This is the updated version).
The old version: http://solidfiles.com/d/fff55/

Installation
It's simple, to begin using it just put CP.inc (or whatever you called it) in your include directory (folder), and include CP at the top of your script (but BELOW a_samp), like so:
pawn Код:
#include <a_samp>
#include <cp>
Please please please ensure that you have the CP.inc file in the include folder of your "PAWN Directory".

Bugs?
If you find a bug, which is highly unlikely due to this includes simplicity, post it in this thread! I'll keep checking! When i have my website set up, i will setting up a bug report section, for both my server and anything i release here - and so you will be able to post any bugs about any scripts there too soon.

Closing Message
Well, after my failure when i began to right this topic (as in, pressing post instead of preview) i think my typing skills are finally paying off. If i couldn't type as fast as i can, you'd be waiting in suspense for a lot longer than this. As i said many times above, i still have no clue what this could be used for, or if it's useful at all.
Also, i'm sorry if there are any errors in this post at all, I've been typing rather quickly in order to get this post out to you, as my failure before was rather embarrassing, shall we say?

Thank You to whichever moderator / beta tester / administrator who deleted my first post, it was most appreciated

I will consider updating this script with some more functions, as i have just thought of a few.

Oh, and a quick NOTE: (Big note) - This include will not work with a checkpoint streamer, all it will do is create the checkpoint using the native system UNLESS you are using a checkpoint streamer with the same function name. In which case it may still not work due to the fact it has not been setup for use with a streamer. If you would like me to ATTEMPT to make it work with a streamer, tell me, and tell me which streamer too.

Enjoy!
Thanks, Ash.
(Also, i think that was my longest ever post!)
Reply


Messages In This Thread
Checkpoint Management - by Ash. - 27.04.2011, 09:44
Re: Checkpoint Management - by Ash. - 27.04.2011, 10:07
Re: Checkpoint Management - by anantanni - 24.05.2011, 16:05
Re: Checkpoint Management - by Meinstad - 24.05.2011, 16:09
Re: Checkpoint Management - by [KSF]WARLOCK - 24.05.2011, 16:51
Re: Checkpoint Management - by Ash. - 25.05.2011, 17:30
Re: Checkpoint Management - by Ash. - 25.05.2011, 17:54
Re: Checkpoint Management - by Ash. - 25.05.2011, 18:25
Re: Checkpoint Management - by [KSF]WARLOCK - 26.05.2011, 09:42
Re: Checkpoint Management - by ylleron - 26.05.2011, 09:44
Re: Checkpoint Management - by [KSF]WARLOCK - 26.05.2011, 09:46
Re: Checkpoint Management - by Ash. - 27.05.2011, 06:07
Re: Checkpoint Management - by Ash. - 27.05.2011, 06:16
Re: Checkpoint Management - by cs_master - 27.05.2011, 17:11
Re: Checkpoint Management - by Ash. - 27.05.2011, 21:22
Re: Checkpoint Management - by Iphone1234g - 15.06.2011, 09:15
Re: Checkpoint Management - by Ash. - 24.12.2011, 18:05
Re: Checkpoint Management - by Rizard - 17.02.2012, 16:31
Re: Checkpoint Management - by Dude_Lebowski - 15.03.2012, 14:15
Re: Checkpoint Management - by Ash. - 10.04.2012, 23:40
Re: Checkpoint Management - by xMaGmOtAnEtHx - 16.09.2012, 04:11

Forum Jump:


Users browsing this thread: 2 Guest(s)