Derp; Dialog errors
#1

pawn Код:
case DIALOG_SPAWN:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        SetSpawnInfo( playerid, 1, 124, 413.5646,2537.1045,19.1484,175.2024, 0, 0, 0, 0, 0, 0 );
                        SpawnPlayer(playerid);
                        SetPlayerPos(playerid, 413.5646,2537.1045,19.1484);
                        SetPlayerInterior(playerid, 0);
                        Terro[playerid] = 1;
                        TogglePlayerSpectating(playerid, 0);
                        SendClientMessage(playerid, COLOR_RED, "General Khan: Kill all the police that get in your way! GO GO GO!");
                        SetPlayerColor(playerid, COLOR_RED);
                        return 1;
                    }
                    case 1:
                    {
                        SetSpawnInfo( playerid, 2, 287, 218.1994,1856.7305,13.0597,1.0574, 0, 0, 0, 0, 0, 0 );
                        SpawnPlayer(playerid);
                        SetPlayerPos(playerid, 218.1994,1856.7305,13.0597);
                        SetPlayerInterior(playerid, 0);
                        Police[playerid] = 1;
                        TogglePlayerSpectating(playerid, 0);
                        SendClientMessage(playerid, 0x8FD8D8, "Constable Greene: Eliminate all Talibans in the area! GO GO GO!");
                        SetPlayerColor(playerid, COLOR_CYAN);
                        return 1;
                    }
                }
            }
            return 1;
        }
    }
pawn Код:
C:\Users\Jamie\Desktop\SAMP\gamemodes\TDM.pwn(432) : error 014: invalid statement; not in switch
C:\Users\Jamie\Desktop\SAMP\gamemodes\TDM.pwn(432) : warning 215: expression has no effect
C:\Users\Jamie\Desktop\SAMP\gamemodes\TDM.pwn(432) : error 001: expected token: ";", but found ":"
C:\Users\Jamie\Desktop\SAMP\gamemodes\TDM.pwn(432) : error 029: invalid expression, assumed zero
C:\Users\Jamie\Desktop\SAMP\gamemodes\TDM.pwn(432) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

Anyone?
Reply
#3

i would make the dialog checker if(dialogid == DIALOG_SPAWN)
not a case ...i never use case for that check
Reply
#4

I'll try it now and I HATE your pic
Reply
#5

It's now this:
Код:
     	if(dialogid == DIALOG_SPAWN)
    	{
			switch(listitem)
			{
			    case 0:
				{
				    SetSpawnInfo( playerid, 1, 124, 413.5646,2537.1045,19.1484,175.2024, 0, 0, 0, 0, 0, 0 );
			    	SpawnPlayer(playerid);
			    	SetPlayerPos(playerid, 413.5646,2537.1045,19.1484);
			    	SetPlayerInterior(playerid, 0);
					Terro[playerid] = 1;
                    TogglePlayerSpectating(playerid, 0);
					SendClientMessage(playerid, COLOR_RED, "General Khan: Kill all the police that get in your way! GO GO GO!");
					SetPlayerColor(playerid, COLOR_RED);
			    	return 1;
				}
				case 1:
				{
				    SetSpawnInfo( playerid, 2, 287, 218.1994,1856.7305,13.0597,1.0574, 0, 0, 0, 0, 0, 0 );
			    	SpawnPlayer(playerid);
					SetPlayerPos(playerid, 218.1994,1856.7305,13.0597);
					SetPlayerInterior(playerid, 0);
					Police[playerid] = 1;
					TogglePlayerSpectating(playerid, 0);
					SendClientMessage(playerid, 0x8FD8D8, "Constable Greene: Eliminate all Talibans in the area! GO GO GO!");
					SetPlayerColor(playerid, COLOR_CYAN);
					return 1;
				}
			}
			return 1;
	    }
With:
Код:
C:\Users\Jamie\Desktop\SAMP\gamemodes\TDM.pwn(441) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Jamie\Desktop\SAMP\gamemodes\TDM.pwn(441 -- 442) : error 029: invalid expression, assumed zero
C:\Users\Jamie\Desktop\SAMP\gamemodes\TDM.pwn(473) : error 010: invalid function or declaration
C:\Users\Jamie\Desktop\SAMP\gamemodes\TDM.pwn(496) : warning 235: public function lacks forward declaration (symbol "statStat")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#6

Can I see the whole code?
Reply
#7

