Help me with my dialog please
#1

So I have a little problem coming up when using one of my dialogs...It will be part of an event FS so it would be good to make it work well.

These are the basic parts where i got stuck

First i defined the dialog id to make things easier:
Код:
#define DIALOG_EVENTS 2
The command:


Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/event", cmdtext, true, 10) == 0)
	{
		ShowPlayerDialog(playerid, DIALOG_EVENTS, DIALOG_STYLE_LIST, "Which event do you want to create?","FOREST LMS", "Start", "Abort");
		return 1;
	}
	return 0;
}
and now the response:

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == DIALOG_EVENTS)
	{
    	if(response)
		{
  			if(listitem == 0)
   				{
					SendClientMessage(playerid, 0xAAFFCC33, "Starting event...");
					SetPlayerPos(playerid, 4457.8755, -1903.7388, 253.7345);
					GameTextForAll("~b~An event has started, use /join to join", 8, 1);
           		}
		}
	}
	return 1;
}
the problem is that i have an other dialog but in my game mode

this is it:

Код:
if (pickupid==wshop)
	    {
	 	ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What is it that you want?", "Desert Eagle (750$) \nAK47 (2250$) \nM4(2500$) \nGolf Club (50$) \nSawn-off Shotgun (1800$) \nTec9 (1500$)", "Purchase", "Cancel");
		}
	}
the response:

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

if(response)// They pressed the first button.
{
	switch(dialogid, 1)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
        {
		case 1:// Our dialog!
    	    {
           	switch(listitem)// Checking which listitem was selected
        	{
        	    case 0:// The Desert Eagle
        	    {
        	        if(GetPlayerMoney(playerid) < 750) return SendClientMessage(playerid, 0xAA3333AA, "You don't have enough cash.");
        	        GivePlayerMoney(playerid, -750);
        	        GivePlayerWeapon(playerid, 24, 500);
        	    }
        	    case 1: // The AK47
        	    {
        	        if(GetPlayerMoney(playerid) < 2250) return SendClientMessage(playerid, 0xAA3333AA, "You don't have enough cash.");
        	        GivePlayerMoney(playerid, -2250);
        	        GivePlayerWeapon(playerid, 30, 750);
        	    }
        	    case 2: // The M4
        	    {
        	        if(GetPlayerMoney(playerid) < 2500) return SendClientMessage(playerid, 0xAA3333AA, "You don't have enough cash.");
        	        GivePlayerMoney(playerid, -2500);
        	        GivePlayerWeapon(playerid, 31, 750);
				}
 				case 3: // The Golf Club
        	    {
        	        if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xAA3333AA, "You don't have enough cash.");
        	        GivePlayerMoney(playerid, -50);
        	        GivePlayerWeapon(playerid, 2, 0);
        	    }
        	    case 4: // The Sawn-off
        	    {
        	        if(GetPlayerMoney(playerid) < 1800) return SendClientMessage(playerid, 0xAA3333AA, "You don't have enough cash.");
        	        GivePlayerMoney(playerid, -1800);
        	        GivePlayerWeapon(playerid, 26, 400);
        	    }
        	    case 5: // The Tec9
        	    {
        	        if(GetPlayerMoney(playerid) < 1500) return SendClientMessage(playerid, 0xAA3333AA, "You don't have enough cash.");
        	        GivePlayerMoney(playerid, -1500);
        	        GivePlayerWeapon(playerid, 32, 800);
        	    }
			}
  			}
		}
}
return 1;
}

And when I'm trying to use the /event command the event dialog opens up but when i click the first option that is FOREST LMS, i am given a desert eagle for the cash i set in the "wshop" dialog....

I hope you understand DD

thanx in advance
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)