DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • November 19, 2018, 03:15:07 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Call Random Forest Event  (Read 3080 times)
0 Members and 1 Guest are viewing this topic.
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« on: February 06, 2005, 08:44:38 AM »

Hi, I want a module to start a random forest event.

I tried to use the following code from forest.php in my module:
Code:
if (module_events("forest", 100) != 0) {
   if (!checknavs()) {
      $session['user']['specialinc'] = "";
      $session['user']['specialmisc'] = "";            
      $op = "";
      httpset("op", "");
   } else {
      page_footer();
   }
}

But that only leads to a call of the last module (alphabetical). At least that works... But it seems, I cannot run another special event...

Any ideas?
Logged

Running for more than three years now:
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #1 on: February 06, 2005, 12:54:00 PM »

Try this:
Code:
$sql = "SELECT modulename FROM ".db_prefix("module_event_hooks")." WHERE event_type='forest' ORDER BY RAND(".e_rand().") LIMIT 1";
That should select one at random, and then you can alter the person specialinc to be:
Code:
$session['user']['specialinc']="module:".$sqlresult;
Then it should dump them in the right module.... I think ^_^
« Last Edit: February 06, 2005, 12:57:42 PM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
45 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search