SA-MP Forums Archive
Missing brackets help (creating a teleport menu) - 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: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Missing brackets help (creating a teleport menu) (/showthread.php?tid=136708)



Missing brackets help (creating a teleport menu) - Andy_McKinley - 26.03.2010

I need help, I can't find it, where do I need to put the brackets (26 errors)?

pawn Code:
public OnPlayerSelectedMenuRow(playerid, row);

if(CurrentMenu == teleportmenu)
{
  switch(row)
  {
    case 0: //Desert Eagle
    {
            SetPlayerHealth(playerid, 100.0);
            SetPlayerArmour(playerid, 0.0);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 24, 1000);
            SendClientMessage(playerid, COLOR_YELLOW, "Teleported to Desert Eagle Deathmatch zone. Survive and kill your enemy's with your last weapon left, Desert Eagle.");
            SetPlayerPos(playerid,-2672.5190,1410.3302,907.5703);
            SetPlayerInterior(playerid, 3);
            return 1;
    }
    case 1: //Explosion Deathmatch
    {
            SetPlayerHealth(playerid, 100.0);
            SetPlayerArmour(playerid, 0.0);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 22, 1000);
            GivePlayerWeapon(playerid, 26, 1000);
            GivePlayerWeapon(playerid, 32, 1000);
            GivePlayerWeapon(playerid, 37, 10000);
            SendClientMessage(playerid, COLOR_YELLOW, "Teleported to Explosion Deathmatch. Try to survive and kill your enemy's!");
            SetPlayerPos(playerid,2038.2716,-1995.2430,35.0158);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            return 1;
    }
    case 2: //Baseball
    {
        SetPlayerHealth(playerid, 2.0);
            SetPlayerArmour(playerid, 0.0);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 5, 1);
            SendClientMessage(playerid, COLOR_YELLOW, "Teleported to the Baseball Field. Kill your enemy's with your Baseball Bat!");
            SetPlayerPos(playerid, 1384.0188,2185.7866,11.0234);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            return 1;
    }
    case 3: //Basejump
    {
            SetPlayerHealth(playerid, 100.0);
            SetPlayerArmour(playerid, 100.0);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 16, 200);
            SendClientMessage(playerid, COLOR_YELLOW, "Teleport to the roof top. Blast enemy's off the building with your Grenades!");
            SetPlayerPos(playerid, -1818.1145,548.4082,234.8874);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            return 1;
    }
    case 4: //War Deathmatch
    {
            SetPlayerHealth(playerid, 100.0);
            SetPlayerArmour(playerid, 100.0);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 16, 2500);
            GivePlayerWeapon(playerid, 35, 2500);
            SendClientMessage(playerid, COLOR_YELLOW, "Teleported to War Deathmatch. Kill your enemy's and try to survive!");
            SetPlayerPos(playerid, -1399.1252441406,1037.9338378906,1028.7286376953);
            SetPlayerInterior(playerid, 15);
            return 1;
    }
  }
}



Re: Missing brackets help (creating a teleport menu) - Rac3r - 26.03.2010

Code:
public OnPlayerSelectedMenuRow(playerid, row)
{
  if(CurrentMenu == teleportmenu)
  {
  }
  return 0;
}



Re: Missing brackets help (creating a teleport menu) - Flake. - 26.03.2010

Quote:
Originally Posted by Rac3r
Code:
public OnPlayerSelectedMenuRow(playerid, row)
{
  if(CurrentMenu == teleportmenu)
  {
  }
  return 0;
}
was just typing this u beat me xD


Re: Missing brackets help (creating a teleport menu) - Andy_McKinley - 26.03.2010

Quote:
Originally Posted by $Fl@Ke$
Quote:
Originally Posted by Rac3r
Code:
public OnPlayerSelectedMenuRow(playerid, row)
{
  if(CurrentMenu == teleportmenu)
  {
  }
  return 0;
}
was just typing this u beat me xD
Still giving me 26 errors (missing brackets).

