Converting Teleports > Menus.
#1

Okay, so i wanted to make the Teleports only useable in Menu... this is what i've got so far.

Top
pawn Код:
new Menu:TPM;
new Menu:TPS;
new Menu:TPL;
OnGameModeInit
pawn Код:
TPM = CreateMenu("Teleports", 2, 50.0, 180.0, 200.0, 200.0);
    AddMenuItem(TPM, 0, "-");
    AddMenuItem(TPM, 1, "Stunts");
    AddMenuItem(TPM, 0, "-");
    AddMenuItem(TPM, 1, "Locations");
    TPS = CreateMenu("Teleports - Stunts", 2, 50.0, 180.0, 200.0, 200.0);
    AddMenuItem(TPS, 0, "Big");
    AddMenuItem(TPS, 1, "Jump");
    AddMenuItem(TPS, 0, "Big");
    AddMenuItem(TPS, 1, "Jump");
    AddMenuItem(TPS, 0, "Amazing");
    AddMenuItem(TPS, 1, "Jump");
    TPL = CreateMenu("Teleports - Locations", 2, 50.0, 180.0, 200.0, 200.0);
    AddMenuItem(TPL, 0, "Mount");
    AddMenuItem(TPL, 1, "Chilliad");
    AddMenuItem(TPL, 0, "Otto's");
    AddMenuItem(TPL, 1, "Carpark");
    AddMenuItem(TPL, 0, "Wang");
    AddMenuItem(TPL, 1, "Cars");
    AddMenuItem(TPL, 0, "Jizzy's");
    AddMenuItem(TPL, 1, "Club");
    AddMenuItem(TPL, 0, "Wheel Arch");
    AddMenuItem(TPL, 1, "Angels");
OnPlayerSelectedMenuRow(playerid, row)...
pawn Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
    new Menu:current;
    current = GetPlayerMenu(playerid);
    if(current == TPM)
    {
    switch(row)
    {
        case 0:
        {
            ShowMenuForPlayer(TPS,playerid);
        }
        case 1:
        {
            ShowMenuForPlayer(TPL,playerid);
        }
    }
    if(current == TPS)
    {
    switch(row)
    {
        case 0:
        {
            SetPlayerPos(playerid,1122.145020, -2576.983398, 313.387695);
        }
        case 1:
        {
            SetPlayerPos(playerid,2682.959961, -2606.618408, 499.154022);
        }
        case 2:
        {
            SetPlayerPos(playerid,-1339.989502, -362.349243, 3505.428711);
        }
    }
    if(current == TPL)
    {
    switch(row)
    {
        case 0:
        {
      SetPlayerPos(playerid,-2379.5391,-1613.2455,497.6486);
        }
        case 1:
        {
          SetPlayerPos(playerid,-1635.6250,1203.2758,7.1797);
        }
        case 2:
        {
      SetPlayerPos(playerid,-1990.4949,289.1101,34.1410);
        }
        case 3:
        {
            SetPlayerPos(playerid,-2623.9255,1409.7347,7.0938);
        }
        case 4:
        {
            SetPlayerPos(playerid,-2694.4810,217.2300,4.1797);
        }
    }
    }
    }
    }
    return 1;
}
Ok so, here is the problem, when i try to do this, the menus pop up fine and such, but the commands does not work.. it doesnt teleport..
Reply
#2

Whats wrong?
Reply
#3

Quote:
Originally Posted by иєσz
Whats wrong?
Sorry updated, lol posted too quick.. :/

Quote:

Ok so, here is the problem, when i try to do this, the menus pop up fine and such, but the commands does not work.. it doesnt teleport..

There we go :P
Reply
#4

Found it.
pawn Код:
if(current == TPM)
{
You putted everyting under that, and you forgot to finish it with }

So actually you have now:

pawn Код:
if(current == TPM)
{
    if(current == TPS)
    {
And if you're in menu ''TPM'' you cannot be in menu ''TPS'' at the same time :P
Reply
#5

Quote:
Originally Posted by Andom
Found it.
pawn Код:
if(current == TPM)
{
You putted everyting under that, and you forgot to finish it with }

So actually you have now:

pawn Код:
if(current == TPM)
{
    if(current == TPS)
    {
And if you're in menu ''TPM'' you cannot be in menu ''TPS'' at the same time :P
aaaa... what?

i dont get it, please enlighten me..
Reply
#6

Quote:
Originally Posted by Mikkel
Quote:
Originally Posted by Andom
Found it.
pawn Код:
if(current == TPM)
{
You putted everyting under that, and you forgot to finish it with }

So actually you have now:

pawn Код:
if(current == TPM)
{
    if(current == TPS)
    {
And if you're in menu ''TPM'' you cannot be in menu ''TPS'' at the same time :P
aaaa... what?
What do you mean with what? you don't understand it?
Reply
#7

Quote:
Originally Posted by Andom
Quote:
Originally Posted by Mikkel
Quote:
Originally Posted by Andom
Found it.
pawn Код:
if(current == TPM)
{
You putted everyting under that, and you forgot to finish it with }

So actually you have now:

pawn Код:
if(current == TPM)
{
    if(current == TPS)
    {
And if you're in menu ''TPM'' you cannot be in menu ''TPS'' at the same time :P
aaaa... what?
What do you mean with what? you don't understand it?
I dont understand what you mean, did i forget a bracket.. wha?
Reply
#8

Yes, you placed the brackets on the wrong place, so the script thought that he was ''on another place''
Here is the new code, that'll works

pawn Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
    new Menu:current;
    current = GetPlayerMenu(playerid);
    if(current == TPM)
    {
        switch(row)
        {
            case 0:
            {
                ShowMenuForPlayer(TPS,playerid);
            }
            case 1:
            {
                ShowMenuForPlayer(TPL,playerid);
            }
        }
    }
    if(current == TPS)
    {
        switch(row)
        {
            case 0:
            {
                SetPlayerPos(playerid,1122.145020, -2576.983398, 313.387695);
            }
            case 1:
            {
                SetPlayerPos(playerid,2682.959961, -2606.618408, 499.154022);
            }
            case 2:
            {
                SetPlayerPos(playerid,-1339.989502, -362.349243, 3505.428711);
            }
        }
    }
    if(current == TPL)
    {
        switch(row)
        {
            case 0:
            {
                SetPlayerPos(playerid,-2379.5391,-1613.2455,497.6486);
            }
            case 1:
            {
                SetPlayerPos(playerid,-1635.6250,1203.2758,7.1797);
            }
            case 2:
            {
                SetPlayerPos(playerid,-1990.4949,289.1101,34.1410);
            }
            case 3:
            {
                SetPlayerPos(playerid,-2623.9255,1409.7347,7.0938);
            }
            case 4:
            {
                SetPlayerPos(playerid,-2694.4810,217.2300,4.1797);
            }
        }
    }
    return 1;
}
Reply
#9

Shit, thanks mate, you just saved me. .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)