AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Strange Bug plz help (https://forums.alliedmods.net/showthread.php?t=14042)

Anthraxnz 06-07-2005 08:32

Strange Bug plz help
 
I written this script for users in my clan to start wars ect with but there is a strange bug in it, when ever you run the script it works but you cant say anything, only in team_say can you talk.
under normal say nothing shows up, i have no idea whats going on so please help.

Code:
//Author:   Anthrax //Date:     07 June 2005 /* Commands     amx_war - Starts the script     say /password - shows the server password     say /nopassword - removes the password     say /generate - generates a new password     say /war - starts a war     say /restore - restores server back to normal */ #include <amxmodx> #include <amxmisc> new Plugin[] = "War Script" new Author[] = "AnthraX" new Version[] = "2.0" public plugin_init() {     register_plugin(Plugin,Version,Author)     register_concmd("amx_war","cmd_war",ADMIN_MAP," Starts a war on the server")     register_clcmd("say","check_input",ADMIN_MAP,"Checks for input") } //---------------------------------------------------------------------------------------- public cmd_war(id,level,sid) {     if ( ! cmd_access(id,level,sid,0))     {         console_print(id,"You have no access to that command")         return PLUGIN_HANDLED     }     set_cvar_string("mp_friendlyfire","1")     set_cvar_string("mp_forcechasecam","2")     set_cvar_string("mp_freezetime","10")     set_cvar_string("mp_Autokick","0")     set_cvar_string("mp_AutoTeambalance","0")     set_cvar_string("mp_Limitteams","0")     set_cvar_string("mp_timelimit","60")     set_cvar_string("mp_buytime",".5")     set_cvar_string("mp_c4timer","35")     set_cvar_string("mp_fadetoblack","0")     set_cvar_string("mp_autocrosshair","0")     set_cvar_string("mp_flashlight","1")     set_cvar_string("mp_fraglimit","0")     set_cvar_string("mp_maxrounds","0")     set_cvar_string("mp_tkpunish","0")     set_cvar_string("mp_winlimit","0")     set_cvar_string("mp_maxrounds","0")     set_cvar_string("sv_gravity","800")     set_cvar_string("sv_alltalk","0")     set_cvar_string("sv_aim","0")     set_cvar_string("sv_cheats","0")     set_cvar_string("pausable","0")         set_hudmessage(0, 200, 0, -1.0, 0.40, 0, 6.0, 6.0, 0.1, 0.1, 1)     show_hudmessage(0,"Live In 3 Restarts")             set_task(3.0, "restart")         set_task(6.0, "restart")     set_task(9.0, "restart")         set_task(11.0, "live")     set_task(14.0, "password_generator")     return PLUGIN_HANDLED } //---------------------------------------------------------------------------------------- public check_input(id,level,sid) {     if ( ! cmd_access(id,level,sid,0))     {         client_print(id, print_chat,"You have no access to that command")         return PLUGIN_HANDLED     }     new message[20]     read_args(message,18)     remove_quotes(message)             if (containi(message,"/password")!= -1)     {         cmd_pw(id)     }     if(containi(message,"/generate") != -1)     {         password_generator()     }     if(containi(message,"/nopassword") != -1)     {         cmd_nopw()     }     if(containi(message,"/warhelp") != -1)     {          show_motd(id, "addons/amxmodx/configs/warhelp.txt")     }     if(containi(message,"/war") != -1)     {         cmd_war(id,level,sid)     }     if(containi(message,"/restore") != -1)     {         cmd_unwar(id,level,sid)     }     return PLUGIN_HANDLED     } //---------------------------------------------------------------------------------------- public restart() {     set_cvar_string("sv_restart","1") } //---------------------------------------------------------------------------------------- public live() {     set_hudmessage(0, 200, 0, -1.0, 0.40, 0, 6.0, 6.0, 0.1, 0.1, 1)     show_hudmessage(0,"Live Go Go Go")     show_hudmessage(0,"Live Go Go Go")     show_hudmessage(0,"Live Go Go Go") } //---------------------------------------------------------------------------------------- public password_generator() {     new password[6]             num_to_str(random_num( 0,9 ), password[0], 1)     num_to_str(random_num( 0,9 ), password[1], 1)     num_to_str(random_num( 0,9 ), password[2], 1)     num_to_str(random_num( 0,9 ), password[3], 1)     num_to_str(random_num( 0,9 ), password[4], 1)     set_cvar_string("sv_password", password)     client_print(0, print_chat, "Server Password is: %s",password)     client_print(0, print_chat, "Server Password is: %s",password)     client_print(0, print_chat, "Server Password is: %s",password)     client_print(0, print_chat, "Server Password is: %s",password)     client_print(0, print_chat, "Server Password is: %s",password)          return PLUGIN_HANDLED   } //---------------------------------------------------------------------------------------- public cmd_pw(id) {     new password[6]     get_cvar_string("sv_password",password,6)     client_print(id, print_chat,"Server Password is: %s",password)     client_print(id, print_chat,"Server Password is: %s",password)     client_print(id, print_chat,"Server Password is: %s",password) } //---------------------------------------------------------------------------------------- public cmd_nopw() {     set_cvar_string("sv_password","")     client_print(0, print_chat, "Server Password Has Been Removed %s")     client_print(0, print_chat, "Server Password Has Been Removed %s")     client_print(0, print_chat, "Server Password Has Been Removed %s") } //---------------------------------------------------------------------------------------- public cmd_unwar(id,level,sid) {     if ( ! cmd_access(id,level,sid,0))     {         console_print(id,"You have no access to that command")         return PLUGIN_HANDLED     }     set_cvar_string("mp_friendlyfire","0")     set_cvar_string("mp_forcechasecam","0")     set_cvar_string("mp_freezetime","6")     set_cvar_string("mp_Autokick","1")     set_cvar_string("mp_AutoTeambalance","1")     set_cvar_string("mp_Limitteams","0")     set_cvar_string("mp_timelimit","30")     set_cvar_string("mp_buytime",".5")     set_cvar_string("mp_c4timer","35")     set_cvar_string("mp_fadetoblack","0")     set_cvar_string("mp_autocrosshair","0")     set_cvar_string("mp_flashlight","1")     set_cvar_string("mp_fraglimit","0")     set_cvar_string("mp_maxrounds","0")     set_cvar_string("mp_tkpunish","1")     set_cvar_string("mp_winlimit","0")     set_cvar_string("mp_maxrounds","0")     set_cvar_string("sv_gravity","800")     set_cvar_string("sv_alltalk","0")     set_cvar_string("sv_aim","0")     set_cvar_string("sv_cheats","0")     set_cvar_string("pausable","0")         set_hudmessage(0, 200, 0, -1.0, 0.40, 0, 6.0, 6.0, 0.1, 0.1, 1)     show_hudmessage(0,"Restoring Server")         set_cvar_string("sv_password","")     set_cvar_string("sv_restart","1")         client_print(0,print_chat,"Server Password Removed %s")     client_print(0,print_chat,"Server Password Removed %s")         return PLUGIN_HANDLED } //----------------------------------------------------------------------------------------

CoolKiller 06-07-2005 09:38

Maaybe
 
Maybe you made a plugin_handled insteaf of plugin_return? Just my buest guess.. i suck at this :P

More 06-07-2005 09:53

Code:
public check_input(id,level,sid) {     if ( ! cmd_access(id,level,sid,0))     {         client_print(id, print_chat,"You have no access to that command")         return PLUGIN_HANDLED     }     new message[20]     read_args(message,18)     remove_quotes(message)             if (containi(message,"/password")!= -1)     {         cmd_pw(id)     }     if(containi(message,"/generate") != -1)     {         password_generator()     }     if(containi(message,"/nopassword") != -1)     {         cmd_nopw()     }     if(containi(message,"/warhelp") != -1)     {             show_motd(id, "addons/amxmodx/configs/warhelp.txt")     }     if(containi(message,"/war") != -1)     {         cmd_war(id,level,sid)     }     if(containi(message,"/restore") != -1)     {         cmd_unwar(id,level,sid)     }     return PLUGIN_CONTINUE // here i let the say command reach the server and let it be printed out (PLUGIN_HANDLED had blocked this)     }

Anthraxnz 06-07-2005 17:58

thnks will give it a go

v3x 06-07-2005 18:16

Or if you want to block that text from showing up, but not block regular chat text..

Code:
public check_input(id,level,sid) {     if ( ! cmd_access(id,level,sid,0))     {         client_print(id, print_chat,"You have no access to that command")         return PLUGIN_HANDLED     }     new message[20]     read_args(message,18)     remove_quotes(message)             if (containi(message,"/password")!= -1)     {         cmd_pw(id)         return PLUGIN_HANDLED     }     if(containi(message,"/generate") != -1)     {         password_generator()         return PLUGIN_HANDLED     }     if(containi(message,"/nopassword") != -1)     {         cmd_nopw()         return PLUGIN_HANDLED     }     if(containi(message,"/warhelp") != -1)     {         show_motd(id, "addons/amxmodx/configs/warhelp.txt")         return PLUGIN_HANDLED     }     if(containi(message,"/war") != -1)     {         cmd_war(id,level,sid)         return PLUGIN_HANDLED     }     if(containi(message,"/restore") != -1)     {         cmd_unwar(id,level,sid)         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE // here i let the say command reach the server and let it be printed out (PLUGIN_HANDLED had blocked this)     }

Anthraxnz 06-08-2005 07:54

thanks, that works good. also i got another question.

when i type /warhelp its susposed to bring up the text file.
that works fine except if you miss spell it say you type /warmenu it runs the /war command. any ideas?

n0obie4life 06-08-2005 07:57

thats not our fault and its impossible to make him not "misspell" the word...

Anthraxnz 06-08-2005 08:22

dont flame.

i said if u type /warfog which isnt a valid command it starts the war.

also for some reason, only admins can talk now, normal players cant use say only team say

n0obie4life 06-08-2005 08:39

i didn't attempt to flame at all.

and what you said just now, and what you said now, is totally different!!!!!

change all of them from
Code:
containi
to
Code:
equali

Anthraxnz 06-08-2005 09:02

k thanks, i found the problem for why it stops no admins from talking, when it checks to see if your an admin. if you are then it continues, but if your not it denies you access to the say fuction :S


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

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