Raised This Month: $ Target: $400
 0% 

Optimize help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Larcyn
Senior Member
Join Date: Oct 2010
Old 12-05-2011 , 11:23   Optimize help
Reply With Quote #1

Hello, is it possible to optimize this code?

PHP Code:

if(iRPS[iPlayer] == && iRPS[iTarget] == 2)
{
//Action here
}
    
if(
iRPS[iPlayer] == && iRPS[iTarget] == 3)
{
//Action here
}
    
if(
iRPS[iPlayer] == && iRPS[iTarget] == 1)
{
//Action here
}
    
if(
iRPS[iPlayer] == && iRPS[iTarget] == 1)
{
 
//Action here

If yes, how could it be done
Thanks in advance
__________________

Taking private requests, PM me for information.
Selling HideNSeek & Jailbreak plugins.

Selling Achievement API System (PHP &
MySQL / nVault)

Last edited by Larcyn; 12-05-2011 at 11:23. Reason: Edited Text
Larcyn is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 12-05-2011 , 11:28   Re: Optimize help
Reply With Quote #2

PHP Code:

if( iRPS[iPlayer] == && iRPS[iTarget] > 1
|| iRPS[iTarget] == && iRPS[iPlayer] > 1)
{
  
// Action here

</span></span>
__________________
Retired.

Last edited by Xalus; 12-05-2011 at 11:30.
Xalus is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 12-05-2011 , 12:27   Re: Optimize help
Reply With Quote #3

The switch statement
Erox902 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 12-05-2011 , 16:57   Re: Optimize help
Reply With Quote #4

PHP Code:
switch (iRPS[iPlayer])
{
    case 
1: switch (iRPS[iTarget])
    {
        case 
2:
        {
            
// Action here
        
}
        case 
3:
        {
            
// Action here
        
}
    }
    case 
2: if (iRPS[iTarget] == 1)
    {
        
// Action here
    
}
    case 
3: if (iRPS[iTarget] == 1)
    {
        
// Action here
    
}

__________________
hleV is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 12-05-2011 , 20:57   Re: Optimize help
Reply With Quote #5

switch(iRPS[iPlayer] * 10 + iRPS[iTarget])
{
case 12:
case 13:
case 21:
case 31:
}
just another option, not much faster than above, I don't know the range of iRPS[] , maybe your should tweak the formula to make the result unique.
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang 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 11:49.


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