DrifteR Posted June 26, 2011 Share Posted June 26, 2011 Hi, i have this code but it doesn't work, no errors, no warnnings Location - Area 51 local CP local C2 local C3 local C1 = createMarker (307,1971,17, "checkpoint",3, 255, 30, 30, 255 ) addEventHandler( "onMarkerHit", C1, function (hitElement, matchingDimension) if getElementType( hitElement ) == "player" then outputChatBox("Hei " .. getPlayerName(GetLocalPlayer()) .. ", there is a stair to help you cross thre fence, GO!") C2 = createMarker (302,1902,17, "checkpoint",3, 255,100,100, 255 ) destroyElement(C1) else outputChatBox("test") end end ) addEventHandler( "onMarkerHit", C2, function(hitElement, matchingDimension) if getElementType( hitElement ) == "player" then outputChatBox("Now get up to the safezone! Arrows will guide you!") C3 = createMarker (236,1927,17, "checkpoint",3, 30,255,30, 255 ) destroyElement(C2) end end ) addEventHandler( "onMarkerHit", C3, function(hitElement, matchingDimension) if getElementType( hitElement ) == "player" then outputChatBox("Suit up " .. getPlayerName(getLocalPlayer()) .. " for the fight!") CP = createMarker ( 207.25,1931.25390625,22.33, "checkpoint",3, 0, 255, 30, 255 ) destroyElement(C3) end end ) addEventHandler( "onMarkerHit", CP, function(hitElement, matchingDimension) if getElementType( hitElement ) == "player" then local skin = {30,121,122,127} setElementModel ( getLocalPlayer(), skin[math.random(1,4)] ) destroyElement(CP) end end ) First marker is created, but looks like onMarkerHit doesn't work. Edit #1 : Client-Side script Can anyone help me with this? Anyone? Link to comment
Wojak Posted June 26, 2011 Share Posted June 26, 2011 there are 3 errors when you start the resource - bad argument at line 21,32,43 (C2, C3 and CP do not contain marker element at the yime you add the event) also this is a client script, so "onClientMarkerHit" not "onMarkerHit" and GetLocalPlayer() should be getLocalPlayer() you will not se client errors in server console use /debugscript 3 in game Link to comment
DrifteR Posted June 26, 2011 Author Share Posted June 26, 2011 Ok, how could i set the Marker visibility? Link to comment
Wojak Posted June 27, 2011 Share Posted June 27, 2011 you don't need to create all markers at once, you need to add the event after you create the marker (events can be added inside functions) 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