Jump to content

HELP - BELT


Recommended Posts

Posted

Hii there ,,

This is belt script

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 ) 

How to edit this script , so when i use the belt, then nobody can hijack my car ,,

And when i use the belt , then i can't throw out from vehicle when crash...

Posted (edited)
  
function onVehicleStartEnter(thePlayer, seat, jacked) 
    if (isElement(jacked) and seat == 0 and getElementData( jacked, "seatbelt" )) then 
        outputChatBox( getPlayerName(jacked).." uses his belt. Therefore, you are unable to hijack him", thePlayer, 255, 0, 0, false) 
        cancelEvent() 
    end 
end 
addEventHandler( "onVehicleStartEnter", getRootElement(), onVehicleStartEnter ) 
  

edit: just realized that the source was player that starts entering the vehicle, my bad

Edited by Guest
Posted
function onVehicleStartEnter(thePlayer, seat, jacked) 
    if isElement(jacked) and seat == 0 and getElementData(jacked, "seatbelt") then 
        outputChatBox(getPlayerName(jacked).." uses his belt. Therefore, you are unable to hijack him", thePlayer, 255, 0, 0) 
        cancelEvent() 
    end 
end 
addEventHandler("onVehicleStartEnter", root, onVehicleStartEnter) 

Posted
function onAttemptExit(thePlayer) 
    if getElementData(thePlayer, "seatbelt") then 
        cancelEvent(true) 
        outputChatBox("You cannot exit the vehicle while you're wearing your seatbelt.", thePlayer, 255, 0, 0) 
    end 
end 
addEventHandler("onVehicleStartExit", root, onAttemptExit) 

Posted

i use vehicle crash system , so when i got an accident , i will get out from vehicle and play anim /crack , but how to edit this , so when i use belt , i can't throw out of vehicle ?

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