|
Veteran Member
Join Date: Dec 2008
Location: Portugal
|
04-27-2009
, 08:22
Re: Spawn with Armor
|
#23
|
Quote:
Originally Posted by ConnorMcLeod
Use fakemeta instead of cs_set_user_amor and you have to use 2 natives, 1 to set armor, another one to set armor type, so cstrike native should be 2 times faster or even more.
I don't even consider you need 3 more natives to send a ArmorType message.
-edit-
Seems that i was wrong, when you don't send a message, FM is faster, but you actually need to send the message.
PHP Code:
public prof( id ) { for(new i; i<10000; i++) { cs_set_user_armor(id, 100, CS_ARMOR_VESTHELM) fm_set_user_armor(id, 100.0, 2) fm_cs_set_user_armor(id, 100.0, 2) } return PLUGIN_HANDLED }
fm_set_user_armor(id, Float:amount, type) { set_pev(id, pev_armorvalue, amount) set_pdata_int(id, 112, type) }
fm_cs_set_user_armor(id, Float:amount, type) { set_pev(id, pev_armorvalue, amount) set_pdata_int(id, 112, type)
if ( type ) { message_begin( MSG_ONE_UNRELIABLE , gmsgArmorType , _ , id ) write_byte( type == 2 ? 1 : 0 ) message_end(); } }
Code:
type | name | calls | time / min / max
-------------------------------------------------------------------
n | register_plugin | 1 | 0.000001 / 0.000001 / 0.000001
n | register_clcmd | 1 | 0.000006 / 0.000006 / 0.000006
n | get_user_msgid | 1 | 0.000001 / 0.000001 / 0.000001
n | cs_set_user_armor | 10000 | 0.006480 / 0.000001 / 0.000080
n | set_pev | 20000 | 0.003963 / 0.000000 / 0.000001
n | set_pdata_int | 20000 | 0.003909 / 0.000000 / 0.000068
n | message_begin | 10000 | 0.002382 / 0.000000 / 0.000001
n | write_byte | 10000 | 0.002153 / 0.000000 / 0.000000
n | message_end | 10000 | 0.003001 / 0.000000 / 0.000023
p | plugin_init | 1 | 0.000001 / 0.000001 / 0.000001
p | prof | 1 | 0.005654 / 0.005654 / 0.005654
f | fm_set_user_armor | 10000 | 0.005802 / 0.000001 / 0.000046
f | fm_cs_set_user_armor | 10000 | 0.011227 / 0.000001 / 0.000045
0 natives, 0 public callbacks, 2 function calls were not executed.
Summary
Code:
type | name | calls | time / min / max
-------------------------------------------------------------------
n | cs_set_user_armor | 10000 | 0.006480 / 0.000001 / 0.000080
f | fm_set_user_armor | 10000 | 0.005802 / 0.000001 / 0.000046
f | fm_cs_set_user_armor | 10000 | 0.011227 / 0.000001 / 0.000045
0 natives, 0 public callbacks, 2 function calls were not executed.
|
There is nothing wrong. You have to add the time taken by the functions called inside fm_set_user_armor. So you have to profile just one of " fm_set..." or " fm_cs_set..." and add the time taken by set_pev and set_pdata_int
Based in your profile results it would be approximately:
fm_set_user_armor + set_pev/2 + set_pdata_int/2 = 0.005802 + 0.003963/2 + 0.003909/2 = 0.005801 + 0.001982 + 0.001954 = 0.009737
__________________
Last edited by joaquimandrade; 04-27-2009 at 08:28.
|
|
|
|