SA-MP Forums Archive
Rescue Errors - 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: Rescue Errors (/showthread.php?tid=490177)



Rescue Errors - DerickClark - 25.01.2014

am getting errors from here
pawn Код:
4793) : error 017: undefined symbol "listitem"
(4808) : error 017: undefined symbol "listitem"
(4813) : error 002: only a single statement (or expression) can follow each "case"
(4813) : warning 215: expression has no effect
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase
3 Errors.

pawn Код:
CMD:rescuetest(playerid, params[])
{
    switch (APlayerData[playerid][PlayerClass])
    {
        case TEAM_TRUCKER:
        {
            // Set the spawn coordinates based on the selection in the list
            switch (listitem)
            {
                case 0: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -525.0, -502.0, 26.0, 0.0, 0, 0, 0, 0, 0, 0);
                case 1: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -74.7, -1137.5, 4.5, 0.0, 0, 0, 0, 0, 0, 0);
                case 2: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 1457.0, 975.5, 11.0, 0.0, 0, 0, 0, 0, 0, 0);
                case 3: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -2136.0, -247.5, 36.5, 270.0, 0, 0, 0, 0, 0, 0);
                case 4: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 1766.5, -2040.7, 14.0, 270.0, 0, 0, 0, 0, 0, 0);
                case 5: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -546.0, 2594.0, 54.0, 270.0, 0, 0, 0, 0, 0, 0);
                case 6: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 332.0, 900.0, 25.0, 205.0, 0, 0, 0, 0, 0, 0);
                case 7: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -1575.0, -2724.0, 49.0, 146.0, 0, 0, 0, 0, 0, 0);
            }
    }
    case TEAM_BUSDRIVER:
    {
            // Set the spawn coordinates based on the selection in the list
            switch (listitem)
            {
                case 0: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 2863.9058,-2010.4265,11.1016,93.4327,0,0,0,0,0,0);
            }
    }
    SpawnPlayer(playerid); // Force the player to spawn at the requested coordinates
    SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerRescued); // Send the player a message that using "/rescue" costs $100
    SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerRescued2); // Send the player a message that using "/rescue" costs $100
    // Reduce the player's money by 100
    RewardPlayer(playerid, -100, 0);
    return 1;
}



Re: Rescue Errors - Jacapo - 25.01.2014

You are using dialog function in command. So listitem is undefined symbol in this situation.


Re: Rescue Errors - TahaAsif12 - 25.01.2014

listitem is only defined for OnDialogResponse function


Re: Rescue Errors - DerickClark - 25.01.2014

pawn Код:
(4814) : error 002: only a single statement (or expression) can follow each "case"
(4814) : warning 215: expression has no effect
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

pawn Код:
CMD:rescuetest(playerid, params[])
{
    new switchVar = 10;
    switch (APlayerData[playerid][PlayerClass])
    {
        case TEAM_TRUCKER:
        {
            // Set the spawn coordinates based on the selection in the list
            switch (switchVar)
            {
                case 0: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -525.0, -502.0, 26.0, 0.0, 0, 0, 0, 0, 0, 0);
                case 1: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -74.7, -1137.5, 4.5, 0.0, 0, 0, 0, 0, 0, 0);
                case 2: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 1457.0, 975.5, 11.0, 0.0, 0, 0, 0, 0, 0, 0);
                case 3: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -2136.0, -247.5, 36.5, 270.0, 0, 0, 0, 0, 0, 0);
                case 4: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 1766.5, -2040.7, 14.0, 270.0, 0, 0, 0, 0, 0, 0);
                case 5: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -546.0, 2594.0, 54.0, 270.0, 0, 0, 0, 0, 0, 0);
                case 6: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 332.0, 900.0, 25.0, 205.0, 0, 0, 0, 0, 0, 0);
                case 7: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -1575.0, -2724.0, 49.0, 146.0, 0, 0, 0, 0, 0, 0);
            }
    }
    case TEAM_BUSDRIVER:
    {
            // Set the spawn coordinates based on the selection in the list
            switch (switchVar)
            {
                case 0: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 2863.9058,-2010.4265,11.1016,93.4327,0,0,0,0,0,0);
            }
    }
    SpawnPlayer(playerid); // Force the player to spawn at the requested coordinates
    SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerRescued); // Send the player a message that using "/rescue" costs $100
    SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerRescued2); // Send the player a message that using "/rescue" costs $100
    // Reduce the player's money by 100
    RewardPlayer(playerid, -100, 0);
    return 1;
}



