Herc Posted April 23, 2020 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!
Moderators Lord Henry Posted April 23, 2020 Moderators Posted April 23, 2020 Trancar veículo por fora: setVehicleLocked Trancar veículo por dentro: use cancelEvent() no evento onVehicleStartExit. 1 Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
Herc Posted April 23, 2020 Author 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
Moderators Lord Henry Posted April 24, 2020 Moderators Posted April 24, 2020 Qual parte n deu certo? Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
Herc Posted April 24, 2020 Author Posted April 24, 2020 Quando eu tranco o carro, as pessoas podem sair.
Moderators Lord Henry Posted April 24, 2020 Moderators 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 Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
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