Jump to content

Bug or ... ?


Nikolay_888

Recommended Posts

 --server 
function createVehicleForPlayer(thePlayer, command, vehicleModel) 
    local x,y,z = getElementPosition(thePlayer) 
    x = x + 5  
    local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z) 
end 
addCommandHandler("cv", createVehicleForPlayer) 
  
function gVehicleStartEnter (player, seat) 
    if seat == 0 and getVehicleOccupant (source, 0) then 
        cancelEvent () 
        outputChatBox ('stop it', player) 
    end 
end 
addEventHandler ('onVehicleStartEnter', root, gVehicleStartEnter, _, 'high') 
  

When I try to enter to empty created vehicle, event cancelled.

And i try to modify eventHandler like this:

function gVehicleStartEnter (player, seat) 
    if seat == 0 and getVehicleOccupant (source, 0) then 
        cancelEvent () 
        outputChatBox ('stop it', getVehicleOccupant (source, 0)) 
    end 
end 
addEventHandler ('onVehicleStartEnter', root, gVehicleStartEnter, _, 'high') 
  

And now it output chat message to me :)

What is wrong?

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