Dialog problem
#1

Ok so this is my code:

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(response)// They pressed the first button.
    	{
    	switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
        	{
			case 8000:// Our dialog!
    	    	{
           		switch(listitem)// Checking which listitem was selected
        		{
        	    	case 0:// The first item listed
        	    	{
        	        	GivePlayerWeapon(playerid, 3, 1);
        	    	}
        	    	case 1: // The second item listed
        	    	{
        	        	GivePlayerWeapon(playerid, 16, 2);
        	    	}
        	    	case 2: // The third item listed
        	    	{
        	        	GivePlayerWeapon(playerid, 17, 2);
        	    	}
        	    	case 3:// The first item listed
        	    	{
        	        	GivePlayerWeapon(playerid, 23, 50);
        	    	}
        	    	case 4:// The first item listed
        	    	{
        	        	GivePlayerWeapon(playerid, 25, 50);
        	    	}
        	    	case 5:// The first item listed
        	    	{
        	        	GivePlayerWeapon(playerid, 29, 130);
        	    	}
        	    	case 6:// The first item listed
        	    	{
        	        	GivePlayerWeapon(playerid, 31, 130);
        	    	}
        	    	case 7:// The first item listed
        	    	{
        	        	GivePlayerWeapon(playerid, 34, 50);
        	    	}
        	    	case 8:// The first item listed
        	    	{
        	        	GivePlayerWeapon(playerid, 41, 250);
        	    	}
        	    	case 9:// The first item listed
        	    	{
        	        	GivePlayerWeapon(playerid, 43, 50);
        	    	}
        	    	case 10:// The first item listed
        	    	{
        	        	GivePlayerWeapon(playerid, 44, 50);
        	    	}
        	    	case 11:// The first item listed
        	    	{
        	        	GivePlayerWeapon(playerid, 45, 50);
        	    	}
        		}
        	 }
		}
 	}
 }
here the errors start: error 010: invalid function or declaration
	 if(response)
    	{
    	switch(dialogid)
        	{
			case 8001:
    	    	{
           		switch(listitem)
        		{
        	    	case 0:
        	    	{
                    	StopAudioStreamForPlayer(playerid);
                    	PlayAudioStreamForPlayer(playerid, "http://dl.dropbox.com/u/18961700/Usher%20-%20Scream%20(Radio%20Edit).mp3");
        	    	}
        	    	case 1:
        	    	{
        	        	StopAudioStreamForPlayer(playerid);
						PlayAudioStreamForPlayer(playerid, "http://dl.dropbox.com/u/96146856/I'm%20A%20New%20Soul%20-%20Jay%20Z%20ft.%20Yael%20Naim-.mp3");
        	    	}
        	    	case 2:
        	    	{
        	        	StopAudioStreamForPlayer(playerid);
						PlayAudioStreamForPlayer(playerid, "http://dl.dropbox.com/u/96146856/TROLLOLOL%20FULL.mp3");
        	    	}
        		}
        	 }
		}
 	}
Reply
#2

pawn Код:
if(response)
{
        switch(dialogid)
            {
            case 8001:
                {
                switch(listitem)
                {
                    case 0:
                    {
                        StopAudioStreamForPlayer(playerid);
                        PlayAudioStreamForPlayer(playerid, "http://dl.dropbox.com/u/18961700/Usher%20-%20Scream%20(Radio%20Edit).mp3");
                    }
                    case 1:
                    {
                        StopAudioStreamForPlayer(playerid);
                        PlayAudioStreamForPlayer(playerid, "http://dl.dropbox.com/u/96146856/I'm%20A%20New%20Soul%20-%20Jay%20Z%20ft.%20Yael%20Naim-.mp3");
                    }
                    case 2:
                    {
                        StopAudioStreamForPlayer(playerid);
                        PlayAudioStreamForPlayer(playerid, "http://dl.dropbox.com/u/96146856/TROLLOLOL%20FULL.mp3");
                    }
                }
             }
        }
    }
