Raised This Month: $51 Target: $400
 12% 

!needadmin trigger to irc


Post New Thread Reply   
 
Thread Tools Display Modes
blackcat
Junior Member
Join Date: Oct 2005
Old 10-30-2005 , 15:31  
Reply With Quote #11

Updated my version of the needadmin script
blackcat is offline
blackcat
Junior Member
Join Date: Oct 2005
Old 10-30-2005 , 15:59  
Reply With Quote #12

Seems like the script got removed from my original reply. Well here it is
Attached Files
File Type: sma Get Plugin or Get Source (irc.sma - 1085 views - 8.9 KB)
blackcat is offline
{NM}Jason
AMX Mod X Beta Tester
Join Date: Mar 2004
Location: Texas
Old 10-30-2005 , 17:28  
Reply With Quote #13

i would susguest using the Server.cfg or even the amxmodx.cfg to edit the chan server ip and such.

instead of

Code:
register_cvar("irc_server","oslo.no.quakenet.org")
	register_cvar("irc_nick","botname")
	register_cvar("irc_username","username")
	register_cvar("irc_port","6667")
	register_cvar("irc_channel","#channel channelkey")
	register_cvar("irc_joindelay","10")
	register_cvar("irc_identify","1")
	register_cvar("irc_idbot","[email protected]")
	register_cvar("irc_ident","auth username password",FCVAR_PROTECTED&FCVAR_UNLOGGED)
but +karma for the edit
__________________
http://forums.alliedmods.net/showthr...396#post451396
Quote:
Originally Posted by BAILOPAN View Post
Shortly after posting that image, Jason crushed the truck into a ball with his hands, and tossed it over his shoulder.
{NM}Jason is offline
Send a message via ICQ to {NM}Jason Send a message via AIM to {NM}Jason Send a message via MSN to {NM}Jason Send a message via Yahoo to {NM}Jason
blackcat
Junior Member
Join Date: Oct 2005
Old 10-31-2005 , 05:51  
Reply With Quote #14

It reads the cvars, so that shouldnt be a problem, just left them there as in the original code from devicenull. But they can be removed and defined in server.cfg.
blackcat is offline
HuTcH
Member
Join Date: Aug 2005
Location: Denmark
Old 03-04-2006 , 12:14  
Reply With Quote #15

Quote:
Originally Posted by {NM}JRBLOODMIST
working On it with the IRC<--> HLDS Plugin will Keep you posted.
Is that in IRC <--> HLDS now ?
__________________
HuTcH is offline
Send a message via MSN to HuTcH
{NM}Jason
AMX Mod X Beta Tester
Join Date: Mar 2004
Location: Texas
Old 03-04-2006 , 13:14  
Reply With Quote #16

Read the Last Part of the HLDS <-> IRC Thread , when he starts it again it will be added
__________________
http://forums.alliedmods.net/showthr...396#post451396
Quote:
Originally Posted by BAILOPAN View Post
Shortly after posting that image, Jason crushed the truck into a ball with his hands, and tossed it over his shoulder.
{NM}Jason is offline
Send a message via ICQ to {NM}Jason Send a message via AIM to {NM}Jason Send a message via MSN to {NM}Jason Send a message via Yahoo to {NM}Jason
Hareide
New Member
Join Date: Mar 2006
Old 03-15-2006 , 16:50   (edited twice) Problems with the irc.sma (!needadmin)
Reply With Quote #17

This is kind of weird. Am running an hlds_l cstrike server with amxmodx. I compiled the plugins without warnings or errors. The script works with "/say !needadmin some text" in console, but if you use the default speak key "y" (binded to messagemode) to say "!needadmin some text" then the plugin returns "[NeedAdmin] No message specified. Please use !needadmin followed by a message!")". I didn’t know that there was a different between them.

Am I the only one with this "problem"? I guess it would be pretty simple for someone who knows how to script, to add "messagemode and teamspeak" to this nice plugin?

EDIT:
is it as simple as to edit:
// Commands
register_clcmd("say","irc_saytext")
register_clcmd("say_team","irc_saytext")
to:
// Commands
register_clcmd("say","irc_saytext")
register_clcmd("say_team","irc_saytext")
register_clcmd("messagemode","irc_saytext")
register_clcmd("messagemode2","irc_saytext")

