Just a small space problem!
#1

Hey again!

I'm really bad at spacing between two different commands!

Could you help me with the spacing?
I've highlighted the spot!

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == SHOP_DIALOG)//If the dialog responded to is our Weapon Shop dialog.
    {
        if(!response) return SendClientMessage(playerid, -1, "Apu voice: Thank you come again!");//If they click "Exit" they have left the dialog(Shop).
        switch(listitem)
        {
            case 0://Country Rifle
            {
                if(GetPlayerMoney(playerid) >= 3000)//If they have more or equal to the price.
                {
                    GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 3000);//Take the cost.
                    GivePlayerWeapon(playerid, 33, 60);//Give them the weapon/ammo.
                    SendClientMessage(playerid, -1, "Country Rifle purchased.");//And let them know they just purchased a weapon.
                    return 1;//Tell pawno to stop processing now.
                }
                else//Else the dont have enough money to cover the purchase.
                {
                    SendClientMessage(playerid, COLOR_RED, "You dont have 3000 dollars!");//Tell them.
                    return 1;//Tell pawno to stop processing now.
                }
            }
            case 1://AK-47
            {
                if(GetPlayerMoney(playerid) >= 6000)//If they have more or equal to the price.
                {
                    GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 6000);//Take the cost.
                    GivePlayerWeapon(playerid, 30, 100);//Give them the weapon/ammo.
                    SendClientMessage(playerid, -1, "AK-47 purchased.");//And let them know they just purchased a weapon.
                    return 1;//Tell pawno to stop processing now.
                }
                else//Else the dont have enough money to cover the purchase.
                {
                    SendClientMessage(playerid, COLOR_RED, "You dont have 6000 dollars!");//Tell them.
                    return 1;//Tell pawno to stop processing now.
                }
            }
            case 2://M4
            {
                if(GetPlayerMoney(playerid) >= 6000)//If they have more or equal to the price.
                {
                    GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 6000);//Take the cost.
                    GivePlayerWeapon(playerid, 31, 100);//Give them the weapon/ammo.
                    SendClientMessage(playerid, -1, "M4 purchased.");//And let them know they just purchased a weapon.
                    return 1;//Tell pawno to stop processing now.
                }
                else//Else the dont have enough money to cover the purchase.
                {
                    SendClientMessage(playerid, COLOR_RED, "You dont have 6000 dollars!");//Tell them.
                    return 1;//Tell pawno to stop processing now.
                }
            }
            case 3://RPG
            {
                if(GetPlayerMoney(playerid) >= 10000)//If they have more or equal to the price.
                {
                    GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 10000);//Take the cost.
                    GivePlayerWeapon(playerid, 34, 100);//Give them the weapon/ammo.
                    SendClientMessage(playerid, -1, "RPG purchased.");//And let them know they just purchased a weapon.
                    return 1;//Tell pawno to stop processing now.
                }
                else//Else the dont have enough money to cover the purchase.
                {
                    SendClientMessage(playerid, COLOR_RED, "You dont have 10 000 dollars!");//Tell them.
                    return 1;//Tell pawno to stop processing now.
                }

// I HAVE A PROBLEM ENDING THE COMMAND BEFORE THE SWITCH, THEREFORE I GET BIG ERRORS!
    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,"Deaths",0);
                INI_Close(File);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Have fun Bitches!","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]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
   }
        }
    }
    return 1;
}
Reply
#2

Your script is missing some brackets "}" (as I see). Look at the script before the highlighted text, add brackets there.
Reply
#3

I'm still getting LOADS of errors.
Reply
#4

If those 3 brackets didn't fix the problem, could you paste those errors you have?
Reply
#5

I changed the script and got fewer errors!

