SA-MP Forums Archive
Random giveaway problem. - 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 giveaway problem. (/showthread.php?tid=532958)



Random giveaway problem. - gtasarules14 - 21.08.2014

Hi everyone, I am having a problem with a random giveaway for my drug system.
I made it so that after you start mining you are on a timer, after the timer ends you get a random amount of drug rocks.After I make the public function for the timer, my compiler crashes, if I remove it, the compiler works again.

My code.
pawn Код:
forward Mining(playerid);
public Mining(playerid)
{
    new rocks = random(1-10);
    PlayerInfo[playerid][Rocks] += rocks;
    return 1;
}
Any suggestions , if more code is needed, I will post it


Re: Random giveaway problem. - Stinged - 21.08.2014

You're using random(1-10)
1-10 = -9
I think that's the reason it's crashing.


Re: Random giveaway problem. - gtasarules14 - 21.08.2014

Quote:
Originally Posted by Stinged
Посмотреть сообщение
You're using random(1-10)
1-10 = -9
I think that's the reason it's crashing.
I changed it to random(10) and it is still crashing, any other suggestions?


Re: Random giveaway problem. - gtasarules14 - 21.08.2014

Fixed, thanks, + rep