Herc Posted April 23, 2020 Share Posted April 23, 2020 Olá queria saber como fazer um script de trancar veículo, e tipo, as pessoas que estiverem dentro do veículo, não poder sair! Link to comment
Other Languages Moderators Lord Henry Posted April 23, 2020 Other Languages Moderators Share Posted April 23, 2020 Trancar veículo por fora: setVehicleLocked Trancar veículo por dentro: use cancelEvent() no evento onVehicleStartExit. 1 Link to comment
Herc Posted April 23, 2020 Author Share Posted April 23, 2020 Quote function lockcar ( thePlayer ) playervehicle = getPlayerOccupiedVehicle ( thePlayer ) -- define 'playervehicle' as the vehicle the player is in if ( playervehicle ) then -- if a player is in a vehicle if isVehicleLocked ( playervehicle ) then -- and if the vehicle is already locked setVehicleLocked ( playervehicle, false ) -- unlock it else -- otherwise (if it isn't locked) setVehicleLocked ( playervehicle, true ) -- lock it end end end function bindLockOnSpawn ( theSpawnpoint ) -- when a player spawns bindKey ( source, "l", "down", lockcar ) -- bind the 'l' key to the 'lockcar' function end addEventHandler ( "onPlayerSpawn", getRootElement(), bindLockOnSpawn ) -- call 'stopVehicleEntry' whenever hunterPlayer is about to enter a vehicle: function stopVehicleEntry ( theplayer, seat, jacked ) cancelEvent() -- stop the event, the player will can't enter in vehicle end addEventHandler("onVehicleStartEnter", getRootElement(), stopVehicleEntry) local policeVehicles = {[598] = true,[596] = true,[597] = true,[599] = true } -- Police vehicle IDs local policeSkins = {[280] = true,[281] = true,[282] = true,[283] = true,[284] = true,[285] = true,[286] = true } -- Police Skins function exitVehicle ( thePlayer, seat, jacked ) if (policeVehicles[getElementModel (source)]) and (policeSkins[getElementModel(thePlayer)]) then outputChatBox ( "You're the cop! Don't exit the car!", thePlayer ) cancelEvent() end end addEventHandler ( "onVehicleStartExit", getRootElement(), exitVehicle) Isso? Tentei, mas n deu nd Link to comment
Other Languages Moderators Lord Henry Posted April 24, 2020 Other Languages Moderators Share Posted April 24, 2020 Qual parte n deu certo? Link to comment
Herc Posted April 24, 2020 Author Share Posted April 24, 2020 Quando eu tranco o carro, as pessoas podem sair. Link to comment
Other Languages Moderators Lord Henry Posted April 24, 2020 Other Languages Moderators Share Posted April 24, 2020 function exitVehicle (thePlayer, seat, jacked) if (isVehicleLocked (source)) then outputChatBox ("The door is locked! You can't exit the vehicle!", thePlayer) cancelEvent() end end addEventHandler ("onVehicleStartExit", root, exitVehicle) 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now