random for robbery - 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 for robbery (
/showthread.php?tid=253301)
random for robbery -
Admigo - 05.05.2011
Heey guys
I want to make a robbery with random chance. But how can i make it? And how can i make the change bigger or lower?
Thanks Admigo
Re: random for robbery -
Vero - 05.05.2011
pawn Код:
new rand = random(10); // How many cases
switch(rand)
{
case 0, 3, 5, 7: //Case number = a chance
{
SendClientMessage(playerid, W, "You robbed the bank!" );
}
case 1, 4, 6, 8: // The more the case numbers the bigger the chance.
{
SendClientMessage(playerid, W, "You have been caught!" );
That might do the trick.
EDIT: Changes some of the // to make it more useful.
Re: random for robbery -
Admigo - 05.05.2011
Ty for reply
Can you say where to put it?
I want to make a robbery with a pickup
Re: random for robbery -
Vero - 05.05.2011
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == myrobpickup) // So your pick up should be defined as what you want it to be. I used myrobpickup as an example
{
new rand = random(10);
switch(rand)
{
case 0, 3, 5, 7:
{
SendClientMessage(playerid, WHITE, "You have robbed the bank!");
}
case 1, 4, 6, 8:
{
SendClientMessage(playerid, WHITE, "You got caught");
Something like that
Re: random for robbery -
Admigo - 05.05.2011
Okay i will test it thank you so much
Re: random for robbery -
Vero - 05.05.2011
No problem let me know if it works
Re: random for robbery -
Admigo - 05.05.2011
I test it in some mins but can i make with this a lottery to?
Re: random for robbery -
Vero - 05.05.2011
Not too sure you could try