I guess not, but I have not done any scripting so .. You tell me

EDIT2:
I'm using amxmodx 1.70 with Metamod v1.19p28 on a dedicated hlds_l linux server.

Code:
if(strlen(newmsg) >= 2)
	{
	get_cvar_string("irc_msg_srvsay",tmsg,1024)
	parsemessage(id,tmsg,temp,newmsg)
	format(temp,1024,"PRIVMSG %s :%s^r^n",chan,temp)
	additem(temp)
	client_print(id,print_chat,"[NeedAdmin] Message sent to admins on irc. Repeating/Abuse will lead to ban!")
	return PLUGIN_HANDLED
	}
	else
	{
	client_print(id,print_chat,"[NeedAdmin] No message specified. Please use !needadmin followed by a message!")
                return PLUGIN_HANDLED
	}
See that AmxmodX 1.70 has "Scripting Changes"
http://wiki.tcwonline.org/index.php/...ipting_Changes )

it seems that the plugin fails in the very end of the irc.sma code (the start in the cut section):
Code:
if(strlen(newmsg) >= 2)
It seems that the "/say command" returns the string with more or equal sentensens to '2', but when you use "y" binded to "messagemode" (default in hlds/cstrike) then this suddenly isn't true, and the script jumps to the "else" function that displays "[NeedAdmin] No message specified. Please use !needadmin followed by a message!"

I find it strange that the script handles the to way's to talk different. I thought "messagemode" used "say". Again am I the only one with newest amxmodx and metamod-p that has this problem or not?
Hareide is offline
blackcat
Junior Member
Join Date: Oct 2005
Old 04-17-2006 , 14:23  
Reply With Quote #18

Working on it. I'm having the same problemswith the script after upgrading to 1.71 myself. Keep you posted.
blackcat is offline
blackcat
Junior Member
Join Date: Oct 2005
Old 04-24-2006 , 01:58  
Reply With Quote #19

Okey. So I didn't figure this one out. But working on a rewrite that will use /admin in console rather than !needadmin in chat. Keep you posted.

If anyone has an idea why the parameters of needadmin are stripped when using messagemode/messagemode2 please do tell
blackcat is offline
blackcat
Junior Member
Join Date: Oct 2005
Old 05-25-2006 , 14:11  
Reply With Quote #20

Okay, so I updated the code to use /admin in console rather than !needadmin in say. Also updated so the script now uses a cfg-file (irc.cfg) rather than having to recompile every time you need to change any settings.

