Raised This Month: $ Target: $400
 0% 

Help with Cvars


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
extreem
Member
Join Date: Apr 2011
Location: Czech Republick
Old 04-11-2011 , 15:19   Help with Cvars
Reply With Quote #1

Hi, I have problem with plugin.
I want make plugin say /forum with cvar ON or OFF plugin
My code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "say_forum"
#define VERSION "1.0"
#define AUTHOR "Extreem"


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /forum","showmotd","Show Motd")
register_clcmd("say_team /forum","showmotd","Show Motd")
forum_Stranky = register_cvar("forum_stranky","1")
}
public showmotd (id, level, cid){
if (get_cvar_num(forum_Stranky == 1))
return PLUGIN_HANDLED;
show_motd(id,"forum.txt")
return PLUGIN_CONTINUE;
}
I have here many errors because I'm only learn
extreem is offline
Send a message via Skype™ to extreem
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 04-11-2011 , 15:56   Re: Help with Cvars
Reply With Quote #2

when you post a code use PHP tags
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "say_forum"
#define VERSION "1.0"
#define AUTHOR "Extreem"

new forum_Stranky // <- you forgot to make a cvar pointer

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /forum","showmotd"ADMIN_KICK"Show Motd"// Access To Command ADMIN_KICK
    
register_clcmd("say_team /forum","showmotd"ADMIN_KICK"Show Motd"// Access To Command ADMIN_KICK
    
    
forum_Stranky register_cvar("forum_stranky","1")
}
public 
showmotd (idlevelcid)
{
    if(!
cmd_access(idlevelcid1)) // check if has access to command ( ADMIN_KICK )
        
return PLUGIN_HANDLED
    
    
// if (get_cvar_num(forum_Stranky == 1)) <- this is yours
    
if(get_pcvar_num(forum_Stranky) == 0// <- should be like this use pcvar       
        
return PLUGIN_HANDLED;
    
show_motd(id,"forum.txt")
    return 
PLUGIN_CONTINUE;

__________________

Last edited by vato loco [GE-S]; 04-11-2011 at 16:05.
vato loco [GE-S] is offline
extreem
Member
Join Date: Apr 2011
Location: Czech Republick
Old 04-11-2011 , 16:04   Re: Help with Cvars
Reply With Quote #3

vato loco [GE-S], Thank You Man. You halped me
extreem is offline
Send a message via Skype™ to extreem
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 04-11-2011 , 16:06   Re: Help with Cvars
Reply With Quote #4

you're welcome
__________________
vato loco [GE-S] 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 20:03.


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