Dialog help
#1

Hello,i got problem with dialog,i wanted to make if ur boxing etc is 1 u can choose the style,but when its not u cant and it says you havent learn it yet! but it wont say it,and if its 1 it wont say anything and wont choose the style,help me thanks heres the dialog
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOGID)
    {
        if(response)
        {
            if(listitem == 0)
            {
                ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_LIST, "Fighting Styles", "Elbow\nBoxing\nGrabkick\nKneehead\nKungfu\nNormal", "Select", "Cancel");
            }
        }
        return 1;
    }
    if(dialogid == DIALOGID+1)
    {
        if(response)
        {
            if(listitem == 0)
            {
            if(PlayerInfo[playerid][elbow] == 1)
            {
                SetPlayerFightingStyle (playerid, FIGHT_STYLE_ELBOW);
            }
            if(listitem == 1)
            {
            if(PlayerInfo[playerid][Boxing] == 1)
            {
                SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
            }
            if(listitem == 2)
            {
            if(PlayerInfo[playerid][grabkick] == 1)
            {
              SetPlayerFightingStyle (playerid, FIGHT_STYLE_GRABKICK);
            }
            if(listitem == 3)
            {
            if(PlayerInfo[playerid][kneehead] == 1)
            {
                SetPlayerFightingStyle (playerid, FIGHT_STYLE_KNEEHEAD);
            }
            if(listitem == 4)
            {
            if(PlayerInfo[playerid][KungFu] == 1)
            {
         SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
            }
            if(listitem == 5)
            {
            SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);
                        }
                    }
                }
                }
            }
            else { SendClientMessage(playerid, COLOR_GREY,"You Havent Learn this Skill!"); }
        }
    }
        return 1;
    }
    return 0;
 }
Reply
#2

You need to split it up....

so you do:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp, "/Fightstyle", cmdtext, true)
    {
        ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_LIST, "Fighting Styles", "Elbow\nBoxing\nGrabkick\nKneehead\nKungfu\nNormal", "Select", "Cancel");
        return 1;
    }
}
Then you can do

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
}
	if(dialogid == DIALOGID+1)
	{
		if(response)
		{
			if(listitem == 0)
			{
				if(PlayerInfo[playerid][elbow] == 1)
				{
					SetPlayerFightingStyle (playerid, FIGHT_STYLE_ELBOW);
			}
			if(listitem == 1)
			{
		 		if(PlayerInfo[playerid][Boxing] == 1)
				{
					SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
			}
			if(listitem == 2)
			{
		 		if(PlayerInfo[playerid][grabkick] == 1)
				{
				  SetPlayerFightingStyle (playerid, FIGHT_STYLE_GRABKICK);
			}
			if(listitem == 3)
			{
	 			if(PlayerInfo[playerid][kneehead] == 1)
				{
					SetPlayerFightingStyle (playerid, FIGHT_STYLE_KNEEHEAD);
			}
			if(listitem == 4)
			{
			 	if(PlayerInfo[playerid][KungFu] == 1)
				{
	   		 SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
			}
			if(listitem == 5)
			{
				SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);
			}
			else
			{
			SendClientMessage(playerid, COLOR_GREY,"You Havent Learn this Skill!"); }
		}
		return 1;
	}
	return 0;
}
Or something like that

If not try my tutorial. and begin from scratch
http://forum.sa-mp.com/index.php?topic=134698.0
Reply
#3

i have that cmd :S but the problem is i dont know how to put that boxing = 1 and stuff,and the last message if u havent learned it :SSS
Reply
#4

Did you write this dialog?
seriously?
Reply
#5

nope i added the boxing= 1 and the other ones
Reply
#6

Well, then do me and all others on SA-MP forum a favor. read my Tutorial
http://forum.sa-mp.com/index.php?topic=134698.0

and learn how to make a dialog list.
the its logic how to add the boxing skills
Its much easier to help a person who knows about dialogs
than a person that dont know about dialogs.. so, please read it
Reply
#7

i dont understand how can i add more if things on it not the itemlist,the boxing thing i think its wrongly putted but i dont know where i put it:S
Reply
#8

Okay, give me a sec. i'll rewrite it for you.


Okay, here you have it:

Put this under public OnPlayerCommandText
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/fightstyle", cmdtext, true, 11) == 0)
	{
		ShowPlayerDialog(playerid, 1234, DIALOG_STYLE_LIST, "Fighting Style", "Elbow\nBoxing\nGrabkick\nKneehead\nKungfu\nNormal", "Learn", "Cancel");
		return 1;
	}
	return 0;
}
And this public OnDialogResponse
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 1234)
	{
	  if(response)
	  {
	    if(listitem == 0)
	    {
	      SetPlayerFightingStyle(playerid, FIGHT_STYLE_ELBOW);
				SendClientMessage(playerid, 0xFFFFFFFF, "You've learned fighting style 'Elbow'");
			}
			if(listitem == 1)
			{
			  SetPlayerFightingStyle(playerid, FIGHT_STYLE_BOXING);
			  SendClientMessage(playerid, 0xFFFFFFFF, "You've learned fighting style 'Boxing'");
			}
			if(listitem == 2)
			{
			  SetPlayerFightingStyle(playerid, FIGHT_STYLE_GRABKICK);
			  SendClientMessage(playerid, 0xFFFFFFFF, "You've learned fighting style 'Grabkick'");
			}
			if(listitem == 3)
			{
			  SetPlayerFightingStyle(playerid, FIGHT_STYLE_KNEEHEAD);
			  SendClientMessage(playerid, 0xFFFFFFFF, "You've learned fighting style 'KNEEHEAD'");
			}
			if(listitem == 4)
			{
			  SetPlayerFightingStyle(playerid, FIGHT_STYLE_KUNGFU);
			  SendClientMessage(playerid, 0xFFFFFFFF, "You've learned fighting style 'KUNGFU'");
			}
			if(listitem == 5)
			{
			  SetPlayerFightingStyle(playerid, FIGHT_STYLE_NORMAL);
			  SendClientMessage(playerid, 0xFFFFFFFF, "You've learned fighting style 'Normal'");
			}
		}
	}
	return 1;
}
UNTESTED

