Raised This Month: $ Target: $400
 0% 

Such approach is a performance loss or is it irrelevant? [solved]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 10-04-2015 , 06:05   Such approach is a performance loss or is it irrelevant? [solved]
Reply With Quote #1

Hi everybody, I just develop a Golden Weapons which "enable" to buy fictitiously 3 Golden Weapons with higher damage.

And there is this 'Ham_TakeDamage' forward and 'CurWeapon' event, which I don't understand well the impact of it at server's performace:
PHP Code:
    RegisterHam(Ham_TakeDamage"player""fw_takedamage"0
PHP Code:
/**
 * Does not affect cs built-in bots. Only players and PODBots.
 */
public fw_takedamagevictiminflictorattackerFloat:damage )
{
    if( 
attacker )
    {
        new 
clip
        
new ammo
        
new currentSpecialWeapon get_user_weapon(attackerclipammo)

        if( 
g_whichSpecialWeapon[attacker] == currentSpecialWeapon )
        {
            
SetHamParamFloat(4damage g_weapon_damage )
            return 
true
        
}
    }
    return 
false


PHP Code:
    register_event("CurWeapon","curWeaponEvent","be","1=1"
PHP Code:
/**
 * This message updates the numerical magazine ammo count and the corresponding ammo 
 *    type icon on the HUD.
 */
public curWeaponEvent(id)
{
    
weapPickupEvent(id)

    return 
PLUGIN_HANDLED

PHP Code:
/**
 * When a player pickup a weapon, its change the model view to the Golden Weapon.
 */
public weapPickupEvent(id)
{
    new 
szWeapID read_data(2)

    if( 
g_whichSpecialWeapon[id] == szWeapID )
    {
        switch( 
szWeapID )
        {
            case 
CSW_AK47
            {
                
set_pev(idpev_viewmodel2AK47_V_MODEL)
                
set_pev(idpev_weaponmodel2AK47_P_MODEL)
            } 
            case 
CSW_M4A1
            {
                
set_pev(idpev_viewmodel2M4A1_V_MODEL)
                
set_pev(idpev_weaponmodel2M4A1_P_MODEL)
            } 
            case 
CSW_MP5NAVY
            {
                
set_pev(idpev_viewmodel2MP5_V_MODEL)
                
set_pev(idpev_weaponmodel2MP5_P_MODEL)
            }
        }
    }
    return 
PLUGIN_HANDLED

Is it a performance waste? How can I do better?

Such thing higher the server client's ping?

How can I measure my server 'ping' before and after active this plugin?

I was coping & rewriting from two others plugins who does the same thing, because: 1) the first one crashes my server and i could not understand why, when reading its code, which one I did not like because uses big stuff to make damage. 2) the second one is unapproved but don't uses the big stuff at the first one.

Silver Weapons (the first one)
Golden Ak (banned author)

High performance is what I am trying to archive. By now I am reading Optimizing Plugins (AMX Mod X Scripting).

Here is attached the plugin. It's fully working, but it does not have its low priority requisites, like customizable server variables.
Attached Files
File Type: sma Get Plugin or Get Source (GoldenWeapons.sma - 672 views - 8.5 KB)
File Type: zip models.zip (3.08 MB, 75 views)
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 07-26-2016 at 20:05. Reason: Added weapons models.
addons_zz 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:16.


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