justn Posted March 8, 2014 Share Posted March 8, 2014 (edited) PROBLEM ON LINE 30-36, When i hit the marker nothing happens Server.lua: addEventHandler ( "onResourceStart", getRootElement(), function ( started ) getCar = createVehicle ( 411, 2062.91138, -1570.18054, 12.95983, 0, 0, 272 ) startBlip = createBlipAttachedTo ( getCar, 12 ) Marker1 = createMarker ( 2062.82886, -1568.31702, 12.43865, "cylinder", 2, 0, 0, 255, 85 ) setVehicleLocked ( getCar, true ) setElementFrozen ( getCar, true ) setVehicleDamageProof ( getCar, true ) exports["TopBarChat"]:sendClientMessage ("Car Jacker: There's a car on the radar, go to the 'C' blip to get it.",0,0,255) end ) function onEnter(thePlayer, seat) if ( getElementType ( getCar ) == "vehicle" ) and ( getElementModel ( getCar ) == 411 ) then Marker = createMarker ( x, y, z ) Blip = createBlipAttachedTo ( Marker, 12 ) exports["TopBarChat"]:sendClientMessage ("Car Jacker: Go to the blip on the marker to get money", thePlayer, 0, 0, 255) end end addEventHandler("onVehicleEnter", getRootElement(), onEnter ) function hitit(thePlayer, hitElement) if getElementType(hitElement) == "player" and (hitElement == thePlayer) then local money = math.random ( 500,800 ) givePlayerMoney ( thePlayer, money ) end end addEventHandler("onMarkerHit", getRootElement(), hitit ) addEventHandler ( "onMarkerHit", root, function ( thePlayer, hitElement ) if source == Marker1 and thePlayer == hitElement then warpPedIntoVehicle( thePlayer, getCar ) end end ) Edited March 8, 2014 by Guest Link to comment
Castillo Posted March 8, 2014 Share Posted March 8, 2014 thePlayer == hitElement That doesn't make any sense, the second argument of onMarkerHit is "matchingDimension", remove: thePlayer == hitElement Link to comment
justn Posted March 8, 2014 Author Share Posted March 8, 2014 (edited) thePlayer == hitElement That doesn't make any sense, the second argument of onMarkerHit is "matchingDimension", remove: thePlayer == hitElement Hm, this ? addEventHandler ( "onMarkerHit", root, function ( hitElement, matchingDimension, thePlayer ) if source == Marker1 then warpPedIntoVehicle( thePlayer, getCar ) end end ) Edited March 8, 2014 by Guest Link to comment
denny199 Posted March 8, 2014 Share Posted March 8, 2014 No, note from the wiki: "The source of this event is the marker that got hit by the element." Use this: addEventHandler ( "onMarkerHit", root, function ( hitElement, matchingDimension ) if source == Marker1 then if getElementType ( hitElement ) == "player" then -- make sure that it's a player warpPedIntoVehicle(hitElement, getCar ) -- warps the hitted element in the car end end end ) Link to comment
justn Posted March 8, 2014 Author Share Posted March 8, 2014 No, note from the wiki: "The source of this event is the marker that got hit by the element." Haha, i realized that when I was gonna test the script. 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