[Tutorial] SetCheckPointEx
#1

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
Reply


Messages In This Thread
SetCheckPointEx v1.0 - by qUneT - 24.02.2015, 20:15
Re: SetCheckPointEx - by Vince - 24.02.2015, 21:32

Forum Jump:


Users browsing this thread: 1 Guest(s)