Jump to content

[HELP] Bus Driver Marker not working


MrJuhis

Recommended Posts

marker = createMarker ( 1808.4814453125, -1909.2841796875, 13.571605682373, "cylinder", 1.1, 0, 255, 0) 
addEventHandler ("onMarkerHit", marker, startMission) 
  
function startMission(hitElement) 
    if getElementType (hitElement) == "player" then 
        local team = getPlayerTeam (hitElement) 
        if getTeamName (team) ~= "Civilians" then 
            local teamName = getTeamName (team) 
            exports["FFS-TopBar"]:outputTopBar( "You have to be Civilian before using Bus Driver Job (/civilian)", hitElement, 255, 246, 7 ) 
            else 
    setElementData( source, "Occupation", "Bus Driver", true ) 
    exports["FFS-TopBar"]:outputTopBar( "You are now a Bus Driver", source, 0, 255, 43 ) 
    setPlayerNametagColor(source, 255, 246, 7) 
    end 
    end 
    end 

Can't get it working, when i enter to marker nothing happens.

Link to comment

try it now

EDITED : yea he can't use the function after the eventhandler .

  
marker = createMarker ( 1808.4814453125, -1909.2841796875, 13.571605682373, "cylinder", 1.1, 0, 255, 0) 
addEventHandler ("onMarkerHit", marker, function() 
     if (getElementType (hitElement) == "player") then 
        local team = getPlayerTeam (hitElement) 
        if getTeamName (team) ~= "Civilians" then 
            local teamName = getTeamName (team) 
            exports["FFS-TopBar"]:outputTopBar( "You have to be Civilian before using Bus Driver Job (/civilian)", hitElement, 255, 246, 7 ) 
            else 
    setElementData( source, "Occupation", "Bus Driver", true ) 
    exports["FFS-TopBar"]:outputTopBar( "You are now a Bus Driver", source, 0, 255, 43 ) 
    setPlayerNametagColor(source, 255, 246, 7) 
    end 
    end 
    end) 
  

Edited by Guest
Link to comment

@Cmtv no you can't add the function handler before the function, you can add the function inside the event handler however like this:

addEventHandler ("onMarkerHit", marker, function(args)  
    -- Code here 
end) 

And on topic, 'source' in the 'onMarkerHit' event is the marker, 'hitElement' is the player in this case. Occupation is set to the marker, a topbar message is displayed... to the marker, and on the line after, you try to set the nametag color on the marker.

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