code won't teleport me
#1

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;
}
Reply
#2

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

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

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

Код:
case DIALOG_CITYPICK:
Reply
#5

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
Reply
#6

Show me it all and I'll do it to you
Reply
#7

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
Reply
#8

ah now i see. forgot to add response.
Reply
#9

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

thanks buddy
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)