Jump to content

[HELP] Seatbelt system


Recommended Posts

Hii anyone , how to change this script , so when seatbelt is on , then the player can't get out from vehicle and when seatbelt on then cancelEvent 'crashThrowPlayerFromVehicle'

function seatbelton ( player ) 
    local check = isPedInVehicle ( player ) 
    if ( check ) then 
        local state = ( not getElementData ( player, "seatbelt" ) ) 
        setElementData ( player, "seatbelt", state ) 
        exports.global:sendLocalMeAction ( player, "takes their seatbelt ".. ( state and "on" or "off" ) ) 
    else 
        outputChatBox ( "You are not in a car!", player, 255, 0, 0 ) 
    end 
end 
addCommandHandler ( "seatbelt", seatbelton ) 

Link to comment
function seatbelton ( player ) 
    if isPedInVehicle ( player ) then 
       if getElementData ( player, "seatbelt" ) ) then 
cancelEvent () 
end 
addEventHandler ( "onVehicleStartExit", getRootElement(), seatbelton ) 
         
  

not tested dunno if it will work

Link to comment
function seatbelton ( player ) 
    if isPedInVehicle ( player ) then 
       if getElementData ( player, "seatbelt" ) ) then 
cancelEvent () 
end 
addEventHandler ( "onVehicleStartExit", getRootElement(), seatbelton ) 
         
  

not tested dunno if it will work

function seatbelton ( player ) 
    if isPedInVehicle ( player ) then 
       if getElementData ( player, "seatbelt" ) ) then 
       cancelEvent () 
       end 
    end 
end 
addEventHandler ( "onVehicleStartExit", getRootElement(), seatbelton )  

you missed 2 end

Link to comment

Just add event with this function ??

function seatbelton ( player ) 
    if isPedInVehicle ( player ) then 
       if getElementData ( player, "seatbelt" ) ) then 
       cancelEvent () 
       end 
    end 
end 
addEventHandler ( "onVehicleStartExit", getRootElement(), seatbelton )  

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