DIALOG LIST HELP - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: DIALOG LIST HELP (
/showthread.php?tid=432744)
DIALOG LIST HELP -
Slaykler - 24.04.2013
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");
}
}
}
}
Re: DIALOG LIST HELP -
Goldilox - 24.04.2013
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;
}
}
}
}
AW: DIALOG LIST HELP -
[AK]Nazgul - 24.04.2013
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.
Re: DIALOG LIST HELP -
Unte99 - 24.04.2013
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;
}
}
}
}
Re: DIALOG LIST HELP -
Slaykler - 24.04.2013
LOL I KNEW THE PROBLEM, I WAS TESTING A FEW OF YOU
For actually answering the question right Unte99 youll get Reputation