Code:
// Original code by devicenull (IRC <-> HLDS) // modified to do just one simple thing, contact admins on irc. // Be shure to modify the cvars for your use. The vars set her is an example for use on quakenet. // The /admin trigger in chat must contain a message, or the user will get a error message telling how to use it. // SteamID of the user using the trigger is also displayed on irc, so that we can ban abusers easily. // // Define these cvars in irc.cfg in order for the plugin to function properly // // irc_debug "0" (Set to 1 to enable debug messages) // irc_server "irc.quakenet.org" // irc_nick "nick" // irc_username "username" // irc_port "6667" // irc_channel "#channel chan-key" // irc_joindelay "10" // irc_identify" "1" (If you want to auth witch Q, or any other nickserv) // irc_idbot "[email protected]" // irc_uname "username" (username to auth/identify) // irc_passwd "username" (password to auth/identify) #include <amxmodx> #include <amxmisc> #include <engine> #include <sockets> #pragma dynamic 8000 #define ACCESS_IRC ADMIN_CFG #define MAX_USERS 32 new server[64], port, nick[32], username[32], chan[32], uname[32], passwd[32], feil // Stuff needed to connect new irc_socket //Connection new temp[1024] //Put together messages with this new curmesg //Message counter for sending new pending[256][1024] //Messages Pending to be sent new i //Loop Counter new pings //Keep track of pings public plugin_init() {     register_plugin("Needamin trigger","1.1","Stein_R")         register_dictionary("admincmd.txt")         register_dictionary("common.txt")         register_dictionary("pausecfg.txt")         new configsDir[64]         get_configsdir(configsDir, 63)         server_cmd("exec %s/irc.cfg", configsDir) // Execute main configuration file        //Various Messages     register_cvar("irc_msg_srvsay","<$name - $steamid> $message")     register_cvar("irc_clientport","0",FCVAR_PROTECTED&FCVAR_UNLOGGED)     register_concmd("irc","parseirc",0," args are connect disconnect status join or ident")         // Commands     register_concmd("/admin","irc_saytext")     set_task(1.0,"irc_datacheck",_,_,_,"b")     set_task(2.0,"sendnext",_,_,_,"b")     if (get_cvar_num("irc_clientport") == 0)     {         set_task(get_cvar_float("irc_joindelay"),"irc_connect")     }     else     {         irc_socket = get_cvar_num("irc_clientport")     } } public parseirc(id) {     if (!(get_user_flags(id)&ACCESS_IRC))     {         console_print(id,"[IRC] Access Denied")         return PLUGIN_HANDLED     }     new arg1[32]     read_argv(1,arg1,32)     if (equali(arg1,"connect") || equali(arg1,"reconnect"))     {         irc_connect()         console_print(id,"[IRC] Attempting to connect")         return PLUGIN_HANDLED     }     else if (equali(arg1,"disconnect"))     {         end()         console_print(id,"[IRC] Disconnecting")         return PLUGIN_HANDLED     }     else if (equali(arg1,"join"))     {         irc_joinchannel()         console_print(id,"[IRC] Attempting to join %s",chan)     }     else if (equali(arg1,"status"))     {         console_print(id,"[IRC] Status:")         console_print(id,"[IRC] Cvar reports port %i, irc_socket reports %i",get_cvar_num("irc_clientport"),irc_socket)         console_print(id,"[IRC] Internal vars: Nick: %s/Username: %s/Chan: %s/Server: %s/Port: %i",nick,username,chan,server,port)         console_print(id,"[IRC] Ping counter at %i, message counter at %i",pings,curmesg)     }     else if (equali(arg1,"ident") || equali(arg1,"identify"))     {         irc_identify()         console_print(id,"[IRC] Identifying")     }     else     {         console_print(id,"[IRC] Command not found")     }     return PLUGIN_HANDLED } public irc_connect() {     get_cvar_string("irc_server",server,64)     get_cvar_string("irc_nick",nick,32)     get_cvar_string("irc_channel",chan,32)     get_cvar_string("irc_username",username,32)     port = get_cvar_num("irc_port")     irc_socket = socket_open(server,port,SOCKET_TCP,feil)     set_cvar_num("irc_clientport",irc_socket)     switch (feil)     {         case 1:          {             log_amx("[IRC] Error creating socket to %s:%i",server,port)             return -1         }         case 2:          {             log_amx("[IRC] Error resolving hostname %s",server)             return -2         }         case 3:          {             log_amx("[IRC] Couldn't connect to %s:%i",server,port)             return -3         }     }     format(temp,1024,"NICK %s^r^nUSER %s 0 * :csP Bot^r^n",nick,username)     additem(temp)     return irc_socket } public irc_datacheck() {     if (socket_change(irc_socket,1))     {         new rdata[1024] //, data[1024]         socket_recv(irc_socket,rdata,1024)         copyc(rdata,1024,rdata,10)         irc_dataparse(rdata)         copy(temp,1024,rdata[strlen(rdata)+1])         if (containi(temp,"^r"))         {             irc_dataparse(rdata[strlen(rdata)+1])         }     } } public irc_dataparse(rdata[]) {     if(strlen(rdata) > 0)     { //If there is data         new arg1[128],arg1len,arg2[128] ,arg2len, arg3[128]         copyc(arg1,128,rdata,32)         arg1len = strlen(arg1)         copyc(arg2,128,rdata[arg1len+1],32)         arg2len = strlen(arg2)         copyc(arg3,128,rdata[arg1len+arg2len+2],32)         switch (str_to_num(arg2))         { //Numeric Events             case 001:             {                 server_print("[IRC] Connected sucessfully");                 irc_joinchannel()                 set_cvar_num("irc_clientport",irc_socket)                 irc_identify()                      return 0             } //Occurs after successful connection                case 403: { server_print("[IRC] Warning: We are not in the channel, but we tried to send a message to it and the channel is empty, channel %s",chan); return 0; }             case 405: { server_print("[IRC] Error: Can't join any more channels, the server won't allow it"); return 0; }             case 432: { server_print("[IRC] Error: Invalid characters in nickname"); return 0; }             case 433: { server_print("[IRC] Error: Nickname in use"); return 0; }             case 437: { server_print("[IRC] Error: Can't change nick, we are in a channel we are banned from"); return 0; }             case 471: { server_print("[IRC] Error: Limit on channel reached, remove +l and try again"); return 0; }             case 473: { server_print("[IRC] Error: Channel is +i, invite us in and try again"); return 0; }             case 474: { server_print("[IRC] Error: We are banned from that channel"); return 0; }             case 475: { server_print("[IRC] Error: Channel is +k and we don't have the key!"); return 0; }             case 482: { server_print("[IRC] Error: Can't set modes when we aren't op"); return 0; }             case 513: { server_print("[IRC] Error: Registration failed, try again later"); end(); return 0; }         }         if (get_cvar_num("irc_debug") == 1)             server_print("[IRC]-> %s",rdata)         if (equali(arg1,"PING"))         {             format(temp,1024,"PONG %s^r^n",arg2)             additem(temp)             pings++             return 0         }         else if (equali(arg1,"ERROR"))         {             end()             server_print("[IRC] Disconnected, trying to reconnect")             set_task(Float:60,"irc_connect")         }     }     return 0 } public additem(item[]) {     if(curmesg <= 255)     {         copy(pending[curmesg],1024,item)         curmesg++     }     else     {         new quicksend[201]         format(quicksend,200,"PRIVMSG %s :IRC message overflow, clearing stack.^r^n",chan)         socket_send(irc_socket,quicksend,0)         for(new inum=0;inum<256;inum++)         {             copy(pending[inum],1024,"")         }         curmesg = 0     }     return 0    } public sendnext() {     if (curmesg >= 1)     {         remove_quotes(pending[0])         socket_send(irc_socket,pending[0],0)         if (get_cvar_num("irc_debug") == 1)             server_print("[IRC]<- %s",pending[0])         for (i=0;i<=curmesg;i++)         {             copy(pending[i],1024,pending[i+1])         }         curmesg--     } } public end() {     format(temp,1024,"QUIT :Shutting down")     socket_send(irc_socket,temp,0)     set_cvar_num("irc_clientport",0) } public irc_joinchannel() {     get_cvar_string("irc_channel",chan,32)     format(temp,1024,"JOIN %s^r^n",chan)     additem(temp)     return 0 } public irc_identify() {     if (get_cvar_num("irc_identify") != 0)     {            new ident[256]         get_cvar_string("irc_uname",uname,256)         get_cvar_string("irc_passwd",passwd,256)         get_cvar_string("irc_idbot",idbot,256)         format(ident,256,"PRIVMSG %s :auth %s %s^r^n",idbot,uname,passwd)         additem(ident)     }     return 0 } public parsemessage(id,input[],output[],amsg[]) {     // Replaces $name $team $message with the right things     new name[32], authid[32]     new mtemp[1024]     get_user_name(id,name,32)     get_user_authid(id,authid,32)     copy(mtemp,512,input)     remove_quotes(amsg)     replace(mtemp,512,"$name",name)     replace(mtemp,512,"$message",amsg)     replace(mtemp,512,"$steamid",authid)     remove_quotes(mtemp)     remove_quotes(mtemp)     copy(output,1024,mtemp) } public irc_saytext(id) {     if (irc_socket > 0)     {         new msg[1024]         read_args(msg,1024)         new tmsg[1024]         if(strlen(msg) >= 2)             {             get_cvar_string("irc_msg_srvsay",tmsg,1024)             parsemessage(id,tmsg,temp,msg)             format(temp,1024,"PRIVMSG %s :%s^r^n",chan,temp)             additem(temp)             console_print(id,"[NeedAdmin] Message sent to admins on irc. Repeating/Abuse will lead to ban!",0,"")             return PLUGIN_HANDLED             }             else             {             console_print(id,"[NeedAdmin] No message specified. Please use /admin followed by a cheattype and nick of the cheater",0,"")                         return PLUGIN_HANDLED             }     }     return 0 }
Attached Files
File Type: sma Get Plugin or Get Source (irc.sma - 970 views - 8.9 KB)
blackcat 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:03.


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