Reply
#3

you put a '}' before the next dialog so it wasn't in OnDialogResponse.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(response)// They pressed the first button.
    {
        switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
        {
            case 8000:// Our dialog!
            {
                switch(listitem)// Checking which listitem was selected
                {
                    case 0:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 3, 1);
                    }
                    case 1: // The second item listed
                    {
                        GivePlayerWeapon(playerid, 16, 2);
                    }
                    case 2: // The third item listed
                    {
                        GivePlayerWeapon(playerid, 17, 2);
                    }
                    case 3:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 23, 50);
                    }
                    case 4:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 25, 50);
                    }
                    case 5:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 29, 130);
                    }
                    case 6:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 31, 130);
                    }
                    case 7:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 34, 50);
                    }
                    case 8:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 41, 250);
                    }
                    case 9:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 43, 50);
                    }
                    case 10:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 44, 50);
                    }
                    case 11:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 45, 50);
                    }
                }
            }
            case 8001:
            {
                switch(listitem)
                {
                    case 0:
                    {
                        StopAudioStreamForPlayer(playerid);
                        PlayAudioStreamForPlayer(playerid, "http://dl.dropbox.com/u/18961700/Usher%20-%20Scream%20(Radio%20Edit).mp3");
                    }
                    case 1:
                    {
                        StopAudioStreamForPlayer(playerid);
                        PlayAudioStreamForPlayer(playerid, "http://dl.dropbox.com/u/96146856/I'm%20A%20New%20Soul%20-%20Jay%20Z%20ft.%20Yael%20Naim-.mp3");
                    }
                    case 2:
                    {
                        StopAudioStreamForPlayer(playerid);
                        PlayAudioStreamForPlayer(playerid, "http://dl.dropbox.com/u/96146856/TROLLOLOL%20FULL.mp3");
                    }
                }
             }
        }
    }
    return 0;
}
that should work
Reply
#4

Quote:
Originally Posted by MeDaKewlDude
Посмотреть сообщение
you put a '}' before the next dialog so it wasn't in OnDialogResponse.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(response)// They pressed the first button.
    {
        switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
        {
            case 8000:// Our dialog!
            {
                switch(listitem)// Checking which listitem was selected
                {
                    case 0:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 3, 1);
                    }
                    case 1: // The second item listed
                    {
                        GivePlayerWeapon(playerid, 16, 2);
                    }
                    case 2: // The third item listed
                    {
                        GivePlayerWeapon(playerid, 17, 2);
                    }
                    case 3:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 23, 50);
                    }
                    case 4:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 25, 50);
                    }
                    case 5:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 29, 130);
                    }
                    case 6:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 31, 130);
                    }
                    case 7:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 34, 50);
                    }
                    case 8:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 41, 250);
                    }
                    case 9:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 43, 50);
                    }
                    case 10:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 44, 50);
                    }
                    case 11:// The first item listed
                    {
                        GivePlayerWeapon(playerid, 45, 50);
                    }
                }
            }
            case 8001:
            {
                switch(listitem)
                {
                    case 0:
                    {
                        StopAudioStreamForPlayer(playerid);
                        PlayAudioStreamForPlayer(playerid, "http://dl.dropbox.com/u/18961700/Usher%20-%20Scream%20(Radio%20Edit).mp3");
                    }
                    case 1:
                    {
                        StopAudioStreamForPlayer(playerid);
                        PlayAudioStreamForPlayer(playerid, "http://dl.dropbox.com/u/96146856/I'm%20A%20New%20Soul%20-%20Jay%20Z%20ft.%20Yael%20Naim-.mp3");
                    }
                    case 2:
                    {
                        StopAudioStreamForPlayer(playerid);
                        PlayAudioStreamForPlayer(playerid, "http://dl.dropbox.com/u/96146856/TROLLOLOL%20FULL.mp3");
                    }
                }
             }
        }
    }
    return 0;
}
that should work
Thank you very much! That worked
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)