Raised This Month: $ Target: $400
 0% 

Help with a Cvar plz!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zapdos1
BANNED
Join Date: Jul 2009
Location: Chile - La Serena
Old 12-22-2009 , 16:27   Help with a Cvar plz!
Reply With Quote #1

well, my problem is, what i wrote in console "amx_boxing 0" to disable the plugin, but it still enable, what i have to do?

PHP Code:
#include <amxmodx> 
#include <hamsandwich> 
#include <fakemeta>
#include <engine> 

// Sobre comprar 
new g_szBuyCommands[][] =  

    
"usp""glock""deagle""p228""elites""fn57""m3""xm1014""mp5""tmp""p90""mac10""ump45""ak47",  
    
"galil""famas""sg552""m4a1""aug""scout""awp""g3sg1""sg550""m249""vest""vesthelm""flash""hegren"
    
"sgren""defuser""nvgs""shield""primammo""secammo""km45""9x19mm""nighthawk""228compact""12gauge"
    
"autoshotgun""smg""mp""c90""cv47""defender""clarion""krieg552""bullpup""magnum""d3au1""krieg550"
    
"buyammo1""buyammo2" 



// Sobre cvars 
new boxing_enableboxing_blockbuypointer_restart

new bool:g_bEnabledg_iMaxPlayersg_iSyncHudg_msgCurWeapon

// Arma
new VIEW_MODEL[]    = "models/boxing_mod/v_knife.mdl" 
new PLAYER_MODEL[]    = "models/boxing_mod/p_knife.mdl" 
new WORLD_MODEL[]    = "models/boxing_mod/w_knife.mdl"

new const boxing_sounds[][] =
{
    
"boxing_sound/boxing_deploy1.wav",    
    
"boxing_sound/boxing_hit1.wav",    
    
"boxing_sound/boxing_hit2.wav",    
    
"boxing_sound/boxing_hit3.wav",    
    
"boxing_sound/boxing_hit4.wav",    
    
"boxing_sound/boxing_hitwall1.wav",
    
"boxing_sound/boxing_slash1.wav",    
    
"boxing_sound/boxing_slash2.wav",    
    
"boxing_sound/boxing_stab.wav"    
}

new const 
oldknife_sounds[][] =
{
    
"weapons/knife_deploy1.wav",    // Deploy Sound
    
"weapons/knife_hit1.wav",    // Hit 1
    
"weapons/knife_hit2.wav",    // Hit 2
    
"weapons/knife_hit3.wav",    // Hit 3
    
"weapons/knife_hit4.wav",    // Hit 4
    
"weapons/knife_hitwall1.wav",    // Hit Wall
    
"weapons/knife_slash1.wav",    // Slash 1
    
"weapons/knife_slash2.wav",    // Slash 2
    
"weapons/knife_stab.wav"    // Stab
}

public 
plugin_init() 

    
// Plugin info
    
