According to this LUA....can i prevent other players from stealing the boat (line 19) by using this function?
function stop (thePlayer)
if source == boat and not isElementVisibleTo(blip,thePlayer) then
cancelEvent()
end
end
addEventHandler ("OnVehicleEnter,root,stop)
this is just the idea ^^^
question two....how to do a function when the fisher gets on the boat?
local fishmark = createMarker ( -2185.32202, 2416.38135, 4.5, "cylinder", 1.5, 255, 255, 0, 255 )
createBlipAttachedTo ( fishmark, 9 )
function outPut ( hitElement, matchingDimension )
if not isPedInVehicle ( hitElement ) and not (getElementData ( hitElement, "fisher" ) == true) then
outputChatBox ( "Press E to start the job", hitElement, 255, 255, 0, true )
end
if not isPedInVehicle ( hitElement ) and (getElementData ( hitElement, "fisher" ) == true) then
outputChatBox ( "You have already started the job before", hitElement, 255, 255, 0, true )
end
end
addEventHandler( "onMarkerHit", fishmark, outPut )
function start ( hitElement, key, keyState )
local name = getPlayerName (hitElement)
if not isPedInVehicle ( hitElement ) and not (getElementData ( hitElement, "fisher" ) == true) then
if hitElement then
setElementData ( hitElement, "fisher", true )
local boat = createVehicle ( 473, -2218.21387, 2419.93970, 1 )
local blip = createBlipAttachedTo ( boat, 56 )
setElementVisibleTo ( blip, root, false )
setElementData ( boat, "myboat", name )
setElementVisibleTo ( blip, hitElement, true )
outputChatBox ( "Your boat is in the water, find it and start your job", hitElement, 255, 255, 0, true )
unbindKey ( hitElement, "E", "down", start )
end
end
end
function bind (hitElement, matchingDimension)
bindKey ( hitElement, "E", "down", start )
end
addEventHandler( "onMarkerHit", fishmark, bind )
function unbind ( hitElement, matchingDimension )
unbindKey ( hitElement, "E", "down", start )
end
addEventHandler( "onMarkerLeave", fishmark, unbind )