OnDialog problem.
#1

Код:
C:\Users\vLd\Desktop\GM\gamemodes\beta.pwn(364) : warning 217: loose indentation
C:\Users\vLd\Desktop\GM\gamemodes\beta.pwn(364) : error 014: invalid statement; not in switch
C:\Users\vLd\Desktop\GM\gamemodes\beta.pwn(364) : warning 215: expression has no effect
C:\Users\vLd\Desktop\GM\gamemodes\beta.pwn(364) : error 001: expected token: ";", but found ":"
C:\Users\vLd\Desktop\GM\gamemodes\beta.pwn(364) : error 029: invalid expression, assumed zero
C:\Users\vLd\Desktop\GM\gamemodes\beta.pwn(364) : fatal error 107: too many error messages on one line
Код:
case DIALOG_TUTORIAL_DOB:
			{
				if(isnull(inputtext))
				{
				    return ShowPlayerDialog(playerid, DIALOG_TUTORIAL_DOB, DIALOG_STYLE_INPUT, "Character Age", "Please enter the age of your character.", "Proceed", "Cancel");
				}
				pData[playerid][pHealth] = 100.0;
				pData[playerid][pAge] = strval(inputtext);
    			savePlayerData(playerid);
    			ShowPlayerDialog(playerid, DIALOG_REFERAL, DIALOG_STYLE_INPUT, "Referral", "{FFFFFF}Enter the {1850A3}NAME {FFFFFF}of the player who has {1850A3}brought on the server{FFFFFF}.", "Next", "Skip");
			}
Reply
#2

This piece of code (case DIALOG_TUTORIAL_DOB) is out of a switch statement.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
This piece of code (case DIALOG_TUTORIAL_DOB) is out of a switch statement.
Ok, but what is wrong ? I don't understund.
Reply
#4

Quote:
Originally Posted by Mititel
Посмотреть сообщение
Ok, but what is wrong ? I don't understund.
https://sampwiki.blast.hk/wiki/Control_Structures#switch_2
Reply
#5

The brackets are messed up and the case is not inside the switch along the rest. This is an example to show you:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch (dialogid)
    {
        case 0:
        {
            // code..
        }
        case 1:
        {
            // code..
        }
        }
        case 2:
        {
            // code..
        }
    }
    return 0;
}
and results to the exact same warnings/errors. Do you see the marked (red) closed bracket? It shouldn't be there at all. After indenting properly, we can figure out what is going on:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch (dialogid)
    {
        case 0:
        {
            // code..
        }
        case 1:
        {
            // code..
        }
    }
    case 2:
    {
        // code..
    }
}
return 0;
}
The opened brackets do not match the closed brackets. After removing that bracket that caused all this, it is now indented properly:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch (dialogid)
    {
        case 0:
        {
            // code..
        }
        case 1:
        {
            // code..
        }
        case 2:
        {
            // code..
        }
    }
    return 0;
}
and causes no errors and warnings whatsoever.

---

So either indent the whole code from OnDialogResponse callback to find the problem or post the callback here.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)