Jump to content

IRC Messages


Recommended Posts

Posted

Hello MTA'ers!

Since my problem is pretty straightforward, I'm hoping to get a quick and simple reply lol.

Anyway, my problem is with displaying messages on Irc! How can I do this ?

I desperately need a solution for this.

Posted

I basically want to display certain script related messages on an irc channel. Initially, i had tried testing with outputIRC sadly i couldn't make it work.

Btw, sorry for being so unclear.

Posted

Here's the thing, I'm a member of a server which already has an irc channel for MTA. One of our members who was in charge of managing and handling all the scripts had stepped down. So i'm not sure how our irc bot works. Anyway, I had been working on some new additions for the server. Some of these additions include messages that have to be broadcasted on our irc channel since they are admin-related messages.

Getting back to the problem, i think i will have to call these functions from my resource right ?

I've just attached a sample code! Tell me if i'm doing this right :P

  
  
addEventHandler ("onPlayerChat",getRootElement(), 
function(message,type) 
if (string.find(message,"@warnings")) and not (string.find(message," @warnings")) then 
    local W_Number = loadNumberData (source) 
    if (tonumber(W_Number) == 0) then 
       setTimer(outputChatBox,50,1," #E9F006" .. getPlayerName (source) .. " #06F0DDhas #E9F006zero #06F0DDwarnings!",getRootElement(),255,0,0,true) 
       call(getResourceFromName("irc"),"outputIRC",getPlayerName(source).." has zero warnings") 
  end 
  end 
end 
  

Posted
if (string.find(message,"@warnings")) and not (string.find(message," @warnings")) then 

This line doesn't make any sense, you're checking the string contains @warnings and if the string doesn't doesn't contain @warnings.

local W_Number = loadNumberData (source) 

Is loadNumberData function defined?

Posted
if (string.find(message,"@warnings")) and not (string.find(message," @warnings")) then 

This line doesn't make any sense, you're checking the string contains @warnings and if the string doesn't doesn't contain @warnings.

local W_Number = loadNumberData (source) 

Is loadNumberData function defined?

Posted
if (string.find(message,"@warnings")) and not (string.find(message," @warnings")) then 

This line doesn't make any sense, you're checking the string contains @warnings and if the string doesn't doesn't contain @warnings.

I guess you missed the "space" before "@warnings"

I have basically made an exception for "[space]@warnings"

local W_Number = loadNumberData (source) 

Is loadNumberData function defined?

Yes, loadNumberData is defined. Well, these aren't even my issues lol.

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...