DIALOG LIST HELP
#1

Hey guys, i got a mind block atm help me out thanks

Код:
if(dialogid == BACKPACK1)
	{
	    if(response)
	    {
			if(listitem == 1)
			{
			    if(PlayerInfo[playerid][pFishingRod] > 0)
				{
			    	SendClientMessage(playerid, COLOR_WHITE, "INFO: You need to use /fish command");
				}
				else
				{
				    SendClientMessage(playerid, COLOR_WHITE, "INFO: You do not have any nets to use");
				}
			}
			if(listitem == 2)
			{
			    if(PlayerInfo[playerid][pFishingNet] > 0)
				{
			    	CreateDroppableItem(playerid);
			    	PlayerInfo[playerid][pFishingNet] -=1;
			    	SendClientMessage(playerid, COLOR_WHITE, "INFO: You have dropped a net onto the ground");
			    }
			    else
			    {
			        SendClientMessage(playerid, COLOR_WHITE, "INFO: You do not have any nets to drop");
				}
			}
		}
	}
Reply
#2

What issue you get lol?

I have just added returns so now you will not get unknown command message and I think for dropping you need to use != 1 rather than -= 1

pawn Код:
if(dialogid == BACKPACK1)
    {
        if(response)
        {
            if(listitem == 1)
            {
                if(PlayerInfo[playerid][pFishingRod] > 0)
                {
                    SendClientMessage(playerid, COLOR_WHITE, "INFO: You need to use /fish command");
                return 1;
                                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "INFO: You do not have any nets to use");
                                    return 1;
                }
            }
            if(listitem == 2)
            {
                if(PlayerInfo[playerid][pFishingNet] > 0)
                {
                    CreateDroppableItem(playerid);
                    PlayerInfo[playerid][pFishingNet] !=1;
                    SendClientMessage(playerid, COLOR_WHITE, "INFO: You have dropped a net onto the ground");
return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "INFO: You do not have any nets to drop");
return 1;              
}
            }
        }
    }
Reply
#3

Nah, != is used for conditions, e.g. if(x != y) or while (x != y).
-= decreases a value by what you state, so like
pawn Код:
new x = 2;
x -= 1; // x = x - 1 -> x equals one.
Reply
#4

The problem is obvious... He said that he has a problem with the dialogs list. Listitems start from 0, so the code should look like this:


pawn Код:
if(dialogid == BACKPACK1)
    {
        if(response)
        {
            if(listitem == 0)
            {
                if(PlayerInfo[playerid][pFishingRod] > 0)
                {
                    SendClientMessage(playerid, COLOR_WHITE, "INFO: You need to use /fish command");
                                return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "INFO: You do not have any nets to use");
                                    return 1;
                }
            }
            if(listitem == 1)
            {
                if(PlayerInfo[playerid][pFishingNet] > 0)
                {
                    CreateDroppableItem(playerid);
                    PlayerInfo[playerid][pFishingNet] -=1;
                    SendClientMessage(playerid, COLOR_WHITE, "INFO: You have dropped a net onto the ground");
                                return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "INFO: You do not have any nets to drop");
                                return 1;
                }
            }
        }
    }
Reply
#5

LOL I KNEW THE PROBLEM, I WAS TESTING A FEW OF YOU

For actually answering the question right Unte99 youll get Reputation
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)