Easy as a pie
Reply
#9

no no no wrong,heres my idea,if(PlayerInfo[playerid][elbow] == 1),then it will add the fighting style,but if its 0,it tells you havent learn it:S
Reply
#10

Here you go mate, i added the PlayerInfo, make sure you have the Fight styles loading on OnPlayerLogin and creating OnPlayerRegister & Update though you will have to make functions like

pawn Код:
forward fightstyle_Boxing(playerid);
public fightstyle_Boxing(playerid)
{
SetPlayerFightingStyle(playerid, FIGHT_STYLE_BOXING);
}
Put this under public OnPlayerCommandText
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/fightstyle", cmdtext, true, 11) == 0)
    {
        ShowPlayerDialog(playerid, 1234, DIALOG_STYLE_LIST, "Fighting Style", "Elbow\nBoxing\nGrabkick\nKneehead\nKungfu\nNormal", "Learn", "Cancel");
        return 1;
    }
    return 0;
}
And this public OnDialogResponse
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1234)
    {
      if(response)
      {
        if(listitem == 0)
        {
          SetPlayerFightingStyle(playerid, FIGHT_STYLE_ELBOW);
                SendClientMessage(playerid, 0xFFFFFFFF, "You've learned fighting style 'Elbow'");
                PlayerInfo[playerid][elbow] = 1;
                PlayerInfo[playerid][boxing] = 0;
                PlayerInfo[playerid][kneehead] = 0;
        PlayerInfo[playerid][grabkick] = 0;
        PlayerInfo[playerid][KungFu] = 0;
        PlayerInfo[playerid][normal] = 0;
            }
            if(listitem == 1)
            {
              SetPlayerFightingStyle(playerid, FIGHT_STYLE_BOXING);
              SendClientMessage(playerid, 0xFFFFFFFF, "You've learned fighting style 'Boxing'");
                PlayerInfo[playerid][elbow] = 0;
                PlayerInfo[playerid][boxing] = 1;
                PlayerInfo[playerid][kneehead] = 0;
        PlayerInfo[playerid][grabkick] = 0;
        PlayerInfo[playerid][KungFu] = 0;
        PlayerInfo[playerid][normal] = 0;
            }
            if(listitem == 2)
            {
              SetPlayerFightingStyle(playerid, FIGHT_STYLE_GRABKICK);
              SendClientMessage(playerid, 0xFFFFFFFF, "You've learned fighting style 'Grabkick'");
              PlayerInfo[playerid][elbow] = 0;
                PlayerInfo[playerid][boxing] = 0;
                PlayerInfo[playerid][kneehead] = 0;
        PlayerInfo[playerid][grabkick] = 1;
        PlayerInfo[playerid][KungFu] = 0;
        PlayerInfo[playerid][normal] = 0;
            }
            if(listitem == 3)
            {
              SetPlayerFightingStyle(playerid, FIGHT_STYLE_KNEEHEAD);
              SendClientMessage(playerid, 0xFFFFFFFF, "You've learned fighting style 'KNEEHEAD'");
              PlayerInfo[playerid][elbow] = 0;
                PlayerInfo[playerid][boxing] = 0;
                PlayerInfo[playerid][kneehead] = 1;
        PlayerInfo[playerid][grabkick] = 0;
        PlayerInfo[playerid][KungFu] = 0;
        PlayerInfo[playerid][normal] = 0;
            }
            if(listitem == 4)
            {
              SetPlayerFightingStyle(playerid, FIGHT_STYLE_KUNGFU);
              SendClientMessage(playerid, 0xFFFFFFFF, "You've learned fighting style 'KUNGFU'");
              PlayerInfo[playerid][elbow] = 0;
                PlayerInfo[playerid][boxing] = 0;
                PlayerInfo[playerid][kneehead] = 0;
        PlayerInfo[playerid][grabkick] = 0;
        PlayerInfo[playerid][KungFu] = 1;
        PlayerInfo[playerid][normal] = 0;
            }
            if(listitem == 5)
            {
              SetPlayerFightingStyle(playerid, FIGHT_STYLE_NORMAL);
              SendClientMessage(playerid, 0xFFFFFFFF, "You've learned fighting style 'Normal'");
              PlayerInfo[playerid][elbow] = 0;
                PlayerInfo[playerid][boxing] = 0;
                PlayerInfo[playerid][kneehead] = 0;
        PlayerInfo[playerid][grabkick] = 0;
        PlayerInfo[playerid][KungFu] = 0;
        PlayerInfo[playerid][normal] = 1;
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)