MTS_LoneWolf Posted December 7, 2021 Share Posted December 7, 2021 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, "Wolf.Marker", 1) criarMarker(source) end end function criarMarker(element) if isElement(element) then local number = tonumber((getElementData(element, "Wolf.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, "Wolf.marker", number +1) destroyElement(markerCheckpoint) criarMarker(source) end end) end end eu gostaria de saber como eu posso checar se os checkpoints acabaram para entregar a recompensa do player po ter finalizado a rota Link to comment
_SAXI_ Posted December 7, 2021 Share Posted December 7, 2021 if(getElementData(element,"Wolf.marker") == #markers)then -- your end code end 1 Link to comment
MTS_LoneWolf Posted December 8, 2021 Author Share Posted December 8, 2021 7 hours ago, _SAXI_ said: if(getElementData(element,"Wolf.marker") == #markers)then -- your end code end me surgiu outra duvida, caso eu queira gerar mais markers de inicio, e designar uma rota para cada, como funcionaria? Link to comment
_SAXI_ Posted December 8, 2021 Share Posted December 8, 2021 Here is an idea of how to do it : local rutas = { [1] = { {x,y,z}, {x,y,z} ... }, [2] = { {x,y,z}, {x,y,z} ... } }; local ruta_markers = {}; addEventHandler('onResourceStart',resourceRoot,function() for i,ruta in pairs(rutas)do ruta_markers[i] = {}; for num,data in pairs(ruta)do local m = createMarker(data[1],data[2],data[3],'cylinder',...); ruta_markers[i][num] = m; end end end) function setPlayerRoute(player,ruta) setElementData(player,"Ruta",ruta); end addEventHandler('onMarkerHit',root,function(player) local ruta = getElementData(player,'Ruta'); if(ruta_markers[ruta])then ... end end) Link to comment
Other Languages Moderators Lord Henry Posted December 9, 2021 Other Languages Moderators Share Posted December 9, 2021 @_SAXI_Você precisa escrever em português pois este tópico está na seção Portuguesa. You need to write in portuguese because this thread is in the Portuguese section. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now