Help 1 error, 2 warnings
#1

Код:
C:\Users\Luke\Downloads\samp\gamemodes\tmp_fm_agame2 (1).pwn(410) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Luke\Downloads\samp\gamemodes\tmp_fm_agame2 (1).pwn(410) : warning 215: expression has no effect
C:\Users\Luke\Downloads\samp\gamemodes\tmp_fm_agame2 (1).pwn(411) : warning 209: function "OnDialogResponse" should return a value
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Hours",0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your ready, Just relog to get started!","Ok","");
                        }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
                if(PlayerInfo[playerid][pAdmin] == 0)
                {
                   SendClientMessage(playerid, COLOR_GREEN, "You have successfully login to your account");
                }
                else
                {
                   switch(PlayerInfo[playerid][pAdmin])
                   {
                      case 0: AdmRank = "Helper";
                      case 1: AdmRank = "Trial Admin";
                      case 2: AdmRank = "Admin Level 2";
                      case 3: AdmRank = "Admin Level 3";
                      case 4: AdmRank = "Head Admin";
                      case 5: AdmRank = "Head Manager";
                      case 6: AdmRank = "Co-owner";
                   }
                   if(PlayerInfo[playerid][pAdmin] >= 7)
                   {
                      AdmRank = "Server Owner";
                   }
                   new string[128];
                   new PlayerName[MAX_PLAYER_NAME];
                   GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
                   format(string,sizeof(string),"You have been automaticlly login | - Level %d - %s - |",PlayerInfo[playerid][pAdmin],AdmRank);
                   SendClientMessage(playerid,COLOR_GREEN,string);
                 }
                return 1;
            }
        }
    }
    return 1;
}
Код:
410: return 1;
411: }
Hope you can help.

Thanks
Reply
#2

Bump.
Thanks
Reply
#3

Please dont bump the threads,
someone will answer you when they can!

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Hours",0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your ready, Just relog to get started!","Ok","");
                        }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
                    if(PlayerInfo[playerid][pAdmin] == 0)
                    {
                       SendClientMessage(playerid, COLOR_GREEN, "You have successfully login to your account");
                    }
                    else
                    {
                       switch(PlayerInfo[playerid][pAdmin])
                       {
                          case 0: AdmRank = "Helper";
                          case 1: AdmRank = "Trial Admin";
                          case 2: AdmRank = "Admin Level 2";
                          case 3: AdmRank = "Admin Level 3";
                          case 4: AdmRank = "Head Admin";
                          case 5: AdmRank = "Head Manager";
                          case 6: AdmRank = "Co-owner";
                       }
                       if(PlayerInfo[playerid][pAdmin] >= 7)
                       {
                          AdmRank = "Server Owner";
                       }
                       new string[128];
                       new PlayerName[MAX_PLAYER_NAME];
                       GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
                       format(string,sizeof(string),"You have been automaticlly login | - Level %d - %s - |",PlayerInfo[playerid][pAdmin],AdmRank);
                       SendClientMessage(playerid,COLOR_GREEN,string);
                    }
                }
                return 1;
            }
        }
    }
    return 1;
}
you where missing a closing tag
Indenting your code correctly will help you see these kinda errors.
also you should rethink this code..
but anyways that should get it working.
Reply
#4

Cheers your really helpful!
Reply
#5

In the future use


[ pawn]
code goes here...
[ /pawn]

It makes it easier to read and find the errors.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)