Jump to content

Debugscript color


Zsoltisz

Recommended Posts

Posted (edited)

Hello guys. Can I change the debugscript colors? :D It's just an idea. I see in video and i see the debugscript is create with dxDrawText. How can i do it?

Edited by Zsoltisz
function Zsoltisz(thePlayer)
  if isPlayerZsoltisz(thePlayer) then
    outputChatBox("Scripter")
  end
end

 

Posted (edited)

You can not change the default MTA debugscript's colors but you can create your own debug system using dxDrawText.

Oh and btw there's an MTA function which lets you output custom debug messages with custom colors. If that's what you need then visit outputDebugString.

Edited by Gravestone

Clan war system http://sh.st/7r4nI

 

Posted (edited)

Yeah. :) And can i color this with HEX Codes?

Edited by Zsoltisz
function Zsoltisz(thePlayer)
  if isPlayerZsoltisz(thePlayer) then
    outputChatBox("Scripter")
  end
end

 

Posted

Okay. It's looks hard :D How can i get the errors from scripts? :o

function Zsoltisz(thePlayer)
  if isPlayerZsoltisz(thePlayer) then
    outputChatBox("Scripter")
  end
end

 

Posted

Ehm, yes you can change the colour of it quite easily. Use outputDebugString and set the message type to 0, meaning custom. After that you can specify the RGB values as you please.

  • Like 1

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Posted

That looks like a custom system. You'd want to use onClientDebugMessage as previously mentioned for that.

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Posted

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.
 

function Zsoltisz(thePlayer)
  if isPlayerZsoltisz(thePlayer) then
    outputChatBox("Scripter")
  end
end

 

Posted

thePlayer is not defined. As for the exported function, I have absolutely no idea what that does :P 

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Posted

I translate it :D

i f exports.core:isPlayerDeveloper() then

 

function Zsoltisz(thePlayer)
  if isPlayerZsoltisz(thePlayer) then
    outputChatBox("Scripter")
  end
end

 

Posted

Still, thePlayer is not defined. Given that it is a client-sided script, try to replace thePlayer with localPlayer.

Is that function server-sided?

  • Like 1

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Posted

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)

function Zsoltisz(thePlayer)
  if isPlayerZsoltisz(thePlayer) then
    outputChatBox("Scripter")
  end
end

 

Posted

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

 

Posted

Yepp. Works. Thanks a lot :P

But now. I need to draw this with dxDrawText and row.

Like this: 461313452N_vtelen_www.kepfeltoltes.hu_.p

How can i make it?

BTW. Can i made this script in server side? :o

function Zsoltisz(thePlayer)
  if isPlayerZsoltisz(thePlayer) then
    outputChatBox("Scripter")
  end
end

 

Posted

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.

Posted (edited)

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

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

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