Raised This Month: $ Target: $400
 0% 

[ZP] Optimización de code[SOLUCIONADO]


  
 
 
Thread Tools Display Modes
Author Message
Sidix
Senior Member
Join Date: Feb 2011
Location: Limbo City
Old 04-10-2012 , 18:18   [ZP] Optimización de code[SOLUCIONADO]
#1

hola a todos necesito una ayuda para optimizar este code...

PHP Code:
        // Reward ammo packs
        
if (!g_survivor[attacker] || !get_pcvar_num(cvar_survignoreammo))
        {
            
// Store damage dealt
            
g_damagedealt[attacker] += floatround(damage)
            new 
bool:up
            
            
// Almacenamos dańo por combo
            
g_damagecombo[attacker] += floatround(damage)
            
g_damagehits[attacker]++
            
            
show_current_combo(attackerfloatround(damage))
            
            
remove_task(attacker+TASK_RESET_COMBO)
            
            if (
g_damagehits[attacker] > 5)
            {
                while (
g_damagecombo[attacker] >= ammount_damage(g_combo[attacker]))
                {
                    
g_combo[attacker]++
                    
up true
                
}
                
                if (
up)
                {
                    
formatex(g_info_combo[attacker], 63"Combo %d completado!"g_combo[attacker])
                    
                    
remove_task(attacker+TASK_INFO_COMBO)
                    
set_task(3.0"info_combo"attacker+TASK_INFO_COMBO)
                }
                
                
remove_task(attacker+TASK_FINISH_COMBO)
                
set_task(3.0"finish_combo"attacker+TASK_FINISH_COMBO)
            }
            else
            {
                
set_task(1.0"reset_combo"attacker+TASK_RESET_COMBO)
            }

            
// Reward ammo packs for every [ammo damage] dealt
            
while (g_damagedealt[attacker] > get_pcvar_num(cvar_ammodamage))
            {
                
g_ammopacks[attacker]++
                
g_damagedealt[attacker] -= get_pcvar_num(cvar_ammodamage)
            }
        }
        
        return 
HAM_IGNORED;
    }
    
    
// Attacker is zombie... 
gracias de antemano salu2... !
__________________
[IMG]http://img839.**************/img839/1879/dmcdanteprofile.png[/IMG]

Last edited by Sidix; 04-11-2012 at 21:41.
Sidix is offline
XINLEI
me too
Join Date: Jun 2011
Location: Colombian Coffee storage
Old 04-10-2012 , 20:11   Re: [ZP] Optimización de code
#2

PHP Code:
new bool:up 
PHP Code:
static bool:up 
Esa es la unica optimizacion que se puede hacer sin reescribir los combos.
</span></span>
XINLEI is offline
Sidix
Senior Member
Join Date: Feb 2011
Location: Limbo City
Old 04-10-2012 , 22:51   Re: [ZP] Optimización de code
#3

Quote:
Originally Posted by XINLEI View Post
PHP Code:
new bool:up 
PHP Code:
static bool:up 
Esa es la unica optimizacion que se puede hacer sin reescribir los combos.
</span></span>
y cual es la diferencia?
__________________
[IMG]http://img839.**************/img839/1879/dmcdanteprofile.png[/IMG]
Sidix is offline
xLeoNNN
Veteran Member
Join Date: Sep 2010
Location: de_dust2
Old 04-10-2012 , 22:55   Re: [ZP] Optimización de code
#4

Quote:
Originally Posted by Sidix View Post
y cual es la diferencia?
el buscador la sabe.
__________________
xLeoNNN is offline
Send a message via MSN to xLeoNNN
Sidix
Senior Member
Join Date: Feb 2011
Location: Limbo City
Old 04-11-2012 , 09:57   Re: [ZP] Optimización de code
#5

Quote:
Originally Posted by xLeoNNN View Post
el buscador la sabe.
eh?

Quote:
Originally Posted by XINLEI View Post
La variable se convierte en estatica:
http://forums.alliedmods.net/showthread.php?t=155693
Gracias

Quote:
Originally Posted by shinoda View Post
'new' está bien ahí.
__________________
[IMG]http://img839.**************/img839/1879/dmcdanteprofile.png[/IMG]

Last edited by Sidix; 04-11-2012 at 09:58.
Sidix is offline
xLeoNNN
Veteran Member
Join Date: Sep 2010
Location: de_dust2
Old 04-11-2012 , 12:54   Re: [ZP] Optimización de code
#6

Quote:
Originally Posted by Sidix View Post
eh?



Gracias


https://forums.alliedmods.net/showthread.php?t=119596
__________________
xLeoNNN is offline
Send a message via MSN to xLeoNNN
XINLEI
me too
Join Date: Jun 2011
Location: Colombian Coffee storage
Old 04-10-2012 , 22:57   Re: [ZP] Optimización de code
#7

Quote:
Originally Posted by Sidix View Post
y cual es la diferencia?
La variable se convierte en estatica:
http://forums.alliedmods.net/showthread.php?t=155693
XINLEI is offline
shinoda
Spanish Moderator
Join Date: Nov 2009
Location: ag_crossfire
Old 04-10-2012 , 23:05   Re: [ZP] Optimización de code
#8

'new' está bien ahí.
shinoda is offline
Send a message via MSN to shinoda Send a message via Skype™ to shinoda
Sidix
Senior Member
Join Date: Feb 2011
Location: Limbo City
Old 04-11-2012 , 21:41   Re: [ZP] Optimización de code
#9

gracias a todos solucionado !
__________________
[IMG]http://img839.**************/img839/1879/dmcdanteprofile.png[/IMG]
Sidix is offline
 



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 22:37.


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