Random giving 0 all the time. - 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 giving 0 all the time. (
/showthread.php?tid=363374)
Random giving 0 all the time. -
ricardo178 - 27.07.2012
Hey again. Well, too many questions today yeah. Sorry for that.
I am keeping with my poker, and i want it to give 2 cards, both random between number 1 and 13, and types, between 4 types. I did this, but it sets everything to 0 all the time.
pawn Код:
new randcard = random(13);
new randtype = random(4);
PokerPlayerInfo[PokerCardsInfo[P1]][Card1] = randcard;
PokerPlayerInfo[PokerCardsInfo[P1]][Card2] = randcard;
PokerPlayerInfo[PokerCardsInfo[P1]][Card1T] = randtype;
PokerPlayerInfo[PokerCardsInfo[P1]][Card2T] = randtype;
Re: Random giving 0 all the time. -
Vince - 27.07.2012
Nothing wrong the initializers. Possibly an out of bound error of some sort. Try printing the values right after you assign them.
Sidenote: Why don't you use one variable to keep track of the cards? Spades 1 - 13, Clubs 14 - 26, Diamonds 27 - 39, Hearts 40 - 52.
Re : Re: Random giving 0 all the time. -
ricardo178 - 27.07.2012
Quote:
Originally Posted by Vince
Nothing wrong the initializers. Possibly an out of bound error of some sort. Try printing the values right after you assign them.
Sidenote: Why don't you use one variable to keep track of the cards? Spades 1 - 13, Clubs 14 - 26, Diamonds 27 - 39, Hearts 40 - 52.
|
The mistake was on checking. Fixed it.
SideNote: Hmm, good idea. Will give it a try. Making a Poker system is damn hard. xD