Random giving 0 all the time.
#1

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;
Reply
#2

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.
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)