Sure:
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_PASSWORD, "Making your account ..","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"PlayerData");
                new HashPass[129];
                WP_Hash(HashPass, sizeof(HashPass), inputtext);
                INI_WriteString(File, "Password", HashPass);
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",-1);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Muted",0);
                INI_WriteInt(File,"VIP",0);
                INI_WriteInt(File,"Skin",0);
               
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Account created!","You've created an account successfuly. Relogging is recommended, although you don't have too.","Ok","");
            }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                new HashPass[129];
                WP_Hash(HashPass, sizeof(HashPass), inputtext);
                if(strcmp(HashPass, PlayerInfo[playerid][pPass]) == 0)
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    //ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"Success!","You have successfully logged in!","Ok","");
                    ShowPlayerDialog(playerid, DIALOG_SPAWN, DIALOG_STYLE_LIST,"Choose your team","Terrorist\nPolice","Spawn","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
        case DIALOG_RULES:
        {
            if(!response)
            {
                SendClientMessage(playerid, COLOR_RED, "|- Error: Agree to the rules or you'll be banned next time");
                Kick(playerid);
                printf("player %s disagreed to the rules.", Name(playerid));
                return 1;
            }
        }
        case DIALOG_SHOP:
        {
            if(!response)
            {
                return 0;
            }
            else
            {
                switch(listitem)
                {
                    case 0:
                    {
                        if(PlayerInfo[playerid][pCash] == 700)
                        {
                            ServerWeapon(playerid, 22, 300);
                           // ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "Shop", "Colt 45($700)\nDesert Eagle($1,00)\nShotgun ($2,00)\nCombat Shotgun($3,500)\nMP5($1,500)\nAk-47($2,500)\nM4($3,500)", "Buy", "Cancel");
                            PlayerInfo[playerid][pCash] -= 700;
                        }
                        else SendClientMessage(playerid, COLOR_RED, "|- Error: You don't have enough cash to purchase this!");
                    }
                    case 1:
                    {
                        if(PlayerInfo[playerid][pCash] == 1000)
                        {
                            ServerWeapon(playerid, 24, 100);
                            //ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "Shop", "Colt 45($700)\nDesert Eagle($1,00)\nShotgun ($2,00)\nCombat Shotgun($3,500)\nMP5($1,500)\nAk-47($2,500)\nM4($3,500)", "Buy", "Cancel");
                            PlayerInfo[playerid][pCash] -= 1000;
                        }
                        else SendClientMessage(playerid, COLOR_RED, "|- Error: You don't have enough cash to purchase this!");
                    }
                    case 2:
                    {
                        if(PlayerInfo[playerid][pCash] == 2000)
                        {
                            ServerWeapon(playerid, 25, 50);
                            //ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "Shop", "Colt 45($700)\nDesert Eagle($1,00)\nShotgun ($2,00)\nCombat Shotgun($3,500)\nMP5($1,500)\nAk-47($2,500)\nM4($3,500)", "Buy", "Cancel");
                            PlayerInfo[playerid][pCash] -= 2000;
                        }
                        else SendClientMessage(playerid, COLOR_RED, "|- Error: You don't have enough cash to purchase this!");
                    }
                }
            }
        }
        if(dialogid == DIALOG_SPAWN) // 441
        {
            switch(listitem)
            {
                case 0:
                {
                    SetSpawnInfo( playerid, 1, 124, 413.5646,2537.1045,19.1484,175.2024, 0, 0, 0, 0, 0, 0 );
                    SpawnPlayer(playerid);
                    SetPlayerPos(playerid, 413.5646,2537.1045,19.1484);
                    SetPlayerInterior(playerid, 0);
                    Terro[playerid] = 1;
                    TogglePlayerSpectating(playerid, 0);
                    SendClientMessage(playerid, COLOR_RED, "General Khan: Kill all the police that get in your way! GO GO GO!");
                    SetPlayerColor(playerid, COLOR_RED);
                    return 1;
                }
                case 1:
                {
                    SetSpawnInfo( playerid, 2, 287, 218.1994,1856.7305,13.0597,1.0574, 0, 0, 0, 0, 0, 0 );
                    SpawnPlayer(playerid);
                    SetPlayerPos(playerid, 218.1994,1856.7305,13.0597);
                    SetPlayerInterior(playerid, 0);
                    Police[playerid] = 1;
                    TogglePlayerSpectating(playerid, 0);
                    SendClientMessage(playerid, 0x8FD8D8, "Constable Greene: Eliminate all Talibans in the area! GO GO GO!");
                    SetPlayerColor(playerid, COLOR_CYAN);
                    return 1;
                }
            }
            return 1;
        }
    }
    return 1;
}
Код:
C:\Users\Jamie\Desktop\SAMP\gamemodes\TDM.pwn(441) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Jamie\Desktop\SAMP\gamemodes\TDM.pwn(441 -- 442) : error 029: invalid expression, assumed zero
C:\Users\Jamie\Desktop\SAMP\gamemodes\TDM.pwn(473) : error 010: invalid function or declaration
C:\Users\Jamie\Desktop\SAMP\gamemodes\TDM.pwn(496) : warning 235: public function lacks forward declaration (symbol "statStat")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#8

