Mec.Love Posted June 18, 2020 Share Posted June 18, 2020 E aí galera, blz? Peguei um script de desmanche na net e queria bloquear alguns ID's de veiculos que tenho em meu servidor... Sejam eles dos vip e das corp o script é o seguinte markerPed = createMarker(-2181.60546875, 709.8701171875, 52.950625, "cylinder", 1, 255, 0, 0, 50) markerVeh = createMarker(-2178.94897, 715.82697, 52.8908, "cylinder", 3.5, 255, 0, 0, 50) function execDesmanche() local vehicle = getVehicleInMarker(markerVeh) if vehicle then setElementPosition(vehicle, -2185.39893, 703.11169, 53.89063) local price = math.random(5000, 25000) givePlayerMoney(source, price) outputChatBox("Veiculo desmanchado, você ganhou #00ff00"..price.."$", source, 255, 255, 255, true) setTimer(function () setVehicleDoorState(vehicle, 0, 4) setVehicleDoorState(vehicle , 1, 4) setVehicleDoorState(vehicle, 2, 4) setVehicleDoorState(vehicle, 3, 4) setVehicleDoorState(vehicle, 4, 4) setVehicleDoorState(vehicle, 5, 4) setVehicleWheelStates(vehicle, 2, 2, 2, 2) setVehiclePanelState ( vehicle, 4, 3 ) setVehicleLightState(vehicle, 0, 1) setVehicleLightState(vehicle, 1, 1) setVehicleLightState(vehicle, 2, 1) setVehicleLightState(vehicle, 3, 1) setElementHealth(vehicle, 350) setVehicleEngineState( vehicle , false) setTimer(destroyElement, 10000, 1, vehicle) end, 500, 1) else outputChatBox("Nenhum veiculo encontrado!", source, 255, 0, 0, true) end end addEvent("execDesmanche", true) addEventHandler("execDesmanche", root, execDesmanche) Oq eu tenho que usar para bloquear? Link to comment
MrKAREEM Posted June 18, 2020 Share Posted June 18, 2020 1 hour ago, Mec.Love said: Oq eu tenho que usar para bloquear? eu não sabia o que realmente você está tentando fazer, mas crie uma tabela com o ID do veículo que você deseja bloquear então verifique se o veículo é igual a qualquer id na tabela para cancelar o evento como este : ids = {592,577,511,425} -- Nesta tabela para bloquear alguns aviões, você pode alterar os IDs markerPed = createMarker(-2181.60546875, 709.8701171875, 52.950625, "cylinder", 1, 255, 0, 0, 50) markerVeh = createMarker(-2178.94897, 715.82697, 52.8908, "cylinder", 3.5, 255, 0, 0, 50) function execDesmanche() local vehicle = getVehicleInMarker(markerVeh) if vehicle then if ids[getElementModel(vehicle)] then return outputChatBox('este veículo está bloqueado!',source,255,0,0) end -- isso verifica se o modelo de veículo atual encontrado na tabela, cancele-o com uma mensagem setElementPosition(vehicle, -2185.39893, 703.11169, 53.89063) local price = math.random(5000, 25000) givePlayerMoney(source, price) outputChatBox("Veiculo desmanchado, você ganhou #00ff00"..price.."$", source, 255, 255, 255, true) setTimer(function () setVehicleDoorState(vehicle, 0, 4) setVehicleDoorState(vehicle , 1, 4) setVehicleDoorState(vehicle, 2, 4) setVehicleDoorState(vehicle, 3, 4) setVehicleDoorState(vehicle, 4, 4) setVehicleDoorState(vehicle, 5, 4) setVehicleWheelStates(vehicle, 2, 2, 2, 2) setVehiclePanelState ( vehicle, 4, 3 ) setVehicleLightState(vehicle, 0, 1) setVehicleLightState(vehicle, 1, 1) setVehicleLightState(vehicle, 2, 1) setVehicleLightState(vehicle, 3, 1) setElementHealth(vehicle, 350) setVehicleEngineState( vehicle , false) setTimer(destroyElement, 10000, 1, vehicle) end, 500, 1) else outputChatBox("Nenhum veiculo encontrado!", source, 255, 0, 0, true) end end addEvent("execDesmanche", true) addEventHandler("execDesmanche", root, execDesmanche) divirta-se 1 Link to comment
Mec.Love Posted June 18, 2020 Author Share Posted June 18, 2020 1 hour ago, MrKAREEM said: divirta-se Olá, testei oque vc disse, porém não funcionou. Eu só queria bloquear alguns ID'S de veiculos dos vips, para não bugarem dinheiro. os veiculos bloqueados não poderiam ser desmanchados, assim não ganhando dinheiro Link to comment
MrKAREEM Posted June 18, 2020 Share Posted June 18, 2020 (edited) 2 minutes ago, Mec.Love said: Olá, testei oque vc disse, porém não funcionou. Eu só queria bloquear alguns ID'S de veiculos dos vips, para não bugarem dinheiro. os veiculos bloqueados não poderiam ser desmanchados, assim não ganhando dinheiro meu código funciona se você obtiver os IDs do seu sistema VIP e substituí-los pelos IDs na tabela ids = {592,577,511,425} -- altere os IDs com seus IDs de carros vip Edited June 18, 2020 by MrKAREEM Link to comment
Mec.Love Posted June 18, 2020 Author Share Posted June 18, 2020 2 minutes ago, MrKAREEM said: meu código funciona se você obtiver os IDs do seu sistema VIP e substituí-los pelos IDs na tabela infelizmente não funcionou. Link to comment
MrKAREEM Posted June 18, 2020 Share Posted June 18, 2020 mostrar seus códigos ou mostrar se houve erros de depuração? Link to comment
ber Posted June 18, 2020 Share Posted June 18, 2020 Não é o jeito certo mas o importante é que funciona: local id = getElementModel(altere aqui pela var do veiculo) if id ~= 418 and id ~= 416 and id ~= 433 and id ~= 427 and id ~= 490 then ......... ... ....... ..... else outputChatBox("Você não pode desmanchar este veículo", source) end end Essa função irá ver o ID do veículo que estão tentando desmanchar e se for diferente de todos esses IDs aí ele irá aceitar. Mas como o colega informou aí encima, o correto é utilizar tabela para deixar o código mais "organizado". 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