Shamont Posted March 23, 2016 Share Posted March 23, 2016 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
Dimos7 Posted March 23, 2016 Share Posted March 23, 2016 try something about your self and if you have error we help you Link to comment
EstrategiaGTA Posted March 23, 2016 Share Posted March 23, 2016 (edited) 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 March 23, 2016 by Guest Link to comment
Dimos7 Posted March 23, 2016 Share Posted March 23, 2016 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
EstrategiaGTA Posted March 23, 2016 Share Posted March 23, 2016 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
Shamont Posted April 14, 2016 Author Share Posted April 14, 2016 holy crap, i guess the comunity is still active! Quick!EstrategiaGTA give me your paypal email. i'm gunna pay you! reply thanks when you get the money! L: You have no idea what you just did for me! Link to comment
Captain Cody Posted April 14, 2016 Share Posted April 14, 2016 You trying to load it server side or client side, there are more methods of doing this if you want it to load just for that player. Link to comment
Shamont Posted April 15, 2016 Author Share Posted April 15, 2016 (edited) 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 April 16, 2016 by Guest Link to comment
Shamont Posted April 15, 2016 Author Share Posted April 15, 2016 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
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