Jump to content

BASE SCRIPT [AJUDA]


Recommended Posts

Posted

Primeiramente, desculpe por estar postando muitas coisas aqui pois minha primeira vez criando um server rpg antigamente mexia com mta:dayz, mais vocês estão me ajudando muito estão me dando noção por isso estou tentando achar um forma de recompensar quem está me ajudando, mais muito obrigado a todos ^^

bem o script funciona o seguinte, quando o veiculo estiver em uma determinada HP (que no caso o HP seria 10%), o veiculo ficaria indestrutível e o motor não pegaria || isso com todos os carros existentes no servidor , quem poderia me mandar a base para criar eu agradeceria ^^

Posted
'OnVehicleDamage' -- evento 
cancelEvent 
getElementHealth 
getVehicleEngineState 

jIcd9sc.png

Not worry about the future. Very soon it will come.

Posted
'OnVehicleDamage' -- evento 
cancelEvent 
getElementHealth 
getVehicleEngineState 

está correto?

function stopVehicleEntry ( theplayer,theVehicle, seat, jacked ) 
    getElementHealth ( theVehicle, 10) 
    setVehicleEngineState ( theVehicle, not state ) 
   cancelEvent () -- stop the event from occuring 
end 
addEventHandler ( "OnVehicleDamage", getRootElement(), stopVehicleEntry ) 

Posted

Não, você precisa verificar se o veiculo tem 10% de HP, que no caso seria 100, você pode verificar isso dessa forma:

if getElementHealth(veiculo) ==  100 then 

se o valor for igual, você vai cancelar o evento usando cancelEvent e vai desligar o motor do veiculo usando setVehicleEngineState

@Edit

Eu esqueci que toda vez que o player entra em um veiculo o motor é ligado, então você também vai precisar verificar o HP do veiculo quando o player entrar nele e desligar o motor se o HP for igual a 100 (10%). Para isso você vai precisar do evento onPlayerVehicleEnter

jIcd9sc.png

Not worry about the future. Very soon it will come.

Posted (edited)

O que o Banex quis dizer em código:

Obs.: o elemento criado é para uma referência futura, se necessário.

  
  
-- Server-side 
  
  
function pacoca(theVehicle,seat,jacked) 
if getElementHealth(theVehicle) <= 400 then 
    setVehicleEngineState(theVehicle, false) 
    setElementData(theVehicle,"estanaFAIXA",true) 
    setVehicleDamageProof(theVehicle, true) 
end 
end 
addEventHandler("onPlayerVehicleEnter",getRootElement(),pacoca) 
  
function deliciadeoco() 
if getElementHealth(source) <= 400 then 
    setElementData(source,"estanaFAIXA",true) 
    setVehicleDamageProof(source, true) 
    cancelEvent() 
end 
end 
addEventHandler("onVehicleDamage",getRootElement(),deliciadeoco) 
  

@EDIT

Coloquei a função de ficar indestrutível

Edited by Guest
Posted
O que o Banex quis dizer em código:

Obs.: o elemento criado é para uma referência futura, se necessário.

  
  
-- Server-side 
  
  
function pacoca(theVehicle,seat,jacked) 
if getElementHealth(theVehicle) <= 400 then 
    setVehicleEngineState(theVehicle, false) 
    setElementData(theVehicle,"estanaFAIXA",true) 
    cancelEvent() 
end 
end 
addEventHandler("onPlayerVehicleEnter",getRootElement(),pacoca) 
  
function deliciadeoco() 
if getElementHealth(source) <= 400 then 
    setElementData(source,"estanaFAIXA",true) 
    cancelEvent() 
end 
end 
addEventHandler("onVehicleDamage",getRootElement(),deliciadeoco) 
  

Muito obrigado Neves768, não estava entendendo bem.

Posted
'OnVehicleDamage' -- evento 
cancelEvent 
getElementHealth 
getVehicleEngineState 

Muito obrigado Banex por ter me mandado a base, é que eu tentei tentei e não consegui mais você tentou ajudar muito obrigado mesmo é bom saber que tem pessoas que ajudam as outras (y)

Posted
O que o Banex quis dizer em código:

Obs.: o elemento criado é para uma referência futura, se necessário.

  
  
-- Server-side 
  
  
function pacoca(theVehicle,seat,jacked) 
if getElementHealth(theVehicle) <= 400 then 
    setVehicleEngineState(theVehicle, false) 
    setElementData(theVehicle,"estanaFAIXA",true) 
    cancelEvent() 
end 
end 
addEventHandler("onPlayerVehicleEnter",getRootElement(),pacoca) 
  
function deliciadeoco() 
if getElementHealth(source) <= 400 then 
    setElementData(source,"estanaFAIXA",true) 
    cancelEvent() 
end 
end 
addEventHandler("onVehicleDamage",getRootElement(),deliciadeoco) 
  

Muito obrigado Neves768, não estava entendendo bem, muito obrigado mesmo ^^

Posted
O que o Banex quis dizer em código:

