random_num(0,1) is ALWAYS 1
Hello! I've made a deathrun plugin for my server based on Deathrun Manager by xPaw
I did a function that happens in every new round, that gives 1 life to a random players, but giving a bigger chance to vips from my server to have this random life. Here is the code: PHP Code:
P.S.: I'm testing alone on my server... |
Re: random_num(0,1) is ALWAYS 1
I haven't evaluated your code closely (Im on my phone typing) but keep in mind its a 50/50 shot of the value being 1. How many times have you tested?
Also, you are using && for checking flags, should only be & since its a bit-comparison. There are other improvements that can be made. |
Re: random_num(0,1) is ALWAYS 1
I know... But a tried a lot of times ( like 20 times) and I always receive the (VIP) message...
About &&, my fault, fixed :P I know that it's possible to have some improvements, but didn't think in a better way... '-' |
Re: random_num(0,1) is ALWAYS 1
If nobody else chimes in I will take care of it later for you. In the meantime, try debugging yourself. Print out values in your code to see where the error is occurring.
|
Re: random_num(0,1) is ALWAYS 1
PHP Code:
Code:
random 4995, random_num 5037 |
Re: random_num(0,1) is ALWAYS 1
EDIT@
Didn't seem the above message :P Anyways, I think it doesn't fix my problem :x I did a check and see what it printed: PHP Code:
PHP Code:
|
Re: random_num(0,1) is ALWAYS 1
PHP Code:
PHP Code:
|
Re: random_num(0,1) is ALWAYS 1
Oh, now it fixed my problems! Thanks!
PHP Code:
|
| All times are GMT -4. The time now is 20:11. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.