register_plugin("Boxing Mod""1.0""Zapdos1"
    
    
// Cvars 
    
boxing_enable register_cvar("amx_boxing","1"
    
boxing_blockbuy register_cvar("amx_boxing_block_buy""1"
    
pointer_restart get_cvar_pointer("sv_restart")
    
    
// Lang 
    
register_dictionary("boxing.txt")   
    
    
// Events
    
register_event("CurWeapon""event_CurWeapon""be","1=1")
    
register_event("HLTV""event_RoundStart""a""1=0""2=0")
    
    
// Fakemeta fwds.
    
register_forward(FM_SetModel"fw_SetModel")
    
register_forward(FM_EmitSound"fw_EmitSound")
    
    
// Hamsandwich fwds.
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")

    for (new 
isizeof g_szBuyCommandsi++) 
        
register_clcmd(g_szBuyCommands[i], "BlockBuyCommands"
    
    
g_bEnabled false
    g_iMaxPlayers 
get_maxplayers()
    
g_iSyncHud CreateHudSyncObj()
    
g_msgCurWeapon get_user_msgid("CurWeapon")


public 
plugin_precache() 
{    
    
precache_model(VIEW_MODEL)     
    
precache_model(PLAYER_MODEL
    
precache_model(WORLD_MODEL)
    
    for(new 
0sizeof boxing_soundsi++)
    
precache_sound(boxing_sounds[i])
}

public 
BlockBuyCommands() 

    if (
get_pcvar_num(boxing_blockbuy) && get_pcvar_num(boxing_enable) && g_bEnabled
        return 
PLUGIN_HANDLED
        
    return 
PLUGIN_CONTINUE
}  

public 
event_RoundStart() 

    if (
get_pcvar_num(boxing_enable) && !g_bEnabled)
    {
        
// Restart
        
set_pcvar_num(pointer_restart5)
        
        
// Hud message
        
set_hudmessage(255255255, -1.0, -1.006.012.0
        
ShowSyncHudMsg(0g_iSyncHud"[CS Boxing] - Have Fun!!!"
        
        
// Messages
        
client_print(0print_chat"[AMXX] %L"LANG_PLAYER"WELCOME_MESSAGE");  
        
client_print(0print_chat"[AMXX] %L"LANG_PLAYER"CLIENT_MESSAGE")
        
        
// Game enabled
        
g_bEnabled true
        
        
for(new 1<= g_iMaxPlayersi++)
        {
            if(
is_user_connected(i))
                
reset_user_knife(i)
        }
    }


public 
event_CurWeapon(id
{     
    new 
weaponID read_data(2
    
    if(
weaponID == CSW_KNIFE)
    {
        
entity_set_string(idEV_SZ_viewmodelVIEW_MODEL)   
        
entity_set_string(idEV_SZ_weaponmodelPLAYER_MODEL
    }
    else
        
reset_user_knife(id)
    
    return 
PLUGIN_CONTINUE 


public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_bits)
{            
    if(
damage_bits DMG_SLASH)
    {
        
SetHamParamFloat(4damage 2.0
        return 
HAM_HANDLED  
    
}
    
    return 
HAM_IGNORED
}

public 
fw_SetModel(entitymodel[])
{
    if(!
is_valid_ent(entity)) 
        return 
FMRES_IGNORED
    
    
if(!equali(model"models/w_knife.mdl")) 
        return 
FMRES_IGNORED
    
    
static className[33]
    
entity_get_string(entityEV_SZ_classnameclassName32
    
    if(
equal(className"weaponbox") || equal(className"armoury_entity") || equal(className"grenade"))
    {
        
entity_set_model(entityWORLD_MODEL
        return 
FMRES_SUPERCEDE
    
}
    
    return 
FMRES_IGNORED


stock reset_user_knife(id// by metal :$
{         
    
engclient_cmd(id"weapon_knife")
    
emessage_begin(MSG_ONEg_msgCurWeapon_id)
    
ewrite_byte(1// active
    
ewrite_byte(CSW_KNIFE// weapon
    
ewrite_byte(-1// clip
    
emessage_end()
}  

public 
fw_EmitSound(idchannel, const sound[])
{
    if(!
is_user_connected(id))
        
    for(new 
0sizeof boxing_soundsi++)
    {
        if(
equal(soundoldknife_sounds[i]))
        {
            
emit_sound(idchannelboxing_sounds[i], 1.0ATTN_NORM0PITCH_NORM)
            return 
FMRES_SUPERCEDE
        
}
    }
            
    return 
FMRES_IGNORED

(sorry for my english)
Zapdos1 is offline
Old 12-22-2009, 16:43
ProIcons
This message has been deleted by ProIcons. Reason: Wrong
Zapdos1
BANNED
Join Date: Jul 2009
Location: Chile - La Serena
Old 12-22-2009 , 16:48   Re: Help with a Cvar plz!
Reply With Quote #2

Quote:
Error: Undefined symbol "varz" on line 131
Warning: Expression has no effect on line 131
Error: Expected token: ";", but found ")" on line 131
Error: Invalid expression, assumed zero on line 131
Error: Too many error messages on one line on line 131

Compilation aborted.
4 Errors.
PHP Code:

register_cvar
("amx_boxing","1")

public 
event_RoundStart() 
{
    new 
vars[2]
    
get_cvar_string("amx_boxing"varz1)
    if (
equal(vars,"1") && !g_bEnabled)
 
        
// Restart
        
set_pcvar_num(pointer_restart5)
        
        
// Hud message
        
set_hudmessage(255255255, -1.0, -1.006.012.0
        
ShowSyncHudMsg(0g_iSyncHud"[CS Boxing] - Have Fun!!!"
        
        
// Messages
        
client_print(0print_chat"[AMXX] %L"LANG_PLAYER"WELCOME_MESSAGE");  
        
client_print(0print_chat"[AMXX] %L"LANG_PLAYER"CREDIT_MESSAGE")
        
        
// Game enabled
        
g_bEnabled true
        
        
for(new 1<= g_iMaxPlayersi++)
        {
            if(
is_user_connected(i))
                
reset_user_knife(i)
        }

Zapdos1 is offline
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 12-22-2009 , 16:49   Re: Help with a Cvar plz!
Reply With Quote #3

new vars[2]
get_cvar_string("amx_boxing", varz, 1)

in cvar_string you have varz it must be vars

get_cvar_string("amx_boxing", vars, 1);

and a ; in the end
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 12-22-2009 , 16:52   Re: Help with a Cvar plz!
Reply With Quote #4

after you change the value you have to restart the round...

You have it on round start the only time you actully have the plugin check if its on or off.


Also remove the buy zones dont block buy commands just remove it completely that way they know that they cannot buy
PHP Code:
#define fm_cs_set_user_nobuy(%1)    set_pdata_int(%1, 235, get_pdata_int(%1, 235) & ~(1<<0) )

public plugin_cfg()
{
    
register_message(get_user_msgid("StatusIcon") , "Message_StatusIcon");


public 
Message_StatusIcon(iMsgIdMSG_DESTid)
{
    static 
szIcon[5];
    
get_msg_arg_string(2szIcon4);
    if( 
szIcon[0] == 'b' && szIcon[2] == 'y' && szIcon[3] == 'z' )
    {
        if( 
get_msg_arg_int(1) )
        {
            
fm_cs_set_user_nobuy(id);
            return 
PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_CONTINUE

Doc-Holiday is offline
Old 12-22-2009, 16:59
Zapdos1
This message has been deleted by Zapdos1.
Zapdos1
BANNED
Join Date: Jul 2009
Location: Chile - La Serena
Old 12-22-2009 , 17:13   Re: Help with a Cvar plz!
Reply With Quote #5

Quote:
Originally Posted by ProIcons View Post
new vars[2]
get_cvar_string("amx_boxing", varz, 1)

in cvar_string you have varz it must be vars

get_cvar_string("amx_boxing", vars, 1);

and a ; in the end
Quote:
Originally Posted by NcB_Sav View Post
after you change the value you have to restart the round...

You have it on round start the only time you actully have the plugin check if its on or off.
so, what i have to do? :S

PHP Code:

register_cvar
("amx_boxing","1")

public 
enable(id)
{
    new 
vars[2]
    
get_cvar_string("amx_boxing"vars1);
    if (
equal(vars,"1") && !g_bEnabled)

????????
Zapdos1 is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 12-22-2009 , 19:30   Re: Help with a Cvar plz!
Reply With Quote #6

why are you using a string for a num cvar?


string would be


register_cvar("amx_string", "My Dog Died")
Doc-Holiday is offline
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 12-23-2009 , 05:00   Re: Help with a Cvar plz!
Reply With Quote #7

get_cvar_num

__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons 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 04:07.


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