Raised This Month: $ Target: $400
 0% 

Chat On Off


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
notahacker
Member
Join Date: Jan 2015
Old 04-13-2016 , 11:07   Chat On Off
Reply With Quote #1

Hi Mates.. I currently have a plugin that disables the chat (cs 1.6).

Code:
public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_clcmd( "say", "Cmd_Say" );
    
}

public Cmd_Say()
    return PLUGIN_HANDLED_MAIN;
I want to register a command, For example, amx_nochat. when i put "amx_nochat 1", the plugin activates. and when i put "amx_nochat 0", the plugin disactivates and chat is on once again.

i've been trying to edit the plugin, but i'm failing.

Can any mate help please? Or just give me an example. i've been looking at other plugins but i still can't do it.

Thankss mates
notahacker is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 04-13-2016 , 11:13   Re: Chat On Off
Reply With Quote #2

PHP Code:
new cv_chat

public plugin_init() 
{
    
cv_chat register_cvar("amx_chat_enable""1")
    
register_plugin(PLUGINVERSIONAUTHOR)     
    
register_clcmd"say""Cmd_Say" 
}  

public 
Cmd_Say()
{
    if(
get_pcvar_num(cv_chat) == 0)
        return 
PLUGIN_HANDLED_MAIN

Untested. But it should work.
__________________

Last edited by gabuch2; 04-13-2016 at 11:32.
gabuch2 is offline
notahacker
Member
Join Date: Jan 2015
Old 04-13-2016 , 11:29   Re: Chat On Off
Reply With Quote #3

Thank you very much.. But these errors


Warning: Possibly unintended assignment on line 19
Error: Must be lvalue (non-constant) on line 19
Warning: Expression has no effect on line 19
Error: Expected token: ";", but found ")" on line 19
Error: Invalid expression, assumed zero on line 19
Error: Too many error messages on one line on line 19


line 19 is
Code:
if(get_pcvar_num(cv_chat) = 0)



Quote:
Originally Posted by Shattered Heart Lynx View Post
PHP Code:
new cv_chat

public plugin_init() 
{
    
cv_chat register_cvar("amx_chat_enable""1")
    
register_plugin(PLUGINVERSIONAUTHOR)     
    
register_clcmd"say""Cmd_Say" 
}  

public 
Cmd_Say()
{
    if(
get_pcvar_num(cv_chat) = 0)
        return 
PLUGIN_HANDLED_MAIN

Untested. But it should work.
notahacker is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 04-13-2016 , 11:31   Re: Chat On Off
Reply With Quote #4

My bad

= is ==, just edited my post above
__________________

Last edited by gabuch2; 04-13-2016 at 11:32.
gabuch2 is offline
notahacker
Member
Join Date: Jan 2015
Old 04-13-2016 , 11:47   Re: Chat On Off
Reply With Quote #5

Perfect. The == always gets us

Thanks mate
notahacker is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 04-13-2016 , 12:37   Re: Chat On Off
Reply With Quote #6

Use handled without main, plugins down won't be called.
Here's:
PHP Code:

new cv_chat

public plugin_init() 
{
    
cv_chat register_cvar("amx_chat_enable""1")
    
register_plugin(PLUGINVERSIONAUTHOR)     
    
register_clcmd"say""Cmd_Say" 
}  

public 
Cmd_Say()
{
    if(!
get_pcvar_num(cv_chat))
        return 
PLUGIN_HANDLED

siriusmd99 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 18:42.


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