Re: Rescue Errors - Jacapo - 25.01.2014

pawn Код:
CMD:rescuetest(playerid, params[])
{
    new switchVar = 10;
    switch (APlayerData[playerid][PlayerClass])
    {
        case TEAM_TRUCKER:
        {
            // Set the spawn coordinates based on the selection in the list
            switch (switchVar)
            {
                case 0: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -525.0, -502.0, 26.0, 0.0, 0, 0, 0, 0, 0, 0);
                case 1: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -74.7, -1137.5, 4.5, 0.0, 0, 0, 0, 0, 0, 0);
                case 2: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 1457.0, 975.5, 11.0, 0.0, 0, 0, 0, 0, 0, 0);
                case 3: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -2136.0, -247.5, 36.5, 270.0, 0, 0, 0, 0, 0, 0);
                case 4: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 1766.5, -2040.7, 14.0, 270.0, 0, 0, 0, 0, 0, 0);
                case 5: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -546.0, 2594.0, 54.0, 270.0, 0, 0, 0, 0, 0, 0);
                case 6: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 332.0, 900.0, 25.0, 205.0, 0, 0, 0, 0, 0, 0);
                case 7: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -1575.0, -2724.0, 49.0, 146.0, 0, 0, 0, 0, 0, 0);
            }
        }
        case TEAM_BUSDRIVER:
        {
            // Set the spawn coordinates based on the selection in the list
            switch (switchVar)
            {
                case 0: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 2863.9058,-2010.4265,11.1016,93.4327,0,0,0,0,0,0);
            }
        }
        SpawnPlayer(playerid); // Force the player to spawn at the requested coordinates
        SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerRescued); // Send the player a message that using "/rescue" costs $100
        SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerRescued2); // Send the player a message that using "/rescue" costs $100
        // Reduce the player's money by 100
        RewardPlayer(playerid, -100, 0);
    }
    return 1;
}
Try this..


Re: Rescue Errors - DerickClark - 25.01.2014

Quote:
Originally Posted by Jacapo
Посмотреть сообщение
pawn Код:
CMD:rescuetest(playerid, params[])
{
    new switchVar = 10;
    switch (APlayerData[playerid][PlayerClass])
    {
        case TEAM_TRUCKER:
        {
            // Set the spawn coordinates based on the selection in the list
            switch (switchVar)
            {
                case 0: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -525.0, -502.0, 26.0, 0.0, 0, 0, 0, 0, 0, 0);
                case 1: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -74.7, -1137.5, 4.5, 0.0, 0, 0, 0, 0, 0, 0);
                case 2: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 1457.0, 975.5, 11.0, 0.0, 0, 0, 0, 0, 0, 0);
                case 3: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -2136.0, -247.5, 36.5, 270.0, 0, 0, 0, 0, 0, 0);
                case 4: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 1766.5, -2040.7, 14.0, 270.0, 0, 0, 0, 0, 0, 0);
                case 5: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -546.0, 2594.0, 54.0, 270.0, 0, 0, 0, 0, 0, 0);
                case 6: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 332.0, 900.0, 25.0, 205.0, 0, 0, 0, 0, 0, 0);
                case 7: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -1575.0, -2724.0, 49.0, 146.0, 0, 0, 0, 0, 0, 0);
            }
        }
        case TEAM_BUSDRIVER:
        {
            // Set the spawn coordinates based on the selection in the list
            switch (switchVar)
            {
                case 0: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 2863.9058,-2010.4265,11.1016,93.4327,0,0,0,0,0,0);
            }
        }
        SpawnPlayer(playerid); // Force the player to spawn at the requested coordinates
        SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerRescued); // Send the player a message that using "/rescue" costs $100
        SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerRescued2); // Send the player a message that using "/rescue" costs $100
        // Reduce the player's money by 100
        RewardPlayer(playerid, -100, 0);
    }
    return 1;
}
Try this..
Код:
(4814) : error 002: only a single statement (or expression) can follow each "case"
(4814) : warning 215: expression has no effect
(4820) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.



