Raised This Month: $ Target: $400
 0% 

creating a cvar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zapdos1
BANNED
Join Date: Jul 2009
Location: Chile - La Serena
Old 08-15-2009 , 19:03   Re: creating a cvar
Reply With Quote #1

PHP Code:
new ra_enable 

public plugin_init() 
{
    
ra_enable register_cvar("r_enable""0")
}

public 
enable(id)
{
    if(
get_pcvar_num(ra_enable) )
         
ExecuteHamB(Ham_Spawnid)


Last edited by Zapdos1; 08-15-2009 at 19:08.
Zapdos1 is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-16-2009 , 01:10   Re: creating a cvar
Reply With Quote #2

I don't know how much do you know about what that code you wrote does because you didn't say anything else... but I am going to write a complete plugin using cvars just as an example:
PHP Code:
#include <amxmodx>
#include <hamsandwich>
 
new pcvar_enable
new pcvar_saywhat
 
public plugin_init()
{
    
register_plugin("Say something on spawn""sample""-")
 
    
pcvar_enable register_cvar("amx_sayonspawn""1")
    
pcvar_saywhat register_cvar("amx_saywhat""Hello :-h")
 
    
RegisterHam(Ham_Spawn"player""fwHam_playerSpawn"1)
}
 
public 
fwHam_playerSpawn(id)
{
   if(
get_pcvar_num(pcvar_enable))
   {
        new 
szSay[96]
 
        
get_pcvar_string(pcvar_saywhatszSaycharsmax(szSay))
 
        
client_print(idprint_chat"A message on spawn: %s"szSay)
   }

__________________

Last edited by Hunter-Digital; 08-16-2009 at 16:32. Reason: shortened the array
Hunter-Digital 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:06.


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