[HELP] Random num saving for another function
Hey guys! I want to ask, because I didn't find the solution, about saving the random num from random_num native. My question: is there a way you get random_num via the native once, and then get the same random num, as the native got before, but using it in another function. Like to save the got random num from this function, then use it in the other function, and the forget it and start from beging with the first function and another random num?
|
Re: [HELP] Random num saving for another function
Save it in a global var when you generate it. After you use it reset the var to a value out of the range of random_num range (?)
|
Re: [HELP] Random num saving for another function
Oh, right, global vars. I'm so dumb for not trying this. Will test and post if something goes wrong. But for now, the case is closed :D
EDIT: Nope, even in a global var the random num is again random in every use of this var... Or I didn't get you right, or this metod doesn't work at all :D Any suggestions? |
Re: [HELP] Random num saving for another function
okay, looks like a bad case of someone who doesn't know basic coding or scripting
here's the deal, you can save your value in a global variable and it will stay the same as long as the function that generated the random number and saved it is not called again if something keeps calling the random number generation of course it will keep overwriting your global value |
Re: [HELP] Random num saving for another function
Do you think I didn't get it earlier? Would I make a thread if I didn't try the simplest thing at all. :D Hating all the time, anyways, right?
Here is an example, which doesn't work for me: PHP Code:
EDIT: Yea, all of us make mistakes. I agree with the upper posts, just didn't get the idea and meaning of global var. Just an index and it saves, clear. Thank you, mostly nikko. |
Re: [HELP] Random num saving for another function
Quote:
Don't need global for that. |
Re: [HELP] Random num saving for another function
This is what I mean
PHP Code:
|
Re: [HELP] Random num saving for another function
Problem solved. Excuse that stupid question, wasn't me that night.... My brother is trying to write, making stupid threads all the forums, spamming the people's inboxes... Problem solved anyways, thanks! And now to change that password :D
|
| All times are GMT -4. The time now is 09:42. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.