Jump to content

IRC Commands


shaio

Recommended Posts

I'll take into consideration that everyone knows the IRC default resource for MTA? I don't think they include it in the package but it is one of the default scripts.
Link to MTA IRC Default Resource Documentation

Anyway, I'm having trouble with making a command for my server, I want to be able to control the ACL with my phone via IRC.. I've given the script admin permissions and ACL Request permissions. Every other part of the script works, and I do not receive any errors or warnings through console or debugscript. Please help me fix this.

		addIRCCommandHandler("!staff",function(server,channel,user,command,account,group)
			if account and group then
				if isObjectInACLGroup("user."..account,aclGetGroup(group)) then
					aclGroupRemoveObject(aclGetGroup(group),"user."..account)
					ircSay(channel,account.." has been successfully removed from "..group.."!")
					outputChatBox("#FFFF00* #FF008F[#FFFFFFIRC#FF008F] #FFFFFF"..ircGetUserNick(user).."#FFFFFF has removed "..account.." from "..group.."!",getRootElement(),255,0,0,true)
				else
					aclGroupAddObject(aclGetGroup(group),"user."..account)
					outputChatBox("#FFFF00* #FF008F[#FFFFFFIRC#FF008F] #FFFFFF"..ircGetUserNick(user).."#FFFFFF has added "..account.." to "..group.."!",getRootElement(),255,0,0,true)
					ircSay(channel,account.." has been successfully added to "..group.."!")
				end
			else
				ircSay(channel,"Incorrect Syntax! !addstaff <playerName> <aclGroup>")
			end
		end)

 

Link to comment

Try this

		addIRCCommandHandler("!staff",function(server,channel,user,command,account,group)
			outputDebugString('1')
			if account and group then
			outputDebugString('2')
				if isObjectInACLGroup("user."..account,aclGetGroup(group)) then
				outputDebugString('3')
					aclGroupRemoveObject(aclGetGroup(group),"user."..account)
					ircSay(channel,account.." has been successfully removed from "..group.."!")
					outputChatBox("#FFFF00* #FF008F[#FFFFFFIRC#FF008F] #FFFFFF"..ircGetUserNick(user).."#FFFFFF has removed "..account.." from "..group.."!",getRootElement(),255,0,0,true)
				else
				outputDebugString('4')
					aclGroupAddObject(aclGetGroup(group),"user."..account)
					outputChatBox("#FFFF00* #FF008F[#FFFFFFIRC#FF008F] #FFFFFF"..ircGetUserNick(user).."#FFFFFF has added "..account.." to "..group.."!",getRootElement(),255,0,0,true)
					ircSay(channel,account.." has been successfully added to "..group.."!")
				end
			else
				outputDebugString('5')
				ircSay(channel,"Incorrect Syntax! !addstaff <playerName> <aclGroup>")
			end
		end)

Tell me which numbers it shows.

Link to comment
On 12/4/2016 at 4:49 PM, CodyL said:

Try this


		addIRCCommandHandler("!staff",function(server,channel,user,command,account,group)
			outputDebugString('1')
			if account and group then
			outputDebugString('2')
				if isObjectInACLGroup("user."..account,aclGetGroup(group)) then
				outputDebugString('3')
					aclGroupRemoveObject(aclGetGroup(group),"user."..account)
					ircSay(channel,account.." has been successfully removed from "..group.."!")
					outputChatBox("#FFFF00* #FF008F[#FFFFFFIRC#FF008F] #FFFFFF"..ircGetUserNick(user).."#FFFFFF has removed "..account.." from "..group.."!",getRootElement(),255,0,0,true)
				else
				outputDebugString('4')
					aclGroupAddObject(aclGetGroup(group),"user."..account)
					outputChatBox("#FFFF00* #FF008F[#FFFFFFIRC#FF008F] #FFFFFF"..ircGetUserNick(user).."#FFFFFF has added "..account.." to "..group.."!",getRootElement(),255,0,0,true)
					ircSay(channel,account.." has been successfully added to "..group.."!")
				end
			else
				outputDebugString('5')
				ircSay(channel,"Incorrect Syntax! !addstaff <playerName> <aclGroup>")
			end
		end)

Tell me which numbers it shows.

Debug strings did not work so I used ircSay instead. I had to set the permission to 0 for the command to even show up. And it says, 1, 2, 4, shay successfully added to Moderator!

And it did work. Here is the code I used.

		addIRCCommandHandler("!staff",function(server,channel,user,command,account,group)
			ircSay(channel,"1")
			if account and group then
			ircSay(channel,"2")
				if isObjectInACLGroup("user."..account,aclGetGroup(group)) then
				ircSay(channel,"3")
					aclGroupRemoveObject(aclGetGroup(group),"user."..account)
					ircSay(channel,account.." has been successfully removed from "..group.."!")
					outputChatBox("#FFFF00* #FF008F[#FFFFFFIRC#FF008F] #FFFFFF"..ircGetUserNick(user).."#FFFFFF has removed "..account.." from "..group.."!",getRootElement(),255,0,0,true)
				else
				ircSay(channel,"4")
					aclGroupAddObject(aclGetGroup(group),"user."..account)
					outputChatBox("#FFFF00* #FF008F[#FFFFFFIRC#FF008F] #FFFFFF"..ircGetUserNick(user).."#FFFFFF has added "..account.." to "..group.."!",getRootElement(),255,0,0,true)
					ircSay(channel,account.." has been successfully added to "..group.."!")
				end
			else
				ircSay(channel,"5")
				ircSay(channel,"Incorrect Syntax! !addstaff <playerName> <aclGroup>")
			end
		end)

 

Edited by shaio
  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...