Help With Checkpoints Problems.
#1

Hello good people of the samp forum i have a little bit of a question.
I have used the following link to make some teleports :
http://forum.sa-mp.com/index.php?topic=117264.0

But the timer is 500 and now i have tried to add a menu to another checkpoint.
And here is the problem:
When i am in the checkpoint for teleports it works fine but when i go into the one for the menu i see the menu and after the 500 miliseconds i see the menu again and again and again so it is impossible to click something in that time.

I hope you guys have a solution for my problem cause i would just like the menu to stay without a new one comming up everytime.

Here is the script btw :
pawn Код:
#include <a_samp>

#define DIALOGID 1337

stock Float: GetDistanceToPoint(playerid,Float: X2,Float:Y2 ,Float: Z2)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
  return floatsqroot ( floatpower ( floatabs ( floatsub ( X , X2 ) ) , 2 ) + floatpower ( floatabs ( floatsub ( Y , Y2 ) ) , 2 ) + floatpower ( floatabs ( floatsub ( Z , Z2 ) ) , 2 ) );
}

forward CheckpointCheck();

public OnFilterScriptInit()
{
  SetTimer("CheckpointCheck",500,1);
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/wmenu", cmdtext, true, 10) == 0)                            
    {
        ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "Weapon Lists", "Melee\nPistols\nSub-Machine Guns\nRifle's\nAssault\nShotgun's\nHeavy Weapons\nThrown\nMisc", "Select", "Cancel");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOGID)
    {
        if(response)
        {
            if(listitem == 0) // Meele
            {
                ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_LIST, "Select a Weapon", "Knuckle Dusters\nGolf Club\nNite Stick\nKnife\nBat\nShovel\nPool Cue\nKatana\nDildo\nSpray Can\nCane", "Select", "Cancel");
            }
            if(listitem == 1) // Pistols
            {
                ShowPlayerDialog(playerid, DIALOGID+2, DIALOG_STYLE_LIST, "Select a Weapon", "9mm\nSilenced 9mm\nDesert Eagle", "Select", "Cancel");
            }
            if(listitem == 2) // Sub-Machine Guns
            {
                ShowPlayerDialog(playerid, DIALOGID+3, DIALOG_STYLE_LIST, "Select a Weapon", "Uzi\nSMG\nTec9", "Select", "Cancel");
            }
            if(listitem == 3) // Rifles
            {
                ShowPlayerDialog(playerid, DIALOGID+4, DIALOG_STYLE_LIST, "Select a Weapon", "Country Rifle\nSniper Rifle", "Select", "Cancel");
            }
            if(listitem == 4) // Assault
            {
                ShowPlayerDialog(playerid, DIALOGID+5, DIALOG_STYLE_LIST, "Select a Weapon", "AK-47\nM4", "Select", "Cancel");
            }
            if(listitem == 5) // Shotguns
            {
                ShowPlayerDialog(playerid, DIALOGID+6, DIALOG_STYLE_LIST, "Select a Weapon", "Standard Shotgun\nSawnoff Shotgun\nCombat Shotgun", "Select", "Cancel");
            }
            if(listitem == 6) // Heavy Weaponry
            {
                ShowPlayerDialog(playerid, DIALOGID+7, DIALOG_STYLE_LIST, "Select a Weapon", "Rocket Laucher\nHeat Seaker\nMinigun\nChain Saw", "Select", "Cancel");
            }
            if(listitem == 7) // Thrown
            {
                ShowPlayerDialog(playerid, DIALOGID+8, DIALOG_STYLE_LIST, "Select a Weapon", "Granade\nTear Gas", "Select", "Cancel");
            }
      if(listitem == 8) // Misc
            {
                ShowPlayerDialog(playerid, DIALOGID+9, DIALOG_STYLE_LIST, "Select a Weapon", "Fire Extinguisher\nSatchel Charge\nParachute\nNightvision Goggles\nFlowers", "Select", "Cancel");
            }
        }
        return 1;
    }

    if(dialogid == DIALOGID+1) // Meele
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 1, 1);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 2, 1);
            }
            if(listitem == 2)
            {
                GivePlayerWeapon(playerid, 3, 1);
            }
            if(listitem == 3)
            {
                GivePlayerWeapon(playerid, 4, 1);
            }
            if(listitem == 4)
            {
                GivePlayerWeapon(playerid, 5, 1);
            }
            if(listitem == 5)
            {
                GivePlayerWeapon(playerid, 6, 1);
            }
            if(listitem == 6)
            {
                GivePlayerWeapon(playerid, 7, 1);
            }
            if(listitem == 7)
            {
                GivePlayerWeapon(playerid, 8, 1);
            }
            if(listitem == 8)
            {
                GivePlayerWeapon(playerid, 10, 1);
            }
            if(listitem == 9)
            {
                GivePlayerWeapon(playerid, 41, 500);
            }
      if(listitem == 10)
            {
                GivePlayerWeapon(playerid, 15, 1);
            }
        }
        return 1;
    }
   
    if(dialogid == DIALOGID+2) // Pistols
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 22, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 23, 500);
            }
            if(listitem == 2)
            {
                GivePlayerWeapon(playerid, 24, 500);
            }
        }
        return 1;
    }
   
    if(dialogid == DIALOGID+3) // Sub's
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 28, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 29, 500);
            }
            if(listitem == 2)
            {
                GivePlayerWeapon(playerid, 32, 500);
            }
        }
        return 1;
    }
   
    if(dialogid == DIALOGID+4) // Rifle's
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 33, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 34, 500);
            }
        }
        return 1;
    }

    if(dialogid == DIALOGID+5) // Assault
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 30, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 31, 500);
            }
        }
        return 1;
    }
   
    if(dialogid == DIALOGID+6) // Shotguns
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 25, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 26, 500);
            }
            if(listitem == 2)
            {
                GivePlayerWeapon(playerid, 27, 500);
            }
        }
        return 1;
    }
   
    if(dialogid == DIALOGID+7) // Heavy Weapons
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 35, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 36, 500);
            }
            if(listitem == 2)
            {
                GivePlayerWeapon(playerid, 38, 500);
            }
            if(listitem == 3)
            {
                GivePlayerWeapon(playerid, 9, 500);
            }
        }
        return 1;
    }
   
    if(dialogid == DIALOGID+8) // Thrown
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 16, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 17, 500);
            }
        }
        return 1;
    }
   
    if(dialogid == DIALOGID+9) // Misc Fire Extinguisher\nSatchel Charge\nParachute\nNightvision Goggles\nFlowers
    {
        if(response)
        {
            if(listitem == 0)
            {
                GivePlayerWeapon(playerid, 42, 500);
            }
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid, 39, 500);
                GivePlayerWeapon(playerid, 40, 1);
            }
            if(listitem == 2)
            {
                GivePlayerWeapon(playerid, 46, 1);
            }
            if(listitem == 3)
            {
                GivePlayerWeapon(playerid, 44, 1);
            }
            if(listitem == 4)
            {
                GivePlayerWeapon(playerid, 14, 1);
            }
        }
        return 1;
    }
   
    return 0;
 }
 
