SA-MP Forums Archive
code won't teleport me - 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)
+--- Thread: code won't teleport me (/showthread.php?tid=663918)



code won't teleport me - masterart - 14.02.2019

pawn Код:
if(dialogid == DIALOG_CITYPICK)
          {
              if(!response) return ShowPlayerDialog(playerid, DIALOG_CITYPICK, DIALOG_STYLE_LIST, "Euphoria", "Los Santos\nRed County\nLas Venturas\nSan Fierro", "Pick", "");
              {
                  switch(listitem)
                  {
                      case 0: SetPlayerPos(playerid, 2540.8083,-2115.9592,13.5469);
                      case 1: SetPlayerPos(playerid, -50.3335,-270.9958,6.6332);
                      case 2: SetPlayerPos(playerid, 1428.3453,1049.4246,10.8130);
                      case 3: SetPlayerPos(playerid, -2160.1516,-224.3147,36.0662);
                  }
              }
          }
          return 1;
        }
    }
    return 1;
}
is there anything wrong with this code? cause it won't let me teleport, the dialog just disappears when i select one of these cases in game.

here is my entire OnDialogResponse callback.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Euphoria","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteString(File,"Name",inputtext);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Skin",0);
                INI_WriteInt(File,"Score",0);
                INI_Close(File);
                FirstTimeLoggedIn = 1;
               
             }
        }
        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    SendClientMessage(playerid, -1, "NOTICE: You have successfully logged in.");
                    SendClientMessage(playerid, -1, "SERVER: If you require help please use /help.");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Euphoria","You have entered an incorrect password.\nPlease try again.","Login","Quit");
                }
          }
          if(dialogid == DIALOG_CITYPICK)
          {
              if(!response) return ShowPlayerDialog(playerid, DIALOG_CITYPICK, DIALOG_STYLE_LIST, "Euphoria", "Los Santos\nRed County\nLas Venturas\nSan Fierro", "Pick", "");
              {
                  switch(listitem)
                  {
                      case 0: SetPlayerPos(playerid, 2540.8083,-2115.9592,13.5469);
                      case 1: SetPlayerPos(playerid, -50.3335,-270.9958,6.6332);
                      case 2: SetPlayerPos(playerid, 1428.3453,1049.4246,10.8130);
                      case 3: SetPlayerPos(playerid, -2160.1516,-224.3147,36.0662);
                  }
              }
          }
          return 1;
        }
    }
    return 1;
}



Re: code won't teleport me - Proxus - 14.02.2019

Possibly because you have 'if(dialogid == DIALOG_CITYPICK)' instead of case DIALOG_CITYPICK


Re: code won't teleport me - masterart - 14.02.2019

when i change it to
pawn Код:
case DIALOG_CITYPICK
it gives me this error
pawn Код:
error 014: invalid statement; not in switch



Re: code won't teleport me - Proxus - 14.02.2019

You need to add a colon to the end of that.

Код:
case DIALOG_CITYPICK:



Re: code won't teleport me - masterart - 14.02.2019

tried that too, didn't work.

pawn Код:
C:\Users\Ole\Desktop\New folder (2)\gamemodes\truckingedit.pwn(343) : error 014: invalid statement; not in switch
C:\Users\Ole\Desktop\New folder (2)\gamemodes\truckingedit.pwn(343) : warning 215: expression has no effect



Re: code won't teleport me - EmpireSk - 14.02.2019

Show me it all and I'll do it to you


Re: code won't teleport me - d3Pedro - 14.02.2019

pawn Код:
if(!response) return ShowPlayerDialog(playerid, DIALOG_CITYPICK, DIALOG_STYLE_LIST, "Euphoria", "Los Santos\nRed County\nLas Venturas\nSan Fierro", "Pick", "");
              {
bruh...
pawn Код:
if(dialogid == DIALOG_CITYPICK)
            {
                if(!response) return ShowPlayerDialog(playerid, DIALOG_CITYPICK, DIALOG_STYLE_LIST, "Euphoria", "Los Santos\nRed County\nLas Venturas\nSan Fierro", "Pick", "");
                if(response)
                {
                    switch(listitem)
                    {
                        case 0: SetPlayerPos(playerid, 2540.8083,-2115.9592,13.5469);
                        case 1: SetPlayerPos(playerid, -50.3335,-270.9958,6.6332);
                        case 2: SetPlayerPos(playerid, 1428.3453,1049.4246,10.8130);
                        case 3: SetPlayerPos(playerid, -2160.1516,-224.3147,36.0662);
                    }
                }
            }
Try this


Re: code won't teleport me - masterart - 14.02.2019

ah now i see. forgot to add response.


Re: code won't teleport me - d3Pedro - 14.02.2019

You forgot if(response)
https://sampwiki.blast.hk/wiki/OnDialogResponse


Re: code won't teleport me - masterart - 14.02.2019

thanks buddy