SA-MP Forums Archive
Random number in a dialog text - 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: Random number in a dialog text (/showthread.php?tid=451804)



Random number in a dialog text - Aerotactics - 18.07.2013

What I want to do is have a random number generated, and have it shown in a dialog text, how would I do this (no plugins)?

pawn Код:
new randomnumber=rand(1000);
ShowPlayerDialog(playerid, 700, DIALOG_STYLE_LIST, "Your number is (randomnumber HERE)", "Continue", "Leave");



Re: Random number in a dialog text - Misiur - 18.07.2013

pawn Код:
new randomnumber=rand(1000); //(0-999)
new str[19];
format(str, sizeof str, "Your number is %d", randomnumber);
ShowPlayerDialog(playerid, 700, DIALOG_STYLE_LIST, str, "Continue", "Leave");



Re: Random number in a dialog text - Pottus - 18.07.2013

new number[32];
format(number, sizeof(number), "Your number is %i", random(1000));
ShowPlayerDialog(playerid, 700, DIALOG_STYLE_LIST, number, "Continue", "Leave");


Re: Random number in a dialog text - Aerotactics - 18.07.2013

Quote:
Originally Posted by Misiur
Посмотреть сообщение
pawn Код:
new randomnumber=rand(1000); //(0-999)
new str[19];
format(str, sizeof str, "Your number is %d", randomnumber);
ShowPlayerDialog(playerid, 700, DIALOG_STYLE_LIST, str, "Continue", "Leave");
This is what I was looking for, thanks!