AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Won't add (https://forums.alliedmods.net/showthread.php?t=107444)

DoviuX 10-26-2009 16:57

Won't add
 
EveryThing compiles but gives 254 ammo.

In Sma :

PHP Code:

new M4A1AMMO
new AK47AMMO
new AWPAMMO
new DEAGLEAMMO

    M4A1AMMO 
register_cvar("rm_m4a1""150" )
    
AK47AMMO register_cvar("rm_ak47""150" )
    
AWPAMMO register_cvar("rm_awp""60" )
    
DEAGLEAMMO register_cvar("rm_deagle""100" )


public 
plugin_cfg()
{
    
// Get configs dir
    
new cfgdir32 ]
    
get_configsdircfgdircharsmaxcfgdir ) )

    
// Execute config file (haha.cfg)
    
server_cmd"exec %s/haha.cfg"cfgdir )
}

        
cs_set_user_bpammoidCSW_M4A1M4A1AMMO )
        
cs_set_user_bpammoidCSW_AK47AK47AMMO )
        
cs_set_user_bpammoidCSW_AWPAWPAMMO )
        
cs_set_user_bpammoidCSW_DEAGLEDEAGLEAMMO 

In Cfg:

Code:

rm_m4a1        "150"
rm_ak47                "150"               
rm_awp                "60"               
rm_deagle        "100"


Emp` 10-26-2009 17:04

Re: Won't add
 
register_cvar returns a pointer to the cvar, not the value of the cvar.

You want to use the native get_pcvar_num with the corresponding cvar pointer.


All times are GMT -4. The time now is 17:37.

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