Jump to content

Debugscript color


Zsoltisz

Recommended Posts

I try this but it's dont working. What's the prob?

addEventHandler ("onClientDebugMessage",getRootElement(),
function(message,level,file,line)
    if exports.StarMTA_core:Fejleszto(thePlayer) then
  outputChatBox (message)
   	end
end)

I just type for outputChatBox because i want to test first.
 

Link to post

Oookay. It's still working. But i got some problem. Please help me.

Code:
 

function asd (message,level,file,line)
    if exports.StarMTA_core:Fejleszto(localPlayer) and level == 1 then
	outputChatBox("#7CC576[StarMTA-Debugscript]: #FF3333ERROR:#FFFFFF"..message.." (#FFA500"..line.."#FFFFFF)",255,255,255,true)
   	end
end
addEventHandler ("onClientDebugMessage",getRootElement(),asd)

Debugscript: ERROR:StarMTA_debugscript\client.lua:3 attempt to concatenate local 'line' (nil value)

Link to post

maybe:

if exports.StarMTA_core:Fejleszto(localPlayer) and level == 1 then
  	if line then
    	outputChatBox("#7CC576[StarMTA-Debugscript]: #FF3333ERROR:#FFFFFF"..message.." (#FFA500"..line.."#FFFFFF)",255,255,255,true)
    else
    	outputChatBox("#7CC576[StarMTA-Debugscript]: #FF3333ERROR:#FFFFFF"..message,255,255,255,true)
	end
end

 

Link to post

No, you can't do any sort of GUI on server side. You have to use onClientDebugMessage and store the messages in an array then use dxDrawText to draw it on the screen, but you might be better of downloading something like this from the community, to be honest.

Link to post

Store the messages in a table as pa3ck said. Then for example, only draw the last 5 entries to prevent it from cluttering the screen, use this to multiply the offset.

To optimize it you can limit the table size, so whenever a new message is added - check the size of the table and if the table is at its limit(let's say 50) then remove the first entry. That way the table will remain at a size of 50 all the time.

As for doing this server-side, you can, but the drawing has to happen client-side for obvious reasons. What you can do, however, is whenever onClientDebugMessage is executed, you send the information(message, level, file and line) to the server. This way, you can then transfer this information to another client and they will see it as well.

@Necktrox was working on something similar I believe, which looked promising. You might want to check his resource out if it's released. :)

Edited by Dealman
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.

×
×
  • Create New...