AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   what is more efficient (https://forums.alliedmods.net/showthread.php?t=220885)

avril-lavigne 07-15-2013 11:52

what is more efficient
 
PHP Code:

    new HPP1 get_user_health(id)
       new 
APP1 get_user_armor(id)
       static 
iWpnIDiClip
       iWpnID 
get_pdata_cbase(idm_pActiveItem5)
       
iClip cs_get_weapon_ammo(iWpnID
   
       
set_hudmessage2002552550.010.9420.14.00.020.02, -)     
       
ShowSyncHudMsgidg_MsgSync"%d       %d          %d" iClipHPP1APP1 


what is better . make new APP1 = get_user_armor(id) or
just use ShowSyncHudMsg( id, g_MsgSync, "%d %d %d" , iClip, get_user_health(id), get_user_armor(id))[/PHP]

Arkshine 07-15-2013 12:09

Re: what is more efficient
 
Trivial. But if there is no point to create a var, don't do it. I would assume that's something it will be called often and it won't help readability, so creating a variable is unnecessary ; even if trivial, you still avoid some memory/CPU operations.


All times are GMT -4. The time now is 06:25.

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