Jump to content

onMarkerHit problem maybe ??


justn

Recommended Posts

So Hi, this problem is when the player hits the marker.. so, when the player its gangsterMarker, nothing happens, can fix please ? :/

This is when created the marker

function onStart () 
    noobMark1 = createMarker ( 725.35363769531, -1276.3233642578, 14.1884375, "arrow", 1, 0, 255, 0, 85) 
    noobmark2 = createMarker ( 691.57635498047, -1275.9288330078, 14.1884375, "arrow", 1, 0, 255, 0, 85) 
    exports [ "TopBarChat" ] : sendClientMessage ( "the mission will start in 90 seconds !", root, 0, 0, 255, true ) 
    setTimer(function() 
    destroyElement(noobMark1) 
    destroyElement(noobMark2) 
    exports [ "TopBarChat" ] : sendClientMessage ( "the mission will be started soon !", root, 0, 0, 255, true ) 
    local gangsterMarker = createMarker ( 725.35363769531, -1276.3233642578, 14.1884375, "arrow", 1, 255, 0, 0, 85) 
    local policeMarker = createMarker ( 691.57635498047, -1275.9288330078, 14.1884375, "arrow", 1, 0, 0, 255, 85 ) 
    end, 5000, 1 ) 
    end 
addEventHandler("onResourceStart",resourceRoot,onStart) 

-- this is on marker hit

addEventHandler("onMarkerHit", gangsterMarker, 
function (player,interior,dimension) 
if not isPlayerInTeam(player,"Police" ) and ( not isPlayerInTeam ( player, "Medic" ) ) then  
exports [ "TopBarChat" ] : sendClientMessage (  the mission Coming Soon", player, 255, 0, 0, true ) 
setElementInterior ( player, 5, 1300.1059570313, -792.5771484375, 1085.00778125 ) 
setElementDimension ( player, 5 ) 
setElementFrozen ( player, true ) 
setTimer ( function() 
exports [ "TopBarChat" ] : sendClientMessage ( "the mission Started !!!", player, 255, 0, 0, true ) 
setElementFrozen( player,false) 
end, 5000, 1 ) 
elseif isPlayerInTeam(player,"Police") then 
exports [ "TopBarChat" ] : sendClientMessage ( "You are a Police, you can't enter here", player, 0, 0, 255, true ) 
elseif isPlayerInTeam(player,"Medic") then 
exports [ "TopBarChat" ] : sendClientMessage ( "the mission Coming Soon", player, 0, 155, 255, true ) 
setElementInterior ( player, 5, 1300.1059570313, -792.5771484375, 1085.00778125 ) 
setElementDimension ( player, 5 ) 
setElementFrozen ( player, true ) 
setTimer ( function() 
setElementFrozen( player,false) 
end, 5000, 1 ) 
end 
end) 
 

Link to comment
  • Moderators

The code shows your mistake directly. You were not wondering why most of it was red?

  
exports [ "TopBarChat" ] : sendClientMessage ( [color=#FF0000][b] "[/b][/color]the mission Coming Soon", player, 255, 0, 0, true ) 

Link to comment

On line 4 (of the marker hit) you forgot to put the first " for the string in the sendClientMessage function.

I also fixed bugs with the timers.

addEventHandler("onMarkerHit", gangsterMarker, function (player,interior,dimension) 
    if not isPlayerInTeam(player,"Police" ) and ( not isPlayerInTeam ( player, "Medic" ) ) then 
        exports [ "TopBarChat" ] : sendClientMessage (  "the mission Coming Soon", player, 255, 0, 0, true ) 
        setElementInterior ( player, 5, 1300.1059570313, -792.5771484375, 1085.00778125 ) 
        setElementDimension ( player, 5 ) 
        setElementFrozen ( player, true ) 
        setTimer ( function( player ) 
            exports [ "TopBarChat" ] : sendClientMessage ( "the mission Started !!!", player, 255, 0, 0, true ) 
            setElementFrozen( player,false) 
        end, 5000, 1, player ) 
    elseif isPlayerInTeam(player,"Police") then 
        exports [ "TopBarChat" ] : sendClientMessage ( "You are a Police, you can't enter here", player, 0, 0, 255, true ) 
    elseif isPlayerInTeam(player,"Medic") then 
        exports [ "TopBarChat" ] : sendClientMessage ( "the mission Coming Soon", player, 0, 155, 255, true ) 
        setElementInterior ( player, 5, 1300.1059570313, -792.5771484375, 1085.00778125 ) 
        setElementDimension ( player, 5 ) 
        setElementFrozen ( player, true ) 
        setTimer ( function( player ) 
        setElementFrozen( player,false) 
        end, 5000, 1, player ) 
    end 
end ) 
  

Link to comment

Doesn't work still, I figured out the problem now. The problem happened when i added the markers to the function on top. I removed the markers and it started to work .. So can someone help me create the markers outside of the function ? and after some seconds the gangsterMarker and policeMarker will show ? :P

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