Jump to content

HELP! Load map on marker hit.


Shamont

Recommended Posts

I need a script that starts a given map resource, when a player enters a marker.

I would like a resource script to start/stop OTHER resources via marker.

Have the script run in this order:

1.Anyone touches marker.

2.Whole server hears: "resource started by ..PlayerWhoTouchedMarker.."

3.Marker is removed.

4.The given resource is started.

5.10 minute timer starts, then it ends.

6.Whole server hears:"resource stopped"

7.Marker Appears again.

8.The given resource is then stopped.

9.Players can re-enter the maker again, allowing to start back at 1.

Link to comment
local marker = createMarker(arguments) 
  
function markerHit ( hitElement ) 
if getElementType (hitElement) == "player" then 
local starter = getPlayerName (hitElement) 
outputChatBox(starter.." has started the resource!", root, 255, 0, 0, true) 
destroyElement (marker) 
startResource (arguments) 
setTimer( function() 
marker = createMarker(arguments) 
stopResource(arguments) 
outputChatBox("Resource stopped", root, 255, 0, 0) 
end, 
600000,1) 
end 
end 
addEventHandler("onMarkerHit", marker, markerHit) 
  
  

Edited by Guest
Link to comment
local marker = createMarker(arguments) 
  
function markerHit ( hitElement ) 
if getElementType (hitElement) == "player" then 
local starter = getPlayerName (hitElement) 
outputChatBox(starter.." has started the resource!", root, 255, 0, 0, true) 
destroyElement (marker) 
startResource (arguments) 
setTimer( function() 
marker = createMarker(arguments) 
stopResource(arguments) 
outputChatBox("Resource stopped", root, 255, 0, 0) 
end, 
600000,1) 
end 
end 
addEventHandler("onMarkerHit", marker, markerHit) 

Link to comment
local marker = createMarker(arguments) 
  
function markerHit ( hitElement ) 
if getElementType (hitElement) == "player" then 
local starter = getPlayerName (hitElement) 
outputChatBox(starter.." has started the resource!", root, 255, 0, 0, true) 
destroyElement (marker) 
startResource (arguments) 
setTimer( function() 
marker = createMarker(arguments) 
stopResource(arguments) 
outputChatBox("Resource stopped", root, 255, 0, 0) 
end, 
600000,1) 
end 
end 
addEventHandler("onMarkerHit", marker, markerHit) 

What? You just copied my code, although I see you fixed a string error I did. Thanks.

Link to comment
  • 4 weeks later...

this script is good, but can you show a working example of the start resource arguments? when ever i type them in i get a "expected resoure-data at argument ~~." its refering to the start resource line. heres my arguments:

Edited by Guest
Link to comment

sorry, actually here's what i have now: ped1 = createPed(112, 378.40203857422,-1883.6003417969,2.2299766540527,180) --Create our Ped

function died(TerroristMap1)

local resource = getResourceFromName ( "TerroristMap1" )

local start = startResource (resource)

if (start) then

outputChatBox ("**YOU HEAR A BIG BOOM IN THE DISTANCE** LS Beach Pier has been destroyed in an explosion!")

end

setTimer(function(TerroristMap1)

outputChatBox ( "The LS Beach Pier has been rebuilt!" )

local stop = stopResource ( resource )

end, 30000, 1 )

end

addEventHandler("onPedWasted", ped1, died) --Add the Event when ped1 dies

function onStart( theResource )

local resource = getResourceFromName ( "TerroristMap1" ) -- get the resource of name "playerblips"

if (resource) then

outputChatBox ( "Map grabbed...!" )

end

end

addEventHandler ( "onResourceStart", getRootElement(), onStart )

--edited almost a year later, I was a dumb scripter when asking for help on this, i figured it out now. i see so many mistakes in this it isn't funny.

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