AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   disabling say or say_team (https://forums.alliedmods.net/showthread.php?t=25896)

wonsae 03-22-2006 22:47

disabling say or say_team
 
how would i disable it so for anyone so when they say something it comes out as you were muted you may not speak or something

v3x 03-22-2006 23:16

Variables.
Code:
#include <amxmodx> new bool:cant_type[33]; public plugin_init() {   register_clcmd("say" , "hook_say");   register_clcmd("say_team" , "hook_say"); } public client_connect(id) {   cant_type[id] = false; } public hook_say(id) {   if(cant_type[id]) {     return PLUGIN_HANDLED;   }   return PLUGIN_CONTINUE; }

Now somewhere along the line you want to set cant_type[index] = true.

Rixorster 03-23-2006 06:51

Let's make it have CVAR :P
Code:
#include <amxmodx> public plugin_init() {   register_clcmd("say" , "hook_say");   register_clcmd("say_team" , "hook_say");   register_cvar("allowtalk","1") } public hook_say(id) {   new allowtalk[64]   new talkallow = get_cvar_string("allowtalk",allowtalk,63)   if(talkallow != 1) {     return PLUGIN_HANDLED;   }   return PLUGIN_CONTINUE; }
Maybe, not really sure about cvar stuff >_>

Greenberet 03-23-2006 07:40

Code:
#include <amxmodx> public plugin_init() {     register_clcmd("say" , "hook_say");     register_clcmd("say_team" , "hook_say");     register_cvar("allowtalk","1"); } public hook_say(id) {     if(get_cvar_num("allowtalk" ) != 1)         return PLUGIN_HANDLED;     return PLUGIN_CONTINUE; }

thats the correct version

wonsae 03-23-2006 09:04

Code:
#include <amxmodx> public plugin_init() {     register_clcmd("say" , "hook_say");     register_clcmd("say_team" , "hook_say");     register_cvar("allowtalk","1"); } public hook_say(id) {     if(get_cvar_num("allowtalk" ) != 1)                 client_print(id,print_chat,"[AMXX] You may not speak now.")         return PLUGIN_HANDLED;     return PLUGIN_CONTINUE; }
so something like this?

Brad 03-23-2006 09:13

Something more like this:
Code:
#include <amxmodx> public plugin_init() {     register_clcmd("say" , "hook_say");     register_clcmd("say_team" , "hook_say");     register_cvar("allowtalk","1"); } public hook_say(id) {     if(!get_cvar_num("allowtalk"))     {         client_print(id,print_chat,"[AMXX] You may not speak now.");         return PLUGIN_HANDLED;     }     return PLUGIN_CONTINUE; }

Or in AMXX 1.70 or later...

Code:
#include <amxmodx> new g_cvarAllowTalk; public plugin_init() {     register_clcmd("say" , "hook_say");     register_clcmd("say_team" , "hook_say");     g_cvarAllowTalk = register_cvar("allowtalk","1"); } public hook_say(id) {     if(!get_pcvar_num(g_cvarAllowTalk))     {         client_print(id,print_chat,"[AMXX] You may not speak now.");         return PLUGIN_HANDLED;     }     return PLUGIN_CONTINUE; }

Brad 03-23-2006 09:16

Using a CVAR in this way is more of a global way to allow/disallow talking. Do you want everyone to be able to talk or not talk or just specific people?

wonsae 03-23-2006 15:13

Quote:

Originally Posted by Brad
Something more like this:
Code:
#include <amxmodx> public plugin_init() {     register_clcmd("say" , "hook_say");     register_clcmd("say_team" , "hook_say");     register_cvar("allowtalk","1"); } public hook_say(id) {     if(!get_cvar_num("allowtalk"))     {         client_print(id,print_chat,"[AMXX] You may not speak now.");         return PLUGIN_HANDLED;     }     return PLUGIN_CONTINUE; }

Or in AMXX 1.70 or later...

Code:
#include <amxmodx> new g_cvarAllowTalk; public plugin_init() {     register_clcmd("say" , "hook_say");     register_clcmd("say_team" , "hook_say");     g_cvarAllowTalk = register_cvar("allowtalk","1"); } public hook_say(id) {     if(!get_pcvar_num(g_cvarAllowTalk))     {         client_print(id,print_chat,"[AMXX] You may not speak now.");         return PLUGIN_HANDLED;     }     return PLUGIN_CONTINUE; }

this is for amxx 1.01 and the specialists

wonsae 03-23-2006 15:25

Quote:

Originally Posted by Brad
Using a CVAR in this way is more of a global way to allow/disallow talking. Do you want everyone to be able to talk or not talk or just specific people?

specific people

v3x 03-23-2006 16:00

Use my way then.


All times are GMT -4. The time now is 16:29.

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