SA-MP Forums Archive
Dialog help - 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: Dialog help (/showthread.php?tid=578458)



Dialog help - lulo356 - 19.06.2015

I got this issue
pawn Код:
C:\Users\Davey\Desktop\lulo356.pwn(488) : error 014: invalid statement; not in switch
C:\Users\Davey\Desktop\lulo356.pwn(488) : warning 215: expression has no effect
C:\Users\Davey\Desktop\lulo356.pwn(488) : error 001: expected token: ";", but found ":"
C:\Users\Davey\Desktop\lulo356.pwn(488) : error 029: invalid expression, assumed zero
C:\Users\Davey\Desktop\lulo356.pwn(488) : fatal error 107: too many error messages on one line
error line
pawn Код:
case 7000://<==== Error Line
    {
        if(strval(inputtext) >= 14)
        {
            new string[128];
            sInfo[playerid][Age] = strval(inputtext);
            format(string, sizeof(string), "So you are %d years old.", strval(inputtext));
            SCM(playerid, WHITE, string);
            {
                ShowPlayerDialog(playerid, 7001, DIALOG_STYLE_LIST, "Registration -> Sex", "Boy\nGirl", "Select", "Quit");
            }
            else
            {
                SendClientMessage(playerid, WHITE, "You are to young enter a new age");
                ShowPlayerDialog(playerid, 7000, DIALOG_STYLE_INPUT, "Registration -> Age", "{FFFFFF}Enter your Characters Age\n You can RP as a Teen (age: 14,15,16,17)", "Enter", "");
            }
        }
and this error
pawn Код:
C:\Users\Davey\Desktop\lulo356.pwn(450) : error 006: must be assigned to an array
pawn Код:
if(dialogid==DIALOG_REGISTER)
    {
        if(response)
        {
            new name[MAX_PLAYER_NAME],query[128],passwort[35];
            GetPlayerName(playerid,name,sizeof(name));
            if(strlen(inputtext)>3)
            {
                mysql_escape_string(inputtext,passwort,dbhandle);
                format(query,sizeof(query),"INSERT INTO user (username,password) VALUES ('%s',MD5('%s')) ",name,passwort);
                mysql_function_query(dbhandle,query,false,"","");

                new
                    szBuffer[129];
               
                WP_Hash(szBuffer, sizeof(szBuffer), inputtext);
                sInfo[playerid][Password] = szBuffer; //<<========= error line
                sInfo[playerid][Health] = 100;
                sInfo[playerid][Armour] = 0;
                sInfo[playerid][Muted] = 1;

                SendClientMessage(playerid, COLOR_WHITE, "Okay, now let's set up your character.");
                new rand = random(sizeof(RandomMaleSkins));
                sInfo[playerid][Skin] = RandomMaleSkins[rand][0];
                SetPlayerVirtualWorld(playerid, playerid+2);
                ShowPlayerDialog(playerid, 7000, DIALOG_STYLE_INPUT, "Registration -> Age", "{FFFFFF}Enter your Characters Age\n You can RP as a Teen (age: 14,15,16,17)", "Enter", "");
            }
            else
            {
                SendClientMessage(playerid,COLOR_RED,"Your password must be at least 4 characters long.");
                ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please, Enter an password below:","Okay","Cancel");
            }
        }
        else
        {
            Kick(playerid);
        }
        return 1;
    }



AW: Dialog help - Mencent - 19.06.2015

Hello!

1.) (Your first problem):

The case isn't in the switch, e.g.:
All right:
PHP код:
switch(...)
{
        case 
1:
        {
        }

That isn't right:
PHP код:
switch(...)
{
       
}
case 
1:
{

2.) (Your second problem):

Try this:
PHP код:
strins(sInfo[playerid][Password],szBuffer,0); 
- Mencent


Re: AW: Dialog help - lulo356 - 19.06.2015

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello!

1.) (Your first problem):

The case isn't in the switch, e.g.:
All right:
PHP код:
switch(...)
{
        case 
1:
        {
        }

That isn't right:
PHP код:
switch(...)
{
       
}
case 
1:
{

2.) (Your second problem):

Try this:
PHP код:
strins(sInfo[playerid][Password],szBuffer,0); 
- Mencent
Can you maybe explane the switch(....) I don't understand that, How to solve the problem and stuff


AW: Dialog help - Mencent - 20.06.2015

Ok, I try it but my english isn't good..

The case-clause have to be in the switch-clause

This is right:
PHP код:
switch(...) 

        case 
1
        { 
        } 
        case 
2:
        { 
        } 

and this isn't right, because the case-stuff isn't in the switch-clause.
PHP код:
switch(...) 

        

case 
1

}
case 
2:


By the way: The other problem is solved?


Re: AW: Dialog help - lulo356 - 20.06.2015

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Ok, I try it but my english isn't good..

The case-clause have to be in the switch-clause

This is right:
PHP код:
switch(...) 

        case 
1
        { 
        } 
        case 
2:
        { 
        } 

and this isn't right, because the case-stuff isn't in the switch-clause.
PHP код:
switch(...) 

        

case 
1

}
case 
2:


By the way: The other problem is solved?
Yes the other problem is solved, But i'm still stuck at the first problem, Because its just one case, and it don't have more cases, So it need to be solved on a other way right?