It is currently Sat Aug 02, 2014 1:21 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: random events
PostPosted: Fri Oct 28, 2011 9:06 pm 
Offline
User avatar
.: Level III :.

Joined: Sun Jun 21, 2009 6:03 am
Posts: 573
Location: Montreal, Québec
iTrader:
Gender: Male
Cash:160
Reputation point: 22
Wings will become famous soon enough


Winner Award

Hey all! I was wondering how do you implement random events in a website like neopets? I guess it's a code that uses probabilities but what does it look like?

_________________
G33Ks Sp0TT3D


My Guides


Top
 Profile  
 
 Post subject: Re: random events
PostPosted: Fri Oct 28, 2011 9:58 pm 
Offline
User avatar
.: Admin :.

Joined: Sat Nov 08, 2008 4:58 am
Posts: 3020
Location: Where you want me to be...
iTrader:
Gender: Male
Cash:2256
Reputation point: 597
Lightning has a reputation beyond repute!Lightning has a reputation beyond repute!Lightning has a reputation beyond repute!Lightning has a reputation beyond repute!Lightning has a reputation beyond repute!Lightning has a reputation beyond repute!Lightning has a reputation beyond repute!Lightning has a reputation beyond repute!Lightning has a reputation beyond repute!Lightning has a reputation beyond repute!Lightning has a reputation beyond repute!Lightning has a reputation beyond repute!Lightning has a reputation beyond repute!Lightning has a reputation beyond repute!Lightning has a reputation beyond repute!


Content Giveaway Donor Award Trader Winner Award

There are many ways to, but a simple way to do it is to use PHP.

There is a random function called mt_rand(). http://php.net/manual/en/function.mt-rand.php
If you don't want a person to have too many random events, you could have an entry in an SQL data table for each user for the last time that they got an event like that. If the last time is long enough in the past, then if mt_rand(1, 100000000) = 5820, then generate an event.

_________________
New to the site?

Programs


Image


Top
 Profile  
 
 Post subject: Re: random events
PostPosted: Sat Oct 29, 2011 4:24 pm 
Offline
User avatar
.: Level III :.

Joined: Sun Jun 21, 2009 6:03 am
Posts: 573
Location: Montreal, Québec
iTrader:
Gender: Male
Cash:160
Reputation point: 22
Wings will become famous soon enough


Winner Award

Thank you very much Lightning :)

_________________
G33Ks Sp0TT3D


My Guides


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
* FAQ

Powered by phpBB © 2000- phpBB Group
NEOPETS, characters, logos, names and all related indicia are trademarks of Neopets, Inc., © 1999-. © denotes Reg. US Pat. & TM Office. All rights reserved.
Website © neofriends.net - this site is in no way affiliated with Neopets, Inc or Viacom International, Inc.

phpBB SEO