Re: Rescue Errors - Jacapo - 25.01.2014

pawn Код:
CMD:rescuetest(playerid, params[])
{
    new switchVar = 8;
    new switchVar2 = 2;
    switch (APlayerData[playerid][PlayerClass])
    {
        case TEAM_TRUCKER:
        {
            // Set the spawn coordinates based on the selection in the list
            switch (switchVar)
            {
                case 0: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -525.0, -502.0, 26.0, 0.0, 0, 0, 0, 0, 0, 0);
                case 1: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -74.7, -1137.5, 4.5, 0.0, 0, 0, 0, 0, 0, 0);
                case 2: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 1457.0, 975.5, 11.0, 0.0, 0, 0, 0, 0, 0, 0);
                case 3: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -2136.0, -247.5, 36.5, 270.0, 0, 0, 0, 0, 0, 0);
                case 4: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 1766.5, -2040.7, 14.0, 270.0, 0, 0, 0, 0, 0, 0);
                case 5: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -546.0, 2594.0, 54.0, 270.0, 0, 0, 0, 0, 0, 0);
                case 6: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 332.0, 900.0, 25.0, 205.0, 0, 0, 0, 0, 0, 0);
                case 7: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -1575.0, -2724.0, 49.0, 146.0, 0, 0, 0, 0, 0, 0);
            }
        }
        case TEAM_BUSDRIVER:
        {
            // Set the spawn coordinates based on the selection in the list
            switch (switchVar2)
            {
                case 0: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 2863.9058,-2010.4265,11.1016,93.4327,0,0,0,0,0,0);
            }
        }
        SpawnPlayer(playerid); // Force the player to spawn at the requested coordinates
        SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerRescued); // Send the player a message that using "/rescue" costs $100
        SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerRescued2); // Send the player a message that using "/rescue" costs $100
        // Reduce the player's money by 100
        RewardPlayer(playerid, -100, 0);
    }
    return 1;
}
Maybe try this. (I really dont know why it dont work with your code..i tested it and works fine for me..)


Re: Rescue Errors - DerickClark - 25.01.2014

Quote:
Originally Posted by Jacapo
Посмотреть сообщение
pawn Код:
CMD:rescuetest(playerid, params[])
{
    new switchVar = 8;
    new switchVar2 = 2;
    switch (APlayerData[playerid][PlayerClass])
    {
        case TEAM_TRUCKER:
        {
            // Set the spawn coordinates based on the selection in the list
            switch (switchVar)
            {
                case 0: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -525.0, -502.0, 26.0, 0.0, 0, 0, 0, 0, 0, 0);
                case 1: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -74.7, -1137.5, 4.5, 0.0, 0, 0, 0, 0, 0, 0);
                case 2: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 1457.0, 975.5, 11.0, 0.0, 0, 0, 0, 0, 0, 0);
                case 3: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -2136.0, -247.5, 36.5, 270.0, 0, 0, 0, 0, 0, 0);
                case 4: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 1766.5, -2040.7, 14.0, 270.0, 0, 0, 0, 0, 0, 0);
                case 5: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -546.0, 2594.0, 54.0, 270.0, 0, 0, 0, 0, 0, 0);
                case 6: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 332.0, 900.0, 25.0, 205.0, 0, 0, 0, 0, 0, 0);
                case 7: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), -1575.0, -2724.0, 49.0, 146.0, 0, 0, 0, 0, 0, 0);
            }
        }
        case TEAM_BUSDRIVER:
        {
            // Set the spawn coordinates based on the selection in the list
            switch (switchVar2)
            {
                case 0: SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 2863.9058,-2010.4265,11.1016,93.4327,0,0,0,0,0,0);
            }
        }
        SpawnPlayer(playerid); // Force the player to spawn at the requested coordinates
        SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerRescued); // Send the player a message that using "/rescue" costs $100
        SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerRescued2); // Send the player a message that using "/rescue" costs $100
        // Reduce the player's money by 100
        RewardPlayer(playerid, -100, 0);
    }
    return 1;
}
Maybe try this. (I really dont know why it dont work with your code..i tested it and works fine for me..)
Still give me errors

pawn Код:
(4815) : error 002: only a single statement (or expression) can follow each "case"
(4815) : warning 215: expression has no effect
(4821) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.