Invalid function / declaration?
#1

Here is a weapon system i am making for my server:

Код:
if(dialogid == weapon)
	{
		if(response)
		{
	    	switch(listitem)
	    	{
	    		if(listitem == 0)
    			{
	        		ShowPlayerDialog(playerid,melee,DIALOG_STYLE_LIST,"Melee","Brass Knuckles ($500)\nGolf Club ($500)\nNight Stick ($500)\nKnife ($1000)\nBaseball Bat ($750)\nShovel ($500)\nPool Cue ($500)\nSword ($2000)","Buy","Close");
				}
				if(listitem == 1)
				{
		    		ShowPlayerDialog(playerid,pistols,DIALOG_STYLE_LIST,"Pistols","9mm ($5000)\nSilenced Pistol ($7000)\nDesert Eagle ($100000)","Buy","Close");
				}
				if(listitem == 2)
				{
		    		ShowPlayerDialog(playerid,shotguns,DIALOG_STYLE_LIST,"Shotguns","Shotgun ($50000)\nSawn-off Shotgun ($250000)\nCombat Shotgun ($500000)","Buy","Close");
				}
				if(listitem == 3)
				{
				    ShowPlayerDialog(playerid,smgs,DIALOG_STYLE_LIST,"SMGs","Tec 9 ($25000)\nUZI ($25000)\nMP5 ($100000)","Buy","Close");
				}
				if(listitem == 4)
				{
				    ShowPlayerDialog(playerid,assault,DIALOG_STYLE_LIST,"Assault Rifles","M4 ($500000)\nAK-47 ($500000)","Buy","Close");
				}
				if(listitem == 5)
				{
				    ShowPlayerDialog(playerid,rifles,DIALOG_STYLE_LIST,"Rifles/Snipers","Sniper ($1000000)\nCountry Rifle ($750000)","Buy","Close");
				}
			}
		}
		return 1;
	}
but it's getting errors:

Код:
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1426) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1428) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1430) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1432) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1436) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1440) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1444) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1448) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1452) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1458) : error 010: invalid function or declaration
Sorry for being so noobish, if I knew what was causing the problem, I wouldnt be here right now.
Reply
#2

Here you go:

PHP код:
if(dialogid == weapon)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
                
ShowPlayerDialog(playerid,melee,DIALOG_STYLE_LIST,"Melee","Brass Knuckles ($500)\nGolf Club ($500)\nNight Stick ($500)\nKnife ($1000)\nBaseball Bat ($750)\nShovel ($500)\nPool Cue ($500)\nSword ($2000)","Buy","Close");
            }
            if(
listitem == 1)
            {
                
ShowPlayerDialog(playerid,pistols,DIALOG_STYLE_LIST,"Pistols","9mm ($5000)\nSilenced Pistol ($7000)\nDesert Eagle ($100000)","Buy","Close");
            }
            if(
listitem == 2)
            {
                
ShowPlayerDialog(playerid,shotguns,DIALOG_STYLE_LIST,"Shotguns","Shotgun ($50000)\nSawn-off Shotgun ($250000)\nCombat Shotgun ($500000)","Buy","Close");
            }
            if(
listitem == 3)
            {
                
ShowPlayerDialog(playerid,smgs,DIALOG_STYLE_LIST,"SMGs","Tec 9 ($25000)\nUZI ($25000)\nMP5 ($100000)","Buy","Close");
            }
            if(
listitem == 4)
            {
                
ShowPlayerDialog(playerid,assault,DIALOG_STYLE_LIST,"Assault Rifles","M4 ($500000)\nAK-47 ($500000)","Buy","Close");
            }
            if(
listitem == 5)
            {
                
ShowPlayerDialog(playerid,rifles,DIALOG_STYLE_LIST,"Rifles/Snipers","Sniper ($1000000)\nCountry Rifle ($750000)","Buy","Close");
            }
        }
        return 
1;
    } 
Reply
#3

Thought switch(listitem) was needed but apparently not.

Still getting errors:

C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1426) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(142 : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1430) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1434) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(143 : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1442) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1446) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1450) : error 010: invalid function or declaration
C:\Users\di$t0rt3d_p1ctur3\Saved Games\GTA San Andreas\Server\gamemodes\coolbeans.pwn(1455) : error 010: invalid function or declaration

EDIT: I placed it above my register system and it worked. Idk why everything I place under the register system returns errors but oh well. Thanks for the help mate, rep+ you
Reply
#4

Try this.

pawn Код:
if(dialogid == weapon)
{
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    ShowPlayerDialog(playerid,melee,DIALOG_STYLE_LIST,"Melee","Brass Knuckles ($500)\nGolf Club ($500)\nNight Stick ($500)\nKnife ($1000)\nBaseball Bat ($750)\nShovel ($500)\nPool Cue ($500)\nSword ($2000)","Buy","Close");
                    return 1;
                }
                case 1:
                {
                    ShowPlayerDialog(playerid,pistols,DIALOG_STYLE_LIST,"Pistols","9mm ($5000)\nSilenced Pistol ($7000)\nDesert Eagle ($100000)","Buy","Close");
                    return 1;
                }
                case 2:
                {
                    ShowPlayerDialog(playerid,shotguns,DIALOG_STYLE_LIST,"Shotguns","Shotgun ($50000)\nSawn-off Shotgun ($250000)\nCombat Shotgun ($500000)","Buy","Close");
                    return 1;
                }
                case 3:
                {
                    ShowPlayerDialog(playerid,smgs,DIALOG_STYLE_LIST,"SMGs","Tec 9 ($25000)\nUZI ($25000)\nMP5 ($100000)","Buy","Close");
                    return 1;
                }
                case 4:
                {
                    ShowPlayerDialog(playerid,assault,DIALOG_STYLE_LIST,"Assault Rifles","M4 ($500000)\nAK-47 ($500000)","Buy","Close");
                    return 1;
                }
                case 5:
                {
                    ShowPlayerDialog(playerid,rifles,DIALOG_STYLE_LIST,"Rifles/Snipers","Sniper ($1000000)\nCountry Rifle ($750000)","Buy","Close");
                    return 1;
                }
            }
        }
   }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)