AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Kevlar v helm (https://forums.alliedmods.net/showthread.php?t=110485)

A.B. 11-30-2009 01:01

Kevlar v helm
 
I'm trying to pull kevlarvhelm cvar, however it doesn't seem to work.
get_user_armor is the only thing that I got to compile successfully.

What am I doing wrong.

Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
 
#define ADMIN_LEVEL ADMIN_LEVEL_A
 
new cvar, num_of_armor
 
public plugin_init()
{
    register_event("ResetHUD", "hook_resethud", "be")
 
    cvar = register_cvar("armor_enabled", "1")
    num_of_armor = register_cvar("admin_armor", "200")
}
 
 
public hook_resethud(id)
{
    if(get_pcvar_num(cvar) < 1)
    return PLUGIN_CONTINUE
 
    if(get_user_flags(id) & ADMIN_LEVEL)
    set_user_armor(id, get_user_armor(id) + get_pcvar_num(num_of_armor))
 
    return PLUGIN_CONTINUE
}

P.S.
Is it possible to assign a specific amount of gravity to a target?

ConnorMcLeod 11-30-2009 01:22

Re: Kevlar v helm
 
Use cs_[g/s]et_user_armor : http://www.amxmodx.org/funcwiki.php?...rmor&go=search

A.B. 11-30-2009 02:07

Re: Kevlar v helm
 
My miserable brain can't hold that much info. Yeah, I tried it, yet it looks like I'm still missing something. Getting errors.

ConnorMcLeod 11-30-2009 02:09

Re: Kevlar v helm
 
Just add the admin check to this: http://forums.alliedmods.net/showthread.php?p=806660

Excalibur.007 11-30-2009 02:41

Re: Kevlar v helm
 
Are you trying to set admin armor to 200 at round start? Or your trying to set admin armor to amount of armor has now + num_of_armor?

A.B. 11-30-2009 04:29

Re: Kevlar v helm
 
Got it.
<3

addicted2sex 11-30-2009 10:34

Re: Kevlar v helm
 
Dont use the resetHUD event for that cuz it's exploitable...

DarkGod 11-30-2009 10:43

Re: Kevlar v helm
 
It's only for admins any way so I don't think he cares if it'll be called a few more times than expected.


All times are GMT -4. The time now is 13:41.

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