AndyAndreiH Posted January 4, 2014 Share Posted January 4, 2014 (edited) Hello! I have the function bellow. The problem is, the message "registered" does not appear and none of the script executes. Any ideas why does this not work? Serverside Function: function markerHit (marker) outputChatBox("Registered", source, 0, 255, 0) local vehicle = getPedOccupiedVehicle(source) if not vehicle then return end local model = getElementModel(vehicle) if not model then return end local mailveh = getElementData(vehicle, "mailivery:vehicle") if not mailveh == 1 then return end if model == 403 then [...] end end addEventHandler("onPlayerMarkerHit", getRootElement(), markerHit) Any help is appreciated! EDIT: NOTE: The [...] symbol is not actually in the script, it just denotes the fact that a portion of the script has been removed to shorten it. Also, NO errors are thrown in the console. Edited January 4, 2014 by Guest Link to comment
Castillo Posted January 4, 2014 Share Posted January 4, 2014 You're hitting the marker with a vehicle? Link to comment
AndyAndreiH Posted January 4, 2014 Author Share Posted January 4, 2014 Yes, that's the idea, but I also tried hitting it with the player and still nothing happened. Link to comment
Castillo Posted January 4, 2014 Share Posted January 4, 2014 Can you show us the marker creation code? Link to comment
AndyAndreiH Posted January 4, 2014 Author Share Posted January 4, 2014 Clientside Function: function setupTruck() marker_shipyardsf = createMarker(-1725.119140625, -122.5146484375, 2.552172088623, "cylinder", 4.0, 255, 255, 0) exports['anticheat-system']:changeProtectedElementDataEx(marker_shipyardsf, "mailivery:marker", "sf", false) blip_shipyardsf = createBlip(-1725.119140625, -122.5146484375, 4.1399579048157, 51) marker_shipyardlv = createMarker(2346.4501953125, 2754.2451171875, 9.8203125, "cylinder", 4.0, 255, 255, 0) exports['anticheat-system']:changeProtectedElementDataEx(marker_shipyardlv, "mailivery:marker", "lv", false) blip_shipyardlv = createBlip(2346.4501953125, 2754.2451171875, 11.8203125, 51) marker_shipyardls = createMarker(2567.7392578125, -2451.5673828125, 12.626173019409, "cylinder", 4.0, 255, 255, 0) exports['anticheat-system']:changeProtectedElementDataEx(marker_shipyardls, "mailivery:marker", "ls", false) blip_shipyardls = createBlip(2567.7392578125, -2451.5673828125, 14.626173019409, 51) end There. Link to comment
Castillo Posted January 4, 2014 Share Posted January 4, 2014 Well, there's your problem, the server doesn't know about these markers. Link to comment
Saml1er Posted January 4, 2014 Share Posted January 4, 2014 If you're hitting the marker with a vehicle then. -- Client sided Marker = createMarker (1811.0029296875, 1076.5595703125, 6.734375, "cylinder", 2.0, 0, 255,255) function MyMarker(hitPlayer) if hitPlayer~=localPlayer then return end local vehicle = getPedOccupiedVehicle(hitPlayer) if vehicle and source==Marker then -- YOUR CODE end end end addEventHandler ("onClientMarkerHit", resourceRoot, MyMarker) Link to comment
AndyAndreiH Posted January 4, 2014 Author Share Posted January 4, 2014 If you're hitting the marker with a vehicle then. -- Client sided Marker = createMarker (1811.0029296875, 1076.5595703125, 6.734375, "cylinder", 2.0, 0, 255,255) function MyMarker(hitPlayer) if hitPlayer~=localPlayer then return end local vehicle = getPedOccupiedVehicle(hitPlayer) if vehicle and source==Marker then -- YOUR CODE end end end addEventHandler ("onClientMarkerHit", resourceRoot, MyMarker) This'll work! Thank you for your help! 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