pawn Code:
public OnPlayerSelectedMenuRow(playerid, row)
{
  if(CurrentMenu == teleportmenu)
  {
  }
  return 0;
}
  switch(row)
  {
    case 0: //Desert Eagle
    {
            SetPlayerHealth(playerid, 100.0);
            SetPlayerArmour(playerid, 0.0);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 24, 1000);
            SendClientMessage(playerid, COLOR_YELLOW, "Teleported to Desert Eagle Deathmatch zone. Survive and kill your enemy's with your last weapon left, Desert Eagle.");
            SetPlayerPos(playerid,-2672.5190,1410.3302,907.5703);
            SetPlayerInterior(playerid, 3);
            return 1;
    }
    case 1: //Explosion Deathmatch
    {
            SetPlayerHealth(playerid, 100.0);
            SetPlayerArmour(playerid, 0.0);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 22, 1000);
            GivePlayerWeapon(playerid, 26, 1000);
            GivePlayerWeapon(playerid, 32, 1000);
            GivePlayerWeapon(playerid, 37, 10000);
            SendClientMessage(playerid, COLOR_YELLOW, "Teleported to Explosion Deathmatch. Try to survive and kill your enemy's!");
            SetPlayerPos(playerid,2038.2716,-1995.2430,35.0158);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            return 1;
    }
    case 2: //Baseball
    {
        SetPlayerHealth(playerid, 2.0);
            SetPlayerArmour(playerid, 0.0);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 5, 1);
            SendClientMessage(playerid, COLOR_YELLOW, "Teleported to the Baseball Field. Kill your enemy's with your Baseball Bat!");
            SetPlayerPos(playerid, 1384.0188,2185.7866,11.0234);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            return 1;
    }
    case 3: //Basejump
    {
            SetPlayerHealth(playerid, 100.0);
            SetPlayerArmour(playerid, 100.0);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 16, 200);
            SendClientMessage(playerid, COLOR_YELLOW, "Teleport to the roof top. Blast enemy's off the building with your Grenades!");
            SetPlayerPos(playerid, -1818.1145,548.4082,234.8874);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            return 1;
    }
    case 4: //War Deathmatch
    {
            SetPlayerHealth(playerid, 100.0);
            SetPlayerArmour(playerid, 100.0);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 16, 2500);
            GivePlayerWeapon(playerid, 35, 2500);
            SendClientMessage(playerid, COLOR_YELLOW, "Teleported to War Deathmatch. Kill your enemy's and try to survive!");
            SetPlayerPos(playerid, -1399.1252441406,1037.9338378906,1028.7286376953);
            SetPlayerInterior(playerid, 15);
            return 1;
    }
  }
}



Re: Missing brackets help (creating a teleport menu) - Correlli - 26.03.2010

Because that code is not in the callback (OnPlayerSelectedMenuRow).


Re: Missing brackets help (creating a teleport menu) - Andy_McKinley - 26.03.2010

Quote:
Originally Posted by Don Correlli
Because that code is not in the callback (OnPlayerSelectedMenuRow).
So?


Re: Missing brackets help (creating a teleport menu) - Correlli - 26.03.2010

So learn how to script correctly. You can't have some code out of the callback/function, and amount of closing brackets needs to be equal to the amount of opening brackets.


Re: Missing brackets help (creating a teleport menu) - Andy_McKinley - 26.03.2010

Quote:
Originally Posted by Don Correlli
So learn how to script correctly. You can't have some code out of the callback/function, and amount of closing brackets needs to be equal to the amount of opening brackets.
I'm only asking where to put the brackets. This place is to help and not say: Learn to script or whatever, I can script.


Re: Missing brackets help (creating a teleport menu) - Correlli - 26.03.2010

Quote:
Originally Posted by DarkPhoenix
I'm only asking where to put the brackets. This place is to help and not say: Learn to script or whatever, I can script.
You already have the answer. And I didn't said "learn to script", I said "learn to script correctly".


Re: Missing brackets help (creating a teleport menu) - Rac3r - 26.03.2010

Yep, Don is right. What I posted was just an indication to where you went wrong, just a shame you couldn't comprehend what I meant.

We all start like that. We're trying to help, but sometimes a quick fix isn't enough. Learn coding correctly, how to handle brackets is the main pointer.

pawn Code:
public OnPlayerSelectedMenuRow(playerid, row)
{
  if(CurrentMenu == teleportmenu)
  {
    switch(row)
    {
      case 0: //Desert Eagle
      {
        // code
      }
      case 1: //Explosion Deathmatch
      {
        //code
      }
      //other cases
    }
  }
  if(CurrentMenu == othermenuHmm)
  {
  }
  return 0;
}