shaio

IRC Commands

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)

 

Share this post


Link to post

Looks fine to me, are you sure the parameters are in the right order? Have you tried to outputChatBox ALL of the parameters? Are you sure you spell the username and group correctly and they exist?

Share this post


Link to post

Yes, I can make it check and use tostring if i need to but it still doesn't work. This is why I need help xD The rest of the script works, just this function doesn't, and I have no clue as to why..

Share this post


Link to post

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.

Share this post


Link to post
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

Share this post


Link to post

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.