SA-MP Forums Archive
Question about checking - 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: Question about checking (/showthread.php?tid=562772)



Question about checking - Ectazy - 11.02.2015

Hey, I'd like to ask, how can I subtract money of player for item which player chosen in 59 dialog. Script:

Код:
new const PriceOfItem[] = { 250,450,624,781,944 };

In the other dialog are 6 listitem with Items and timer: SetTimerEx("buy",10000,false,"dd",playerid,PriceOfItem[listitem-1]);

forward buy(playerid,itemprice);
public buy(playerid,itemprice)
{
    new string[126];
    format(string,122,"Are you sure?\n\nThe item price is - {FFFF00}%d $.",itemprice);
    ShowPlayerDialog(playerid,59,DIALOG_STYLE_MSGBOX,"Item price",string,"Buy","Back");
}



Re: Question about checking - Ectazy - 11.02.2015

Код:
else if(dialogid == 59)
{
	if(response)
	{
	    GivePlayerMoney(playerid, -(How can I check price?250,450,624,781 or 944))
	}
	return 1;	
}



Re: Question about checking - Ectazy - 12.02.2015

Up..


Re: Question about checking - HY - 12.02.2015

pawn Код:
new Money;

forward buy(playerid,itemprice);
public buy(playerid,itemprice)
{
    new string[126];
    format(string,122,"Are you sure?\n\nThe item price is - {FFFF00}%d $.",itemprice);
    Money = itemprice;
    ShowPlayerDialog(playerid,59,DIALOG_STYLE_MSGBOX,"Item price",string,"Buy","Back");
}

else if(dialogid == 59)
{
    if(response)
    {
        GivePlayerMoney(playerid, Money);
    }
    return 1;  
}