Jump to content

[HELP] Debug settings #graphics


Recommended Posts

Hi, I have a question, how can I block the option to set the debugging option on #grapics, I know that it can be blocked somehow because on the TOP-GTA server, when we set ourselves in options -> advanced and debug settings on #graphics, it pops up black screen saying to change to default, but I don't know what function checks whether the player has it set or not. Regards

Edited by LOOah
Link to comment
local scx, scy = guiGetScreenSize( );

addEventHandler( "onClientRender", root, function ( )
	if ( #engineGetVisibleTextureNames( ) < 1 ) then
		dxDrawRectangle( 0, 0, scx, scy, tocolor( 0, 0, 0, 255 ), false );
	end
end );

in theory this should work

Edited by XaskeL
  • Thanks 1
Link to comment
  • Moderators
19 minutes ago, LOOah said:

Hi, I have a question, how can I block the option to set the debugging option on #grapics, I know that it can be blocked somehow because on the TOP-GTA server, when we set ourselves in options -> advanced and debug settings on #graphics, it pops up black screen saying to change to default, but I don't know what function checks whether the player has it set or not. Regards

Not sure which option you are referring to (I do not have access to my pc at the moment so I can't check). But the following function contains some of the settings, maybe it is in there:

https://wiki.multitheftauto.com/wiki/DxGetStatus

 

  • Thanks 1
Link to comment
-- Author: XaskeL
-- Created 04/05/2021
-- https://forum.multitheftauto.com/topic/130216-help-debug-settings-graphics

local CGraphicsDebug =
{
	addEventHandler 				= addEventHandler;
	dxDrawRectangle 				= dxDrawRectangle;
	dxDrawText 						= dxDrawText;
	setTimer 						= setTimer;
	engineGetVisibleTextureNames 	= engineGetVisibleTextureNames;
	localPlayer						= localPlayer;
	guiGetScreenSize				= guiGetScreenSize;
	resourceRoot					= resourceRoot;
	root							= root;
	
	g_bRenderInfo 					= false;
	g_iInterval						= 2000;
	g_bOverlayDraw					= true;
	
	BLACK							= tocolor( 0, 0, 0, 255 );
	WHITE							= -1;
}; CGraphicsDebug.__index = CGraphicsDebug;

setmetatable( CGraphicsDebug, { __index = _G; } );

setfenv( 1, CGraphicsDebug );

local g_fScreenX, g_fScreenY = guiGetScreenSize( );

CGraphicsDebug.OnRender = function ( )
	dxDrawRectangle( 0, 0, g_fScreenX, g_fScreenY, BLACK, g_bOverlayDraw );
	dxDrawText( "Set debug settings to default", 0, 0, g_fScreenX, g_fScreenY, WHITE, 1.0, "bankgothic", "center", "center", false, false, g_bOverlayDraw );
end;

CGraphicsDebug.OnCheck = function ( )
	if ( #engineGetVisibleTextureNames( ) < 1 ) then
		if ( not g_bRenderInfo ) then
			addEventHandler( "onClientRender", root, OnRender );
			
			g_bRenderInfo = true;
			
			return;
		end
	else
		if ( g_bRenderInfo ) then
			removeEventHandler( "onClientRender", root, OnRender );
			
			g_bRenderInfo = false;
			
			return;
		end
	end
end;

CGraphicsDebug.OnStart = function ( )
	setTimer( OnCheck, g_iInterval, 0 );
end;

addEventHandler( "onClientResourceStart", resourceRoot, OnStart );

Code that is 100% functional and can be used in a client-side project.

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