invalid function or declaration
#1

pawn Код:
if(dialogid == 3){
      if(response){
         switch(listitem)){
         case 0:
         {
            SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
            SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
            SetPlayerInterior(playerid,0);
         }
         case 1:
         {
            SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
            SetPlayerInterior(playerid,0);
         }
         case 2:
         {
            SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
            SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
            SetPlayerInterior(playerid,0);
         }
         case 3:
         {
            SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
            SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
            SetPlayerInterior(playerid,0);
      }
      else{
         //The player has pressed "Ok".
         switch(listitem{
         case 0:
         {
            SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
            SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
            SetPlayerInterior(playerid,0);
         }
         case 1:
         {
            SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
            SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
            SetPlayerInterior(playerid,0);
         }
         case 2:
         {
            SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
            SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
            SetPlayerInterior(playerid,0);
         }
         case 3:
         {
            SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
            SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
            SetPlayerInterior(playerid,0);
       }
     }
  }
    return 0;
}
Код:
/.../cmds.pwn(914) : error 010: invalid function or declaration
/.../cmds.pwn(915) : error 010: invalid function or declaration
/.../cmds.pwn(916) : error 010: invalid function or declaration
/.../cmds.pwn(917) : error 010: invalid function or declaration
/.../cmds.pwn(923) : error 010: invalid function or declaration
/.../cmds.pwn(928) : error 010: invalid function or declaration
/.../cmds.pwn(934) : error 010: invalid function or declaration
/.../cmds.pwn(940) : error 010: invalid function or declaration
/.../cmds.pwn(942) : error 010: invalid function or declaration
/.../cmds.pwn(943) : error 010: invalid function or declaration
/.../cmds.pwn(949) : error 010: invalid function or declaration
/.../cmds.pwn(955) : error 010: invalid function or declaration
/.../cmds.pwn(961) : error 010: invalid function or declaration
/.../cmds.pwn(969) : error 010: invalid function or declaration
Reply
#2

pawn Код:
if(dialogid == 3)
{
    if(response)
    {
        switch(listitem) /* .. Removed bracket here .. */
        {
            case 0:
            {
                SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
                SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                SetPlayerInterior(playerid,0);
            }
            case 1:
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                SetPlayerInterior(playerid,0);
            }
            case 2:
            {
                SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
                SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                SetPlayerInterior(playerid,0);
            }
            case 3:
            {
                SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
                SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                SetPlayerInterior(playerid,0);
            }
        }
        else
        {
            //The player has pressed "Ok".
            switch(listitem) /* .. Was missing a bracket here .. */
            {
                case 0:
                {
                    SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
                    SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                    SetPlayerInterior(playerid,0);
                }
                case 1:
                {
                    SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
                    SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                    SetPlayerInterior(playerid,0);
                }
                case 2:
                {
                    SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
                    SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                    SetPlayerInterior(playerid,0);
                }
                case 3:
                {
                    SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
                    SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                    SetPlayerInterior(playerid,0);
                }
            } /* .. No closing brace was here .. */
        }
    }
    return 0;
}
?
Reply
#3

same errors :S
Reply
#4

For some reason you were trying to use an else on a switch statement. Try this:

pawn Код:
if(dialogid == 3)
    {
        if(response)
        {
            switch(listitem) /* .. Removed bracket here .. */
            {
                case 0:
                {
                    SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
                    SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                    SetPlayerInterior(playerid,0);
                }
                case 1:
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                    SetPlayerInterior(playerid,0);
                }
                case 2:
                {
                    SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
                    SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                    SetPlayerInterior(playerid,0);
                }
                case 3:
                {
                    SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
                    SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                    SetPlayerInterior(playerid,0);
                }
            }
        }
        else
        {
            //The player has pressed "Ok".
            switch(listitem) /* .. Was missing a bracket here .. */
            {
                case 0:
                {
                    SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
                    SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                    SetPlayerInterior(playerid,0);
                }
                case 1:
                {
                    SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
                    SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                    SetPlayerInterior(playerid,0);
                }
                case 2:
                {
                    SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
                    SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                    SetPlayerInterior(playerid,0);
                }
                case 3:
                {
                    SetPlayerPos(playerid, 1529.6,-1691.2,13.3);
                    SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                    SetPlayerInterior(playerid,0);
                }
            } /* .. No closing brace was here .. */
        }
    }
    return 0;
}
Should work fine. At least, it compiles fine with no errors for me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)