SA-MP Forums Archive
Random Money Amount Into String? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Random Money Amount Into String? (/showthread.php?tid=202606)



Random Money Amount Into String? - <Weponz> - 24.12.2010

How can i get the random amount to show in a string so i can use with SendClientMessage?

pawn Код:
randmoney = random(MAX_CASH);
                    GivePlayerMoney(playerid,randmoney);
eg. You have won $%i !!!

Any help?

Thanks in advanced!



Re: Random Money Amount Into String? - Infamous - 24.12.2010

Use a format mate.

Код:
new string[256];
format(string, sizeof(string), "You have won $%d!", randmoney);
SendClientMessage(playerid, COLOR_HERE, string);



Re: Random Money Amount Into String? - <Weponz> - 24.12.2010

Thanks


Re: Random Money Amount Into String? - Infamous - 24.12.2010

Quote:
Originally Posted by Hoborific
Посмотреть сообщение
Just a helpful tip, you shouldn't need bigger than 128 string as thats the max characters of a sa-mp client message.
Yeah that is true, my mistake.