[Tutorial] SetCheckPointEx - 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: Tutorials (
https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] SetCheckPointEx (
/showthread.php?tid=565060)
SetCheckPointEx v1.0 -
qUneT - 24.02.2015
Hey guys, this is my first Tutorial.
Today i will show you my ideea.
SetCheckPointEx.If the player already have a active checkpoint, he need to confirm the change of checkpoint.
I will show You
First, create a global "new" ,under #include <a_samp> etc...
Code:
new bool:HaveACheckPoint[MAX_PLAYERS];
Under
Code:
new bool:HaveACheckPoint[MAX_PLAYERS];
we create this:
Code:
stock SetCheckPointEx(playerid,float:X,Float:Y,Float:Z,Float:size) // create a new stock
{
if(HaveACheckPoint[playerid] == false) // check if the player have a checkpoint
{
SetPlayerCheckpoint(playerid, X, Y, Z,size); // Set The checkpoint
HaveACheckPoint[playerid] = true; //Now player have a checkpoint
}else{
ShowPlayerDialog(playerid, 4942, DIALOG_STYLE_MSGBOX, "Notice", "Are you sure? You wana delete current CheckPoint?", "Yes", "No"); //Put the question
}
Under OnPlayerConnect put this:
Code:
HaveACheckPoint[playerid] = false; // this player is connected now, can't have a checkpoint
And the OnPlayerDialogResponse...
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 4942)
{
if(response) // If they clicked 'Yes' or pressed enter
{
DisablePlayerCheckpoint(playerid);
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
I repet, this is my first tutorial, i hope you like, SORRY FOR BAD ENGLISH
P.S: i don't tested it, but can't have bugs
Re: SetCheckPointEx -
Vince - 24.02.2015
And what's the practical use of this?