Jump to content

Preciso de uma pequena ajuda


Recommended Posts

Estou tentando criar um sistema que acho que muitos conhecem, e um sistema para uma corporação, tipo a PMESP, como deveria funcionar, eu criaria uma marker para spawnar uma viatura na hora que algum policial com tag passa-se for cima da marker, mais to tendo erro, pq criei a marker, mais nao consigo colocar essa função a ela, sempre da erro, queria entender se tem alguma forma mais facil de dar esta função a minha marker poder spawnar apenas 1 carro por marker.

Link to comment
  • Other Languages Moderators
local ACL_GROUP		= "PMESP";
local VEH_ID		= 411;
local theMarker		= createMarker ( 0, 0, 3, "cylinder", 1.80, 255, 255, 0, 185 );
local theVehicle	= { };

addEventHandler ( "onMarkerHit", theMarker, function ( player, d )
	
	if ( getElementType ( player ) == "player" and d ) then
		local vehicle = getPedOccupiedVehicle ( player );
		
		if ( vehicle ) then
			return false;
		end
		
		if ( isGuestAccount ( getPlayerAccount ( player ) ) then
			return false;
		end
		
		if ( isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( ACL_GROUP ) ) ) then
			if ( theVehicle[player] and isElement ( theVehicle[player] ) ) then
				destroyElement ( theVehicle[player] );
			end
			
			local playerPosition = { getElementPosition ( player ) };
			
			theVehicle[player] = createVehicle ( VEH_ID, playerPosition[1], playerPosition[2], playerPosition[3] );
			warpPedIntoVehicle ( player, theVehicle[player] );
		end
	end
	
end )

addEventHandler ( "onPlayerQuit", root, function ( )
	
	if ( theVehicle[source] and isElement ( theVehicle[source] ) ) then
		destroyElement ( theVehicle[source] );
	end
	
end )

 

Link to comment
  • Other Languages Moderators
2 hours ago, ruanlima212 said:

mais to tendo erro, pq criei a marker, mais nao consigo colocar essa função a ela, sempre da erro, queria entender se tem alguma forma mais facil de dar esta função a minha marker poder spawnar apenas 1 carro por marker.

Você disse que tentou fazer algo, mas está dando erro. Cadê o código pra gente verificar o erro? Qual erro que aparece no /debugscript 3?

Edited by Lord Henry
  • Like 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...