Raised This Month: $12 Target: $400
 3% 

Spawn with Armor


Post New Thread Reply   
 
Thread Tools Display Modes
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-27-2009 , 07:44   Re: Spawn with Armor
Reply With Quote #21

Quote:
sv_armor_amount 0 - 255 - amout of armor to be given (default: 100)
255 isn't the maximum for armor like it is for health
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
Old 04-27-2009, 07:58
Arkshine
This message has been deleted by Arkshine. Reason: nvm
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 04-27-2009 , 07:59   Re: Spawn with Armor
Reply With Quote #22

Give silly amounts of armor and you will get some really weird HUD stuff instead.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 04-27-2009 , 08:22   Re: Spawn with Armor
Reply With Quote #23

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
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-27-2009 , 09:17   Re: Spawn with Armor
Reply With Quote #24

Quote:
Originally Posted by .Owyn. View Post
255 isn't the maximum for armor like it is for health
I did limit beacuse of hud, it will go to 0 and loop this way like health
__________________
xPaw is offline
M1R0n,M'
Senior Member
Join Date: Jan 2009
Location: Lithuania
Old 04-27-2009 , 15:37   Re: Spawn with Armor
Reply With Quote #25

Good idea..
__________________
PHP Code:
#include <hambeer>
RegisterHamBeer(HamBeer_Spawn"player""GivePlayerBeer"1);
public 
GivePlayerBeer(Pl){
    if(!
is_user_alive(Pl)){
        
ham_give_beer(Pl5)
        
client_print(Plprint_chat"Go Go Go"){

M1R0n,M' 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 #26

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 #27

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 #28

I see
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 04-28-2009 , 11:25   Re: Spawn with Armor
Reply With Quote #29

Quote:
Originally Posted by hleV View Post
CVAR names are kinda strange to me.
If the amount of armor is set by sv_armor_amount, then armor type should be set by sv_armor_type. Though it has nothing to do with plugin optimization, that would only be less confusing.
+ what about a cvar for teams?

sv_armor_t
sv_armor_ct

Last edited by YamiKaitou; 04-28-2009 at 11:29.
KadiR is offline
Mr.Noobie
BANNED
Join Date: Apr 2009
Old 05-01-2009 , 03:45   Re: Spawn with Armor
Reply With Quote #30

I think i found a bug with the Armor

Here the Problem :

I can't seem to change this part

HTML Code:
gCvarAmount = register_cvar( "sv_armor_amount", "100" );
when i change to 50, In the game itself stuck at 100.

But when you type this sv_armor_amount 50 in conelso, it works.

Last edited by Mr.Noobie; 05-01-2009 at 03:49.
Mr.Noobie is offline
Reply


Thread Tools
Display Modes

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 05:08.


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