public OnPlayerEnterCheckpoint(playerid)
{
    if(GetDistanceToPoint(playerid,285.1830,-57.8837,1001.5156)<=10)//the same X,Y,Z coords as the ones you put into the timer || the 2 should be your checkpoint radius
    {
        ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "Weapon Lists", "Melee\nPistols\nSub-Machine Guns\nRifle's\nAssault\nShotgun's\nHeavy Weapons\nThrown\nMisc", "Select", "Cancel");
    }
    if(GetDistanceToPoint(playerid,2159.1250,943.3090,10.8203)<=25)//the same X,Y,Z coords as the ones you put into the timer || the 2 should be your checkpoint radius
    {
      SetPlayerInterior(playerid,4);
        SetPlayerPos(playerid,285.6029,-84.1376,1001.5156);
    }
    if(GetDistanceToPoint(playerid,285.7290,-86.6728,1001.5229)<=5)
    {
      SetPlayerInterior(playerid,0);
      SetPlayerPos(playerid,2159.1729,939.1331,10.8203);
    }
    return 1;
}

public CheckpointCheck()
{
  for(new i; i<MAX_PLAYERS; i++)// a loop that goes though all players
  {
    if(IsPlayerConnected(i))//checks if the player is connected
    {
        if(GetDistanceToPoint(i,285.1830,-57.8837,1001.5156)<=10) //change 10 to what ever you want the "view distance" to be.
        {
          SetPlayerCheckpoint(i,285.1830,-57.8837,1001.5156,3);//Change 2 to what ever radius you want (of the checkpoint)
        }
        else if(GetDistanceToPoint(i,2159.1250,943.3090,10.8203)<=25) //change 10 to what ever you want the "view distance" to be.
        {
          SetPlayerCheckpoint(i,2159.1250,943.3090,10.8203,1);//Change 2 to what ever radius you want (of the checkpoint)
        }
        else if(GetDistanceToPoint(i,285.7290,-86.6728,1001.5229)<=5)
        {
          SetPlayerCheckpoint(i,285.7290,-86.6728,1001.5229,2);
                }
        else
        {
          DisablePlayerCheckpoint(i);
        }
    }
  }
  return 1;
}
I hope to hear from someone soon.

/Artix
Reply
#2

Try using pastebin in the future for such a large piece of code.

The problem is probally that the checkpoint gets reset/remade after 500 ms.
Try adding global vars for each checkpoint and do an if statement:

http://ampaste.net/m5d38be09

That should do the job (I think)

Good Luck!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)