Obs.: o elemento criado é para uma referência futura, se necessário.

  
  
-- Server-side 
  
  
function pacoca(theVehicle,seat,jacked) 
if getElementHealth(theVehicle) <= 400 then 
    setVehicleEngineState(theVehicle, false) 
    setElementData(theVehicle,"estanaFAIXA",true) 
setVehicleDamageProof(theVehicle, true) 
    cancelEvent() 
end 
end 
addEventHandler("onPlayerVehicleEnter",getRootElement(),pacoca) 
  
function deliciadeoco() 
if getElementHealth(source) <= 400 then 
    setElementData(source,"estanaFAIXA",true) 
setVehicleDamageProof(source, true) 
    cancelEvent() 
end 
end 
addEventHandler("onVehicleDamage",getRootElement(),deliciadeoco) 
  

@EDIT

Coloquei a função de ficar indestrutível

tentei arrumar um bug que esta acontecendo, o motor não desliga tentei fazer de varias maneiras para funcionar e não consegui

Posted

@neves768, você não pode cancelar o evento onPlayerVehicleEnter

tentei arrumar um bug que esta acontecendo, o motor não desliga tentei fazer de varias maneiras para funcionar e não consegui

Mostre o código que você tem agora

jIcd9sc.png

Not worry about the future. Very soon it will come.

Posted
nenhum está funcionando ainda, deve ser esse cancelEvent mesmo, ou não

kkkkk todos nós estamos apanhando com isso LOLL

@Pedro, você é pé frio em man ^^ uhasuhasuhas

 DUyJ810.gif

Posted
nenhum está funcionando ainda, deve ser esse cancelEvent mesmo, ou não

kkkkk todos nós estamos apanhando com isso LOLL

@Pedro, você é pé frio em man ^^ uhasuhasuhas

Não entendi o termo "Pé frio" mais dboa, estou tentando arrumar aqui do meu jeito vamos ver '-

Posted

Pedro eu testei o exemplo do neves768 e funcionou... Lembre-se que o HP do carro precisa ter um valor igual ou menor que 400.

jIcd9sc.png

Not worry about the future. Very soon it will come.

Posted
Pedro eu testei o exemplo do neves768 e funcionou... Lembre-se que o HP do carro precisa ter um valor igual ou menor que 400.

já sei pq só estava pegando para ficar indestrutivel, na verdade os 2 estava pegando, unica coisa é que o quando o player tiver dentro do carro e atingir o hp escolhido no script o carro fica indestrutivel mais o motor n desliga só desliga se ele sair e entrar no carro novamente

Posted

Tente esse

  
  
-- Server-side 
  
  
function pacoca(theVehicle,seat,jacked) 
if getElementHealth(theVehicle) <= 10 then 
    setVehicleEngineState(theVehicle, false) 
    setElementData(theVehicle,"estanaFAIXA",true) 
    setVehicleDamageProof(theVehicle, true) 
end 
end 
addEventHandler("onPlayerVehicleEnter",getRootElement(),pacoca) 
  
function Saindo(theVehicle,seat,jacked) 
    setVehicleDamageProof(theVehicle, false) -- se você quiser que ele continue blindado quando sair do veiculo coloque TRUE 
end 
addEventHandler("onPlayerVehicleExit",getRootElement(),Saindo) 
  
function deliciadeoco() 
if getElementHealth(source) <= 10 then 
    setVehicleEngineState(theVehicle, false) 
    setElementData(source,"estanaFAIXA",true) 
    setVehicleDamageProof(source, true) 
    cancelEvent() 
end 
end 
addEventHandler("onVehicleDamage",getRootElement(),deliciadeoco) 
  

 DUyJ810.gif

Posted
Tente esse
  
  
-- Server-side 
  
  
function pacoca(theVehicle,seat,jacked) 
if getElementHealth(theVehicle) <= 10 then 
    setVehicleEngineState(theVehicle, false) 
    setElementData(theVehicle,"estanaFAIXA",true) 
    setVehicleDamageProof(theVehicle, true) 
end 
end 
addEventHandler("onPlayerVehicleEnter",getRootElement(),pacoca) 
  
function Saindo(theVehicle,seat,jacked) 
    setVehicleDamageProof(theVehicle, false) -- se você quiser que ele continue blindado quando sair do veiculo coloque TRUE 
end 
addEventHandler("onPlayerVehicleExit",getRootElement(),Saindo) 
  
function deliciadeoco() 
if getElementHealth(source) <= 10 then 
    setVehicleEngineState(theVehicle, false) 
    setElementData(source,"estanaFAIXA",true) 
    setVehicleDamageProof(source, true) 
    cancelEvent() 
end 
end 
addEventHandler("onVehicleDamage",getRootElement(),deliciadeoco) 
  

ae funcionou vllw cara

e ali você colocou errado (como você colocou):

if getElementHealth(source) <= 400 then 
    setVehicleEngineState(theVehicle, false) 

como deveria ser:

if getElementHealth(source) <= 400 then 
    setVehicleEngineState(source, false) 

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