im gonna post the whole ondialogresponse..
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == SHOP_DIALOG)//If the dialog responded to is our Weapon Shop dialog.
    {
        if(!response) return SendClientMessage(playerid, -1, "Apu voice: Thank you come again!");//If they click "Exit" they have left the dialog(Shop).
        switch(listitem)
        {
            case 0://Country Rifle
            {
                if(GetPlayerMoney(playerid) >= 3000)//If they have more or equal to the price.
                {
                    GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 3000);//Take the cost.
                    GivePlayerWeapon(playerid, 33, 60);//Give them the weapon/ammo.
                    SendClientMessage(playerid, -1, "Country Rifle purchased.");//And let them know they just purchased a weapon.
                    return 1;//Tell pawno to stop processing now.
                }
                else//Else the dont have enough money to cover the purchase.
                {
                    SendClientMessage(playerid, COLOR_RED, "You dont have 3000 dollars!");//Tell them.
                    return 1;//Tell pawno to stop processing now.
                }
            }
            case 1://AK-47
            {
                if(GetPlayerMoney(playerid) >= 6000)//If they have more or equal to the price.
                {
                    GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 6000);//Take the cost.
                    GivePlayerWeapon(playerid, 30, 100);//Give them the weapon/ammo.
                    SendClientMessage(playerid, -1, "AK-47 purchased.");//And let them know they just purchased a weapon.
                    return 1;//Tell pawno to stop processing now.
                }
                else//Else the dont have enough money to cover the purchase.
                {
                    SendClientMessage(playerid, COLOR_RED, "You dont have 6000 dollars!");//Tell them.
                    return 1;//Tell pawno to stop processing now.
                }
            }
            case 2://M4
            {
                if(GetPlayerMoney(playerid) >= 6000)//If they have more or equal to the price.
                {
                    GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 6000);//Take the cost.
                    GivePlayerWeapon(playerid, 31, 100);//Give them the weapon/ammo.
                    SendClientMessage(playerid, -1, "M4 purchased.");//And let them know they just purchased a weapon.
                    return 1;//Tell pawno to stop processing now.
                }
                else//Else the dont have enough money to cover the purchase.
                {
                    SendClientMessage(playerid, COLOR_RED, "You dont have 6000 dollars!");//Tell them.
                    return 1;//Tell pawno to stop processing now.
                }
            }
            case 3://RPG
            {
                if(GetPlayerMoney(playerid) >= 10000)//If they have more or equal to the price.
                {
                    GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 10000);//Take the cost.
                    GivePlayerWeapon(playerid, 34, 100);//Give them the weapon/ammo.
                    SendClientMessage(playerid, -1, "RPG purchased.");//And let them know they just purchased a weapon.
                    return 1;//Tell pawno to stop processing now.
                }
                else//Else the dont have enough money to cover the purchase.
                {
                    SendClientMessage(playerid, COLOR_RED, "You dont have 10 000 dollars!");//Tell them.
                    return 1;//Tell pawno to stop processing now.
                }
}
}
        if(dialogid == DIALOG_REGISTER)
    {
        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,"Deaths",0);
                INI_Close(File);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Have fun Bitches!","Ok","");
            }
        }
        if(dialogid == DIALOG_REGISTER)
        {
       
        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]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
   }
        }
    }
    return 1;
}
The line 239 is the line that begins with: case DIALOG_REGISTER:

MY errors are:
Quote:

C:\Users\reha5\Desktop\waht.pwn(239) : error 014: invalid statement; not in switch
C:\Users\reha5\Desktop\waht.pwn(239) : warning 215: expression has no effect
C:\Users\reha5\Desktop\waht.pwn(239) : error 001: expected token: ";", but found ":"
C:\Users\reha5\Desktop\waht.pwn(239) : error 029: invalid expression, assumed zero
C:\Users\reha5\Desktop\waht.pwn(239) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Reply
#6

I checked the code again, as far I see, one bracket still misses.

Code before:

pawn Код:
case 3://RPG
            {
                if(GetPlayerMoney(playerid) >= 10000)//If they have more or equal to the price.
                {
                    GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 10000);//Take the cost.
                    GivePlayerWeapon(playerid, 34, 100);//Give them the weapon/ammo.
                    SendClientMessage(playerid, -1, "RPG purchased.");//And let them know they just purchased a weapon.
                    return 1;//Tell pawno to stop processing now.
                }
                else//Else the dont have enough money to cover the purchase.
                {
                    SendClientMessage(playerid, COLOR_RED, "You dont have 10 000 dollars!");//Tell them.
                    return 1;//Tell pawno to stop processing now.
                }
            }
        }
    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,"Deaths",0);
                INI_Close(File);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Have fun Bitches!","Ok","");
            }
        }
Code after:

pawn Код:
case 3://RPG
            {
                if(GetPlayerMoney(playerid) >= 10000)//If they have more or equal to the price.
                {
                    GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 10000);//Take the cost.
                    GivePlayerWeapon(playerid, 34, 100);//Give them the weapon/ammo.
                    SendClientMessage(playerid, -1, "RPG purchased.");//And let them know they just purchased a weapon.
                    return 1;//Tell pawno to stop processing now.
                }
                else//Else the dont have enough money to cover the purchase.
                {
                    SendClientMessage(playerid, COLOR_RED, "You dont have 10 000 dollars!");//Tell them.
                    return 1;//Tell pawno to stop processing now.
                }
            }
        }
    } //Bracket here!
    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,"Deaths",0);
                INI_Close(File);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Have fun Bitches!","Ok","");
            }
        }
Sorry, I don't have ZCMD include, so I can't test there does that have errors or not :>

EDIT: In your other code (which you posted above) also misses a bracked, also near the end.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)