Invalid Function of declaration
#1

hello again and if i spam i'm very sorry...

here the code:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_TRUCK:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        ShowPlayerDialog(playerid,DIALOG_TRUCKL,DIALOG_STYLE_LIST,"What do you want to transport?","{00F70C}Food & beverages\n{00F70C}Clothing\n{00F70C}24/7 Items", "Select", "Cancel");
                    }
                    case 1:
                    {
                        ShowPlayerDialog(playerid,DIALOG_TRUCKI,DIALOG_STYLE_LIST,"What do you want to transport?","{FF0606}Weapons         {FFFFFF}(Level 1 Bonus: Free Weapons)\n{FF0606}Drugs            {FFFFFF}(Level 1 Bonus: Free 10 pot, 10 crack)","Choose","Cance");
                    }
                }
            }
        }
        case DIALOG_TRUCKL:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        TogglePlayerControllable(playerid,1);
                        CP[playerid] = 2;
                        SetPlayerCheckpoint(playerid,2264.3049,-1690.5104,13.6958,4.0);
                    }
                    case 1:
                    {
                        TogglePlayerControllable(playerid,1);
                        CP[playerid] = 3;
                        SetPlayerCheckpoint(playerid,786.7734,-1635.9037,13.3828,4.0);
                    }
                }
            }
        }
    }
    return 1;
    }
    return 0; // this is line 573
}
error:
pawn Код:
C:\Users\Admin\Desktop\NewServerss_2\filterscripts\Job.pwn(573) : error 010: invalid function or declaration
Reply
#2

Use either return 0; (if it's filterscript) or return 1; (if it's gamemode).

Change
pawn Код:
// ...
    }
    return 1;
    }
    return 0; // this is line 573
}
to:

either
pawn Код:
// ...
    }
    return 1;
}
or
pawn Код:
// ...
    }
    return 0;
}
Reply
#3

Try this:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_TRUCK:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        ShowPlayerDialog(playerid,DIALOG_TRUCKL,DIALOG_STYLE_LIST,"What do you want to transport?","{00F70C}Food & beverages\n{00F70C}Clothing\n{00F70C}24/7 Items", "Select", "Cancel");
                    }
                    case 1:
                    {
                        ShowPlayerDialog(playerid,DIALOG_TRUCKI,DIALOG_STYLE_LIST,"What do you want to transport?","{FF0606}Weapons         {FFFFFF}(Level 1 Bonus: Free Weapons)\n{FF0606}Drugs            {FFFFFF}(Level 1 Bonus: Free 10 pot, 10 crack)","Choose","Cance");
                    }
                }
            }
        }
        case DIALOG_TRUCKL:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        TogglePlayerControllable(playerid,1);
                        CP[playerid] = 2;
                        SetPlayerCheckpoint(playerid,2264.3049,-1690.5104,13.6958,4.0);
                    }
                    case 1:
                    {
                        TogglePlayerControllable(playerid,1);
                        CP[playerid] = 3;
                        SetPlayerCheckpoint(playerid,786.7734,-1635.9037,13.3828,4.0);
                    }
                }
            }
        }
    }
    return 1;
}
Reply
#4

You have one extra closing bracket, this would be the correct way to finish the callback:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_TRUCK:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        ShowPlayerDialog(playerid,DIALOG_TRUCKL,DIALOG_STYLE_LIST,"What do you want to transport?","{00F70C}Food & beverages\n{00F70C}Clothing\n{00F70C}24/7 Items", "Select", "Cancel");
                    }
                    case 1:
                    {
                        ShowPlayerDialog(playerid,DIALOG_TRUCKI,DIALOG_STYLE_LIST,"What do you want to transport?","{FF0606}Weapons         {FFFFFF}(Level 1 Bonus: Free Weapons)\n{FF0606}Drugs            {FFFFFF}(Level 1 Bonus: Free 10 pot, 10 crack)","Choose","Cance");
                    }
                }
            }
        }
        case DIALOG_TRUCKL:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        TogglePlayerControllable(playerid,1);
                        CP[playerid] = 2;
                        SetPlayerCheckpoint(playerid,2264.3049,-1690.5104,13.6958,4.0);
                    }
                    case 1:
                    {
                        TogglePlayerControllable(playerid,1);
                        CP[playerid] = 3;
                        SetPlayerCheckpoint(playerid,786.7734,-1635.9037,13.3828,4.0);
                    }
                }
            }
        }
    }
    return 1;
}
Reply
#5

return 1; in my gamemode and return 0; in my filterscript but the filterscript not work please help
Quote:
Originally Posted by _Zeus
Посмотреть сообщение
Use either return 0; (if it's filterscript) or return 1; (if it's gamemode).

Change
pawn Код:
// ...
    }
    return 1;
    }
    return 0; // this is line 573
}
to:

either
pawn Код:
// ...
    }
    return 1;
}
or
pawn Код:
// ...
    }
    return 0;
}
Reply
#6

help please
Reply
#7

Quote:

Returns Returning 0 in this callback will pass the dialog to another script in case no matching code were found in your gamemode's callback.

Taken from SAMP WIKI's OnDialogResponse - callback.
https://sampwiki.blast.hk/wiki/OnDialogResponse
Reply
#8

Quote:
Originally Posted by Sandiel
Посмотреть сообщение
Taken from SAMP WIKI's OnDialogResponse - callback.
https://sampwiki.blast.hk/wiki/OnDialogResponse
can u help me ?
Reply
#9

bump
Reply
#10

Just delete the return 1 and extra closing bracket. You seem to have ignored xabi's/_zeus post.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_TRUCK:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        ShowPlayerDialog(playerid,DIALOG_TRUCKL,DIALOG_STYLE_LIST,"What do you want to transport?","{00F70C}Food & beverages\n{00F70C}Clothing\n{00F70C}24/7 Items", "Select", "Cancel");
                    }
                    case 1:
                    {
                        ShowPlayerDialog(playerid,DIALOG_TRUCKI,DIALOG_STYLE_LIST,"What do you want to transport?","{FF0606}Weapons         {FFFFFF}(Level 1 Bonus: Free Weapons)\n{FF0606}Drugs            {FFFFFF}(Level 1 Bonus: Free 10 pot, 10 crack)","Choose","Cance");
                    }
                }
            }
        }
        case DIALOG_TRUCKL:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        TogglePlayerControllable(playerid,1);
                        CP[playerid] = 2;
                        SetPlayerCheckpoint(playerid,2264.3049,-1690.5104,13.6958,4.0);
                    }
                    case 1:
                    {
                        TogglePlayerControllable(playerid,1);
                        CP[playerid] = 3;
                        SetPlayerCheckpoint(playerid,786.7734,-1635.9037,13.3828,4.0);
                    }
                }
            }
        }
    }
    return 0; // this is line 573
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)