Why dialog is not working?
#1

Hi,

In top:
Код:
enum
{
	DIALOG_UNUSED,

	DIALOG_LOGIN,
	DIALOG_REGISTER,
	DIALOG_WEAPONS
};
This is my dialog cmd:
Код:
CMD:build(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 1.0, 2795.5701,2793.7720,17.6763))
    {
        ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "Knife\nBaseball Bat\nAk-47\nMP5\nGrenade\nSniper", "Build", "Cancel");
    }
	return 1;
}
This is my dialog response code:
Код:
	if(dialogid == DIALOG_WEAPONS)
		{
	  			switch(listitem)
	  			{
	  			    case 0:
	  			    {
	  			        InventoryWeapon[playerid][Knife]++;
                                        SendClientMessage(playerid,-1,"Knife Given!");
	  			    }
	  			    case 1:
	  			    {
	  			        InventoryWeapon[playerid][BaseballBat]++;
	  			    }
	  			    case 2:
	  			    {
	  			        InventoryWeapon[playerid][Ak47]++;
	  			    }
	  			    case 3:
	  			    {
	  			        InventoryWeapon[playerid][MP5]++;
	  			    }
	  			    case 4:
	  			    {
	  			        InventoryWeapon[playerid][Grenade]++;
	  			    }
	  			    case 5:
	  			    {
	  			        InventoryWeapon[playerid][Sniper]++;
	  			    }
			}
Only this dialog is showing but not giving things
Reply
#2

Use
PHP код:
#define DIALOG_WEAPON 1
//or something like that. 
and don't use enum
Reply
#3

Wary, use enums for that, it'll auto increace numbers.
akib, you only change InventoryWeapon value, but you didn't use anywhere GivePlayerWeapon, to give weapon for player.
Reply
#4

Quote:
Originally Posted by Wary
Посмотреть сообщение
Use
PHP код:
#define DIALOG_WEAPON 1
//or something like that. 
and don't use enum
still not working
Reply
#5

How are you giving players the actual item? From what I can see you only 'give' it to them inside the User file
Reply
#6

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
Wary, use enums for that, it'll auto increace numbers.
akib, you only change InventoryWeapon value, but you didn't use anywhere GivePlayerWeapon, to give weapon for player.
bro u can see my code:

Код:
if(dialogid == DIALOG_WEAPONS)
		{
	  			switch(listitem)
	  			{
	  			    case 0:
	  			    {
	  			        InventoryWeapon[playerid][Knife]++;
                                        SendClientMessage(playerid,-1,"Knife Given!");
	  			    }
	  			    case 1:
	  			    {
	  			        InventoryWeapon[playerid][BaseballBat]++;
	  			    }
	  			    case 2:
	  			    {
	  			        InventoryWeapon[playerid][Ak47]++;
	  			    }
	  			    case 3:
	  			    {
	  			        InventoryWeapon[playerid][MP5]++;
	  			    }
	  			    case 4:
	  			    {
	  			        InventoryWeapon[playerid][Grenade]++;
	  			    }
	  			    case 5:
	  			    {
	  			        InventoryWeapon[playerid][Sniper]++;
	  			    }
			}
it should give a client message when i buy knife? but it is not giving if it is not giving then how it can give weapon to player?
Reply
#7

Remove Params Cause You're not using it, And instead of wasting Your time on enums, Just Use defines

P.S: in enums the ID Will be generated Randomly So It can Cause a bug :P (it can Generate Same IDs For 2 Dialogs)
Код:
#define DIALOG_UNUSED 0
#define DIALOG_LOGIN 1
#define DIALOG_REGISTER 2
#define DIALOG_WEAPONS 3
And for the dialog & Cmd Use this :
Код:
CMD:build(playerid)
{
      if(!IsPlayerInRangeOfPoint(playerid, 1.0, 2795.5701,2793.7720,17.6763)) return SendClientMessage(playerid, -1, "You Cannot Use This CMD While You Are Not In Range !");
      new str[2500];
      format(str, sizeof str, "Knife\nBaseball Bat\nAk-47\nMP5\nGrenade\nSniper");      
      ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", str, "Build", "cancel");
      return 1;
}
Reply
#8

Quote:
Originally Posted by adrianlouise
Посмотреть сообщение
Remove Params Cause You're not using it, And instead of wasting Your time on enums, Just Use defines

P.S: in enums the ID Will be generated Randomly So It can Cause a bug :P (it can Generate Same IDs For 2 Dialogs)
Код:
#define DIALOG_UNUSED 0
#define DIALOG_LOGIN 1
#define DIALOG_REGISTER 2
#define DIALOG_WEAPONS 3
And for the dialog & Cmd Use this :
Код:
CMD:build(playerid)
{
      if(!IsPlayerInRangeOfPoint(playerid, 1.0, 2795.5701,2793.7720,17.6763)) return SendClientMessage(playerid, -1, "You Cannot Use This CMD While You Are Not In Range !");
      new str[2500];
      format(str, sizeof str, "Knife\nBaseball Bat\nAk-47\nMP5\nGrenade\nSniper");      
      ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", str, "Build", "cancel");
      return 1;
}
not worked
Reply
#9

Lol this dude thinks saying weapon given will actually give user weapon.

You have to give the weapon using GivePlayerWeapon.
Reply
#10

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Lol this dude thinks saying weapon given will actually give user weapon.

You have to give the weapon using GivePlayerWeapon.
Dude i think u r newbie.... i am giving weapon to their inventory but why the clientmessage no showing? -_-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)