Raised This Month: $ Target: $400
 0% 

Spawn with Armor


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-16-2009 , 11:51   Re: Spawn with Armor
Reply With Quote #1

Quote:
Originally Posted by Sn!ff3r View Post
Anyone still use it? ;)
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 profid )
{
    for(new 
ii<10000i++)
    {
        
cs_set_user_armor(id100CS_ARMOR_VESTHELM)
        
fm_set_user_armor(id100.02)
        
fm_cs_set_user_armor(id100.02)
    }
    return 
PLUGIN_HANDLED
}

fm_set_user_armor(idFloat:amounttype)
{
    
set_pev(idpev_armorvalueamount)
    
set_pdata_int(id112type)
}

fm_cs_set_user_armor(idFloat:amounttype)
{
    
set_pev(idpev_armorvalueamount)
    
set_pdata_int(id112type)

    if ( 
type )
    {
        
message_beginMSG_ONE_UNRELIABLE gmsgArmorType id )
        
write_bytetype == )
        
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.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-16-2009 at 12:04.
ConnorMcLeod is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 04-27-2009 , 08:22   Re: Spawn with Armor
Reply With Quote #2

Quote:
Originally Posted by ConnorMcLeod View Post
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 profid )
{
    for(new 
ii<10000i++)
    {
        
cs_set_user_armor(id100CS_ARMOR_VESTHELM)
        
fm_set_user_armor(id100.02)
        
fm_cs_set_user_armor(id100.02)
    }
    return 
PLUGIN_HANDLED
}

fm_set_user_armor(idFloat:amounttype)
{
    
set_pev(idpev_armorvalueamount)
    
set_pdata_int(id112type)
}

fm_cs_set_user_armor(idFloat:amounttype)
{
    
set_pev(idpev_armorvalueamount)
    
set_pdata_int(id112type)

    if ( 
type )
    {
        
message_beginMSG_ONE_UNRELIABLE gmsgArmorType id )
        
write_bytetype == )
        
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.
joaquimandrade is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-27-2009 , 16:15   Re: Spawn with Armor
Reply With Quote #3

Quote:
Originally Posted by joaquimandrade View Post
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
I guess fm_set_user_armor already include set_pev + set_pdata.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 04-27-2009 , 16:16   Re: Spawn with Armor
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod View Post
I guess fm_set_user_armor already include set_pev + set_pdata.
Look at:

Quote:
p | prof | 1 | 0.005654 / 0.005654 / 0.005654
It would have to include all the others
__________________
joaquimandrade is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-27-2009 , 16:20   Re: Spawn with Armor
Reply With Quote #5

I see
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 23:49.


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