Hope this might help you
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_PASSWORD, "Making your account ..","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"PlayerData");
                new HashPass[129];
                WP_Hash(HashPass, sizeof(HashPass), inputtext);
                INI_WriteString(File, "Password", HashPass);
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",-1);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Muted",0);
                INI_WriteInt(File,"VIP",0);
                INI_WriteInt(File,"Skin",0);
               
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Account created!","You've created an account successfuly. Relogging is recommended, although you don't have too.","Ok","");
            }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                new HashPass[129];
                WP_Hash(HashPass, sizeof(HashPass), inputtext);
                if(strcmp(HashPass, PlayerInfo[playerid][pPass]) == 0)
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    //ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"Success!","You have successfully logged in!","Ok","");
                    ShowPlayerDialog(playerid, DIALOG_SPAWN, DIALOG_STYLE_LIST,"Choose your team","Terrorist\nPolice","Spawn","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
        case DIALOG_RULES:
        {
            if(!response)
            {
                SendClientMessage(playerid, COLOR_RED, "|- Error: Agree to the rules or you'll be banned next time");
                Kick(playerid);
                printf("player %s disagreed to the rules.", Name(playerid));
                return 1;
            }
        }
        case DIALOG_SHOP:
        {
            if(!response)
            {
                return 0;
            }
            else
            {
                switch(listitem)
                {
                    case 0:
                    {
                        if(PlayerInfo[playerid][pCash] == 700)
                        {
                            ServerWeapon(playerid, 22, 300);
                           // ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "Shop", "Colt 45($700)\nDesert Eagle($1,00)\nShotgun ($2,00)\nCombat Shotgun($3,500)\nMP5($1,500)\nAk-47($2,500)\nM4($3,500)", "Buy", "Cancel");
                            PlayerInfo[playerid][pCash] -= 700;
                        }
                        else SendClientMessage(playerid, COLOR_RED, "|- Error: You don't have enough cash to purchase this!");
                    }
                    case 1:
                    {
                        if(PlayerInfo[playerid][pCash] == 1000)
                        {
                            ServerWeapon(playerid, 24, 100);
                            //ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "Shop", "Colt 45($700)\nDesert Eagle($1,00)\nShotgun ($2,00)\nCombat Shotgun($3,500)\nMP5($1,500)\nAk-47($2,500)\nM4($3,500)", "Buy", "Cancel");
                            PlayerInfo[playerid][pCash] -= 1000;
                        }
                        else SendClientMessage(playerid, COLOR_RED, "|- Error: You don't have enough cash to purchase this!");
                    }
                    case 2:
                    {
                        if(PlayerInfo[playerid][pCash] == 2000)
                        {
                            ServerWeapon(playerid, 25, 50);
                            //ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "Shop", "Colt 45($700)\nDesert Eagle($1,00)\nShotgun ($2,00)\nCombat Shotgun($3,500)\nMP5($1,500)\nAk-47($2,500)\nM4($3,500)", "Buy", "Cancel");
                            PlayerInfo[playerid][pCash] -= 2000;
                        }
                        else SendClientMessage(playerid, COLOR_RED, "|- Error: You don't have enough cash to purchase this!");
                    }
                }
            }
        }
        case DIALOG_SPAWN: // 441
        {
            switch(listitem)
            {
                case 0:
                {
                    SetSpawnInfo( playerid, 1, 124, 413.5646,2537.1045,19.1484,175.2024, 0, 0, 0, 0, 0, 0 );
                    SpawnPlayer(playerid);
                    SetPlayerPos(playerid, 413.5646,2537.1045,19.1484);
                    SetPlayerInterior(playerid, 0);
                    Terro[playerid] = 1;
                    TogglePlayerSpectating(playerid, 0);
                    SendClientMessage(playerid, COLOR_RED, "General Khan: Kill all the police that get in your way! GO GO GO!");
                    SetPlayerColor(playerid, COLOR_RED);
                    return 1;
                }
                case 1:
                {
                    SetSpawnInfo( playerid, 2, 287, 218.1994,1856.7305,13.0597,1.0574, 0, 0, 0, 0, 0, 0 );
                    SpawnPlayer(playerid);
                    SetPlayerPos(playerid, 218.1994,1856.7305,13.0597);
                    SetPlayerInterior(playerid, 0);
                    Police[playerid] = 1;
                    TogglePlayerSpectating(playerid, 0);
                    SendClientMessage(playerid, 0x8FD8D8, "Constable Greene: Eliminate all Talibans in the area! GO GO GO!");
                    SetPlayerColor(playerid, COLOR_CYAN);
                    return 1;
                }
            }
            return 1;
        }
    }
    return 1;
}
Reply
#9

It's fixed now, thanks anyway. Rep++

P.S I done exactly what you done xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)