Jump to content

script de corrida ilegal para rp


Recommended Posts

alguem poderia me ajudar tou tentando fazer uma corrida ilegal para server de rp a ideia é vc poder iniciar a corrida com qual quer carro mas não ta indo eu dou o comando para iniciar e aparece só o primeiro checkpoint

--------------------------------------------------------------------------------------------------------------------
---------------------------------------------------  Checkpoint  ---------------------------------------------------
--------------------------------------------------------------------------------------------------------------------
Minicio = createMarker (903.6904296875,-1221.5521240234,15.494886398315, "cylinder", 3, 255, 255, 255)
 setElementVisibleTo (Minicio,root,true)

 Binicio = createBlipAttachedTo (Minicio,0)
 setElementVisibleTo (Binicio,root,true) 
 
 function Minicio(source)
    if isElementWithinMarker(source,Minicio)then
	   
	   setElementData(source,"inicio",true)
   end
	   setElementVisibleTo (Minicio,source,false)
	   setElementVisibleTo (Binicio,source,false)
	   
	   setElementVisibleTo (Mk01,source,true)
	   setElementVisibleTo (B01,source,true)
 	   
   end
 
 addCommandHandler("iniciar", Minicio)
addEventHandler("onMarkerHit", root, Minicio)
 

--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------- Checkpoint 1 ---------------------------------------------------
--------------------------------------------------------------------------------------------------------------------

Mk01 = createMarker (1040.6810302734,-1221.0601806641,16.245132446289, "checkpoint", 2, 0, 255, 0, 95) 
setElementVisibleTo (Mk01,root,false)

B01 = createBlipAttachedTo (Mk01,0) 
setElementVisibleTo (B01,root,false) 

function Mk01 (source)
    if isElementWithinMarker(source,Mk01)then 
	
		setElementData ( source, "Mk01", true )
	end
	   setElementVisibleTo (Mk01,source,true)
	   setElementVisibleTo (B01,source,true)
	   
	   setElementVisibleTo (Mk02,source,true)
	   setElementVisibleTo (B02,source,true)
   end
 
addEventHandler("onMarkerHit",root, Mk01)


--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------- Checkpoint 2 ---------------------------------------------------
--------------------------------------------------------------------------------------------------------------------

Mk02 = createMarker (1060.4594726563,-1164.6182861328,23.250541687012, "checkpoint", 2, 0, 255, 0, 95)
setElementVisibleTo (Mk02,root,false)

B02 = createBlipAttachedTo (Mk02,0)
setElementVisibleTo (B02,root,false) 

function Mk02 (source)
	if isElementWithinMarker(source,Mk02)then
		
		setElementData ( source, "Mk02", true )
	end	
		setElementVisibleTo(Mk02,source,true)
		setElementVisibleTo(B02,source,false)
		
		setElementVisibleTo(Mk03,source,true)
		setElementVisibleTo(B03,source,true)
   end
 
addEventHandler("onMarkerHit",root, Mk02)


--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------- Checkpoint 3 ---------------------------------------------------
--------------------------------------------------------------------------------------------------------------------

Mk03 = createMarker (977.50012207031,-1141.4233398438,23.51047706604, "checkpoint", 2, 0, 255, 0, 95)
setElementVisibleTo (Mk03,root,false)

B03 = createBlipAttachedTo ( Mk03,0)
setElementVisibleTo (B03,root,false)

function Mk03 (source)
	if isElementWithinMarker(source,Mk03)then
	
		setElementData ( source, "Mk03", true )
	end
		setElementVisibleTo(Mk03,source,true)
		setElementVisibleTo(B03,source,false)
		
		setElementVisibleTo(Mk04,source,true)
		setElementVisibleTo(B04,source,true)
   end
	
addEventHandler("onMarkerHit", root, Mk03)

--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------- Checkpoint 4 --------------------------------------------------
--------------------------------------------------------------------------------------------------------------------

Mk04 = createMarker(812.4453125,-1142.3229980469,23.463104248047, "checkpoint", 2, 0, 255, 0, 95)
setElementVisibleTo (Mk04,root,false)

B04 = createBlipAttachedTo (Mk04 ,0)
setElementVisibleTo (B04,root,false)

function Mk04 (source)
	if isElementWithinMarker(source,Mk04)then
	
		setElementData ( source, "Mk04", true )	
	end	
		setElementVisibleTo(Mk04,source,true)
		setElementVisibleTo(B04,source,false)
		
		setElementVisibleTo(Mk05,source,true)
		setElementVisibleTo(B05,source,true)
   end
	
addEventHandler("onMarkerHit",root, Mk04)

--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------- Checkpoint 5 -------------------------------------------------
--------------------------------------------------------------------------------------------------------------------

Mk05 = createMarker (613.48120117188,-1213.8084716797,17.622119903564, "checkpoint", 2, 0, 255, 0, 95)
setElementVisibleTo(Mk05,root,false)

B05 = createBlipAttachedTo(Mk05,0)
setElementVisibleTo (B05,root,false)

function Mk05 (source)
	if isElementWithinMarker(source,Mk05)then
	
		setElementData ( source, "Mk05", true )
	end
		setElementVisibleTo(Mk05,source,false)
		setElementVisibleTo(B05,source,false)
		
		setElementVisibleTo(Mk06,source,true)
		setElementVisibleTo(B06,source,true)
   end
	
addEventHandler("onMarkerHit",root, Mk05)

--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------- Checkpoint 6 ------------------------------------------------
--------------------------------------------------------------------------------------------------------------------

Mk06 = createMarker (479.68212890625,-1292.8688964844,14.9223299026490,"checkpoint", 2, 0, 255, 0, 95)
setElementVisibleTo(Mk06,root,false)

B06 = createBlipAttachedTo ( Mk06,0)
setElementVisibleTo (B06,root,false)

function Mk06 (source)
	if isElementWithinMarker(source,Mk06)then
	
		setElementData ( source, "Mk06", true )
	end
		setElementVisibleTo(Mk06,source,false)
		setElementVisibleTo(B06,source,false)
		
		setElementVisibleTo(Mk07,source,true)
		setElementVisibleTo(B07,source,true)
   end
	
addEventHandler("onMarkerHit",root, Mk06)

--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------- Checkpoint 7 ---------------------------------------------
--------------------------------------------------------------------------------------------------------------------

Mk07 = createMarker (314.45980834961,-1396.2548828125,13.525994300842, "checkpoint", 2, 0, 255, 0, 95)
setElementVisibleTo(Mk07,root,false)

B07 = createBlipAttachedTo (Mk07,0)
setElementVisibleTo (B07,root,false)

function Mk07 (source)
	if isElementWithinMarker(theplayer,Mk07)then
	
		setElementData ( source, "Mk07", true )
end
		setElementVisibleTo(Mk07,source,false)
		setElementVisibleTo(B07,source,false)
		
		setElementVisibleTo(Mk08,source,true)
		setElementVisibleTo(B08,source,true)
   end
	
addEventHandler("onMarkerHit",root, Mk07)

--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------- Checkpoint 8  --------------------------------------------------
--------------------------------------------------------------------------------------------------------------------

Mk08 = createMarker (158.24557495117,-1545.9663085938,10.478841781616, "checkpoint", 2, 0, 255, 0, 95)
setElementVisibleTo(Mk08,root,false)

B08 = createBlipAttachedTo(Mk08,0)
setElementVisibleTo (B08,root,false)

function Mk08 (source)
	if isElementWithinMarker(source,Mk08)then
	
		setElementData ( source, "Mk08", true )
	end
		setElementVisibleTo(Mk08,source,false)
		setElementVisibleTo(B08,source,false)
		
		setElementVisibleTo(MK09,source,true)
		setElementVisibleTo(B09,source,true)
   end
	
addEventHandler("onMarkerHit",root,Mk08)

--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------- Checkpoint 9  --------------------------------------------------
--------------------------------------------------------------------------------------------------------------------

Mk09 = createMarker (112.10083770752,-1621.2984619141,10.237537384033, "checkpoint", 2, 0, 255, 0, 95)
setElementVisibleTo (Mk09,root,false)

B09 = createBlipAttachedTo(Mk09,0)
setElementVisibleTo(B09,root,false)

function Mk09 (source)
	if isElementWithinMarker(source,Mk09)then
	
		setElementData ( source, "Mk09", true )
	end
		setElementVisibleTo(Mk09,source,false)
		setElementVisibleTo(B09,source,false)
		
		setElementVisibleTo(Mk10,source,true)
		setElementVisibleTo(B10,source,true)
   end
	
addEventHandler("onMarkerHit",root, Mk09)

	
--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------- Checkpoint 10  --------------------------------------------------
--------------------------------------------------------------------------------------------------------------------

Mk10 = createMarker (158.31390380859,-1737.71484375,4.3394494056702, "checkpoint", 2, 0, 255, 0, 95)
setElementVisibleTo(Mk10,root,false)

B10 = createBlipAttachedTo(Mk10,0)
setElementVisibleTo(B10,root,false)

function Mk10 (source)
	if isElementWithinMarker(source,Mk10)then
	
		setElementData ( source, "Mk10", true )
	end	
		setElementVisibleTo(Mk10,source,false)
		setElementVisibleTo(B10,source,false)
		
		setElementVisibleTo(Mk11,source,true)
		setElementVisibleTo(B11,source,true)
	end
	
addEventHandler("onMarkerHit",root, Mk10)

	
--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------- Checkpoint 11  --------------------------------------------------
--------------------------------------------------------------------------------------------------------------------		
Mk11 = createMarker (335.62127685547,-1738.4915771484,3.9736037254333, "checkpoint", 2, 0, 255, 0, 95)
setElementVisibleTo(Mk11,root,false)

B11 = createBlipAttachedTo(Mk11,0)
setElementVisibleTo(B11,root,false)

function Mk11 (source)
	if isElementWithinMarker(source,Mk11)then
   
		setElementData ( source, "Mk11", true )
   end
		setElementVisibleTo(Mk11,source,false)
		setElementVisibleTo(B11,source,false)
		
		setElementVisibleTo(Mk12,source,true)
		setElementVisibleTo(B12,source,true)
		
   end
 	
addEventHandler("onMarkerHit",root, Mk11)


--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------- Checkpoint 12 --------------------------------------------------
--------------------------------------------------------------------------------------------------------------------
Mk12 = createMarker (347.88037109375,-1799.8662109375,4.2987537384033, "checkpoint", 2, 0, 255, 0, 95)
setElementVisibleTo(Mk12,root,false)

B12 = createBlipAttachedTo(Mk12,0)
setElementVisibleTo(B12,root,false)

function Mk12 (source)
	if isElementWithinMarker(source,Mk12) then
	if getElementData(source,"Mk11",false) then
	
		setElementVisibleTo(Mk12,source,false)
		setElementVisibleTo(B12,source,false)
   end
  end
	
addcommandHandler("Finaliza",Mk12)

addEventHandler("onMarkerHit", Mk12)

end

function VisibleBlips (source)
	setElementVisibleTo (Mk01, source, false)
	setElementVisibleTo (B01, source, false)
	
	setElementVisibleTo (Mk02, source, false)
	setElementVisibleTo (B02, source, false)
	
	setElementVisibleTo (Mk03, source, false)
	setElementVisibleTo (B03, source, false)
	
	setElementVisibleTo (Mk04, source, false)
	setElementVisibleTo (B04, source, false)
	
	setElementVisibleTo (Mk05, source, false)
	setElementVisibleTo (B05, source, false)
	
	setElementVisibleTo (Mk06, source, false)
	setElementVisibleTo (B06, source, false)
	
	setElementVisibleTo (Mk07, source, false)
	setElementVisibleTo (B07, source, false)
	
	setElementVisibleTo (Mk08, source, false)
	setElementVisibleTo (B08, source, false)
	
	setElementVisibleTo (Mk09, source, false)
	setElementVisibleTo (B09, source, false)
	
	setElementVisibleTo (Mk10, source, false)
	setElementVisibleTo (B10, source, false)
	
	setElementVisibleTo (Mk11, source, false)
	setElementVisibleTo (B11, source, false)
	
	setElementVisibleTo (Mk12, source, false)
	setElementVisibleTo (B12, source, false)
end	
	
	
	
	

 

 

Link to comment

Exemplo:

 

config = {
	markerInicio = {x, y, z},
}

markers = {
	[1] = {x, y, z},
	[2] = {x, y, z},
}

marker = createMarker(config.markerInicio[1], config.markerInicio[2], config.markerInicio[3], "cylinder", 2.0, 255, 255, 255)

addEventHandler("onMarkerHit", marker, function(source)
	if getPedOccupiedVehicle(source) then
		outputChatBox("Use /corrida para iniciar a corrida")
	end
end)

addCommandHandler("corrida", function(source)
	if isElementWithinMarker(source, marker) then
		setElementPosition(source, x, y, z)
			veh = createVehicle(vehicleID, x, y, z)
				warpPedIntoVehicle(source, veh)
			setElementData(source, "Augusto.Marker", 1)
		criarMarker(source)
	end
end

function criarMarker(element)
	if isElement(element) then
		local number = tonumber((getElementData(element, "Augusto.Marker") or 1))
		local x, y, z = markers[number][1], markers[number][2], markers[number][3]
		markerCheckpoint = createMarker(x, y, z , "checkpoint", 2.0, 255, 255, 255)
addEventHandler("onMarkerHit", markerCheckpoint, function(source)
	if source == element then
		setElementData(source, "Augusto.marker", number +1)
			destroyElement(markerCheckpoint)
				criarMarker(source)
			end
		end)
	end
end

Obs: Não testei

lembrando que voce pode usar a condição "until" (ate) para verificar se acabou os checkpoints

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