Jump to content

Não sei como resolver esse aviso


Recommended Posts

local show_radar = false;

local function render( )

	if ( not show_radar or not isPedInVehicle( localPlayer ) or not INTERFACE_UTILS.SHOW ) then

		return;

	end

	local position = { getElementPosition( localPlayer ) };

	dxSetRenderTarget( INTERFACE.Radar.render_targer, true );

		dxDrawRectangle( 0, 0, INTERFACE.Radar.w, INTERFACE.Radar.h, tocolor( 94, 101, 107 ) );

		local map_size = INTERFACE.unit / ( 200 / 125 );
		local cx, cy, _, tx, ty = getCameraMatrix( );
		local north = findRotation( cx, cy, tx, ty );

		local map_x, map_y = -( reMap( position[ 1 ] + INTERFACE.unit, 0, 6000, 0, map_size ) - INTERFACE.Radar.w / 2 ), -( reMap( -position[ 2 ] + INTERFACE.unit, 0, 6000, 0, map_size ) - INTERFACE.Radar.h / 2 );

		dxDrawImage( map_x, map_y, map_size, map_size, map_texture, north, - map_size / 2 - map_x + INTERFACE.Radar.w / 2, - map_size / 2 - map_y + INTERFACE.Radar.h / 2, tocolor( 255, 255, 255 ) );

		for index, value in ipairs( INTERFACE.gps_lines ) do

			local NODE_X, NODE_Y = value.x, value.y;
			local w, h = 25, 25;

			local line_x, line_y, line_w, line_h = ( INTERFACE.unit + ( NODE_X - w + 10 ) ) / 6000 * map_size, ( INTERFACE.unit - ( NODE_Y - h ) ) / 6000 * map_size, w / 6000 * map_size, -( h / 6000 * map_size );

			line_x = line_x + map_x;
			line_y = line_y + map_y;

			dxSetBlendMode( "modulate_add" );

				dxDrawImage( line_x, line_y, line_w, line_h, "assets/minimap/radar_area.png", north, -line_w / 2 - line_x + INTERFACE.Radar.w / 2, -line_h / 2 - line_y + INTERFACE.Radar.h / 2, tocolor( 131, 112, 245 ) );

			dxSetBlendMode( "blend" );

		end

		for index, value in ipairs( getElementsByType( "radararea" ) ) do

			local area_pos = { getElementPosition( value ) };
			local w, h = getRadarAreaSize( value );
			local r, g, b, a = 255, 255, 255, 255;

			local area_x, area_y, area_w, area_h = ( INTERFACE.unit + area_pos[ 1 ] ) / 6000 * map_size, ( INTERFACE.unit - area_pos[ 2 ] ) / 6000 * map_size, w / 6000 * map_size, -( h / 6000 * map_size );

			area_x = area_x + map_x;
			area_y = area_y + map_y;

			r, g, b, a = getRadarAreaColor( value );

			if ( isRadarAreaFlashing( value ) ) then

				a = a * math.abs( getTickCount( ) % 1000 - 500 ) / 500;

			end

			dxSetBlendMode( "modulate_add" );

				dxDrawImage( area_x, area_y, area_w, area_h, "assets/minimap/radar_area.png", north, -area_w / 2 - area_x + INTERFACE.Radar.w / 2, -area_h / 2 - area_y + INTERFACE.Radar.h / 2, tocolor( r, g, b, a ) );

			dxSetBlendMode( "blend" );

		end

		for index, value in ipairs( getElementsByType( "blip" ) ) do

			local blip_pos = { getElementPosition( value ) };
			local blip_icon = getBlipIcon( value );
			local blip_x, blip_y = getRadarFromWorldPosition( blip_pos[ 1 ], blip_pos[ 2 ], -40, -40, INTERFACE.Radar.w + 80, INTERFACE.Radar.h + 80, map_size );

			local blip_color = { 255, 255, 255 };

			if ( blip_icon == 0 ) then

				blip_color = { getBlipColor( value ) };

			end

			if ( getDistanceBetweenPoints2D( blip_pos[ 1 ], blip_pos[ 2 ], position[ 1 ], position[ 2 ] ) <= 450 ) then

				dxDrawImage( blip_x - INTERFACE.blip_size / 2, blip_y - INTERFACE.blip_size / 2, INTERFACE.blip_size, INTERFACE.blip_size, INTERFACE.blips[ blip_icon ], 0, 0, 0, tocolor( blip_color[ 1 ], blip_color[ 2 ], blip_color[ 3 ] ) );
			end
		end

		local blip_x, blip_y = ( INTERFACE.unit + position[ 1 ] ) / 6000 * map_size, ( INTERFACE.unit - position[ 2 ] ) / 6000 * map_size;

		blip_x = blip_x + map_x;
		blip_y = blip_y + map_y;

		dxDrawImage( blip_x - INTERFACE.blip_size / 2, blip_y - INTERFACE.blip_size / 2, INTERFACE.blip_size, INTERFACE.blip_size, arrow_player, north - getPedRotation( localPlayer ), 0, 0, tocolor( 255, 255, 255 ) );

	dxSetRenderTarget( );

	dxDrawRectangle( INTERFACE.Radar.x - 2, INTERFACE.Radar.y - 2, INTERFACE.Radar.w + 4, INTERFACE.Radar.h + 4, tocolor( 33, 33, 33 ) );
	dxDrawImage( INTERFACE.Radar.x, INTERFACE.Radar.y, INTERFACE.Radar.w, INTERFACE.Radar.h, INTERFACE.Radar.render_targer, 0, 0, 0, tocolor( 255, 255, 255 ) );

	removePointMap( );

end

function setRadarVisible( bool )

	show_radar = not not bool;

	if ( show_radar ) then

		addEventHandler( "onClientRender", root, render );

	else

		removeEventHandler( "onClientRender", root, render );

	end

end

function getRadarVisible( )

	return show_radar;

end

está aparecendo o seguinte aviso "Bad Argument @ 'dxDrawImage'
[Expected material at argument 5, got nil]

 

esse aviso está aparecendo na linha 86 que tem isso aqui

                dxDrawImage( blip_x - INTERFACE.blip_size / 2, blip_y - INTERFACE.blip_size / 2, INTERFACE.blip_size, INTERFACE.blip_size, INTERFACE.blips[ blip_icon ], 0, 0, 0, tocolor( blip_color[ 1 ], blip_color[ 2 ], blip_color[ 3 ] ) );

Sou novo como script e estou aprendendo e queria muito que alguém  me ajudasse a resolver esse problema 

Link to comment
15 hours ago, Archz said:

entendi e como eu poderia resolver isso? @Boechat

 

INTERFACE.blips é uma tabela que a posição deve ser o diretório da imagem dos blips, por exemplo: INTERFACE.blips[1] = ":ModDeMapa/blips/1.png"

Encontre onde essa tabela INTERFACE.blips é preenchida porque o erro pode estar nela...

Edited by Boechat
  • 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...