Raised This Month: $ Target: $400
 0% 

[SOLVED]to add cvars


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-28-2009 , 11:58   Re: [HOW]to add cvars
Reply With Quote #1

Pcvars are faster than normal cvars...

Well, the code should be something like this, but i am not sure:

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <csx>
#include <fun>

const g_GrenadeNum 5

new p_Enable

public plugin_init()
{
    
register_plugin("HE Only mode""0.1""AlliedModder")
    
register_event("CurWeapon""event_he_off""be""1=0""2=4")
    
p_Enable register_cvar("amx_he_only""0")
}

public 
event_he_off(id)
{
    if (!
get_pcvar_num(p_Enable) )
        return 
PLUGIN_HANDLED
    
    engclient_cmd
(id"weapon_hegrenade")
    
client_print(idprint_center"HE only mode is on. You can't swith your weapons!")
}

public 
grenade_throw(id greindex wId 
{
    if ( 
wId == CSW_HEGRENADE )
        
cs_set_user_bpammo(id CSW_HEGRENADE g_GrenadeNum )

But about the /hemode, that is a command, not cvar... to do this i think you have to use bools or condition operators maybe...
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...

Last edited by Alucard^; 08-28-2009 at 15:34.
Alucard^ is offline
Send a message via Skype™ to Alucard^
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 08-28-2009 , 13:37   Re: [HOW]to add cvars
Reply With Quote #2

Quote:
Originally Posted by Alucard^ View Post
PHP Code:
    if (!get_pcvar_num(p_Enable) )
        return 
PLUGIN_HANDLED 
__________________
IneedHelp 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 15:11.


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