Jump to content

[SOLVED] onPlayerMarkerHit issue


AndyAndreiH

Recommended Posts

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 by Guest
Link to comment

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

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
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! :D

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