AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   about armor (https://forums.alliedmods.net/showthread.php?t=153316)

Fry! 03-21-2011 15:05

about armor
 
Hey guys,

I havent been here for ages, and i have forgotten all, so i created small plugin on spawn which includes extra lil bit of hp, armor and last but not least speed, the problem is that armor doesn't take damage at all, it's feels like you dont have. -- i'm sorry i have to learn it all over again. :/ here is code

PHP Code:

public fwHamPlayerSpawnPost(player)
{
    if (
is_user_alive(player))
    {
        new 
g_currentArmor pev(playerpev_armorvalue)
        new 
Float:g_newMaxSpeed fm_get_user_maxspeed(player) + 50.0
        set_pev
(playerpev_healthfloat(135))
        
set_pev(playerpev_maxspeedg_newMaxSpeed)
        
set_pev(playerpev_armorvalueg_currentArmor float(200))
    }
    
    return 
PLUGIN_CONTINUE
}

public 
fw_PlayerPreThink(player)
{
    new 
Float:g_newMaxSpeed fm_get_user_maxspeed(player) + 50.0
        
    set_pev
(playerpev_maxspeedg_newMaxSpeed)



how to fix it? Should i add Ham take damage also with armor?

and last question how can i create function when you can't buy armor anymore (i mean which is given on spawn) - like if you have one already, cause just bought armor will overwrite extra armor.

Thanks in advance.

schmurgel1983 03-21-2011 18:40

Re: about armor
 
about your armor => engine => armor is simple
because u set only the armorvalue but the engine don't know the player as a real armor.

<cstrike>
PHP Code:

enum CsArmorType {
    
CS_ARMOR_NONE 0// no armor
    
CS_ARMOR_KEVLAR 1// armor
    
CS_ARMOR_VESTHELM // armor and helmet
};
/* Use this instead of fun's set_user_armor.
 * Appropriate message to update client's HUD will be sent if armortype is kevlar or vesthelm.
 */
native cs_set_user_armor(indexarmorvalueCsArmorType:armortype);

samplecs_set_user_armor(id100_:CS_ARMOR_VESTHELM

<fakemeta>
PHP Code:

enum
{
    
FM_CS_ARMOR_NONE 0// no armor
    
FM_CS_ARMOR_KEVLAR// armor
    
FM_CS_ARMOR_VESTHELM // armor and helmet
}

stock fm_cs_set_user_armor(idvaluetype)
{
    
set_pdata_int(id112type5)
    
    
set_pev(idpev_armorvaluefloat(value))
    
    if (
type FM_CS_ARMOR_NONE)
    {
        static 
msgArmorType
        
if (msgArmorType || (msgArmorType get_user_msgid("ArmorType")))
        {
            
emessage_begin(MSG_ONE_UNRELIABLEmsgArmorType_id)
            
ewrite_byte(type-1)
            
emessage_end()
        }
    }
}

samplefm_cs_set_user_armor(id100FM_CS_ARMOR_VESTHELM


Fry! 03-22-2011 02:22

Re: about armor
 
Thanks man! I appreciate that. I'm gonna check it when i get back to home.

Fry! 03-22-2011 17:01

Re: about armor
 
Thanks dude, it work now! ;)


All times are GMT -4. The time now is 15:16.

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