Raised This Month: $ Target: $400
 0% 

Optimize this..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
quelospario
BANNED
Join Date: Dec 2009
Old 06-26-2010 , 17:52   Optimize this..
Reply With Quote #1

PHP Code:
static nextclassLvl[33]
Lvl[id] = random_num(0200)

switch(
Lvl[id])
{
      case 
0..24nextclass 25-Lvl[id]
      case 
25..49nextclass 50-Lvl[id]
      case 
50..74nextclass 75-Lvl[id]
      case 
75..99nextclass 100-Lvl[id]
      case 
100.124nextclass 125-Lvl[id]
      case 
125..149nextclass 150-Lvl[id]
      case 
150..174nextclass 175-Lvl[id]
      case 
175..199nextclass 200-Lvl[id]
      default: 
nextclass 999
}
     
client_print(0print_chat,"NextLevelClass: %d"nextclass
quelospario is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 06-26-2010 , 18:05   Re: Optimize this..
Reply With Quote #2

PHP Code:
static nextclassLvl[33]
Lvl[id] = random_num(0200)
nextclass 25-Lvl[id]%25
client_print
(0print_chat,"NextLevelClass: %d"nextclass
__________________
Impossible is Nothing
Sylwester is offline
quelospario
BANNED
Join Date: Dec 2009
Old 06-26-2010 , 18:10   Re: Optimize this..
Reply With Quote #3

Quote:
Originally Posted by Sylwester View Post
PHP Code:
static nextclassLvl[33]
Lvl[id] = random_num(0200)
nextclass 25-Lvl[id]%25
client_print
(0print_chat,"NextLevelClass: %d"nextclass
I love you.
quelospario is offline
Old 06-26-2010, 18:11
Sylwester
This message has been deleted by Sylwester.
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-26-2010 , 18:11   Re: Optimize this..
Reply With Quote #5

What does the percent sign do in
PHP Code:
25-Lvl[id]%25 
Thanks.
RedRobster is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-26-2010 , 18:13   Re: Optimize this..
Reply With Quote #6

Quote:
Originally Posted by RedRobster View Post
What does the percent sign do in
PHP Code:
25-Lvl[id]%25 
Thanks.
Modulo. It returns the remainder.

30 % 25 = 5
100 % 100 = 0
5 % 3 = 2
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 06-26-2010 , 18:13   Re: Optimize this..
Reply With Quote #7

modulo operator
__________________
Impossible is Nothing
Sylwester is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-26-2010 , 18:13   Re: Optimize this..
Reply With Quote #8

Thanks.
RedRobster is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode