Jump to content

Dano das armas


Recommended Posts

Posted

Ola eu gostaria de alterar o dano da sniper do meu servidor para matar com 1 tiro eu sei que tem que usar setweaponproperty mas nao sei montar o script alguem me ajuda !!

Posted

tem um script que já vem com o MTA

( headshot )

só ligar ele, e atirar com qualquer arma na cabeça do jogador. apenas 1 tiro na cabeça

Posted
tem um script que já vem com o MTA

( headshot )

só ligar ele, e atirar com qualquer arma na cabeça do jogador. apenas 1 tiro na cabeça

Eu quero que mate em qualquer parte do corpo nao so na cabeça

Posted
tem um script que já vem com o MTA

( headshot )

só ligar ele, e atirar com qualquer arma na cabeça do jogador. apenas 1 tiro na cabeça

Eu quero que mate em qualquer parte do corpo nao so na cabeça

(client-side)

local weapons = {20, 40} -- id da arma 
  
function onClientPedDamage(_, weapon) 
    if(getElementType(source) == "player") then 
       if(weapons[weapon]) then 
           return killPed(source) 
       end 
    end 
end 
addEventHandler("onClientPedDamage", getRootElement(), onClientPedDamage) 

Posted
(client-side)
local weapons = {20, 40} -- id da arma 
  
function onClientPedDamage(_, weapon) 
    if(getElementType(source) == "player") then 
       if(weapons[weapon]) then 
           return killPed(source) 
       end 
    end 
end 
addEventHandler("onClientPedDamage", getRootElement(), onClientPedDamage) 

killPed é server side apenas.

--

for _, v in ipairs ( { "pro", "std", "poor" } ) do 
    setWeaponProperty ( "sniper", v, "damage", 9999 ) 
end 

Posted (edited)
-- Client 
addEventHandler('onClientPlayerDamage', localPlayer, 
    function (attacter,weapon,bodypart) 
        if (attacter and weapon == 34 and bodypart == 9) then    
        triggerServerEvent('killPlayer',source) 
    end 
end) 
  
-- Server 
addEvent('killPlayer', true) 
addEventHandler ('killPlayer', root, 
      function () 
      killPed(client) 
end) 

Edited by Guest
Posted
Hornet noob
-- Client 
addEventHandler('onClientPlayerDamage', localPlayer, 
    function (attacter,weapon,bodypart) 
        if (attacter and weapon == 69 and bodypart == Head) then    
        triggerServerEvent('killPlayer',source) 
    end 
end) 
  
-- Server 
addEvent('killPlayer', true) 
addEventHandler ('killPlayer', root, 
      function () 
      killPed(client) 
end) 

O id da arma está incorreto, pegue os ids necessários aqui: https://wiki.multitheftauto.com/wiki/Weapon.

Posted
(client-side)
local weapons = {20, 40} -- id da arma 
  
function onClientPedDamage(_, weapon) 
    if(getElementType(source) == "player") then 
       if(weapons[weapon]) then 
           return killPed(source) 
       end 
    end 
end 
addEventHandler("onClientPedDamage", getRootElement(), onClientPedDamage) 

killPed é server side apenas.

--

for _, v in ipairs ( { "pro", "std", "poor" } ) do 
    setWeaponProperty ( "sniper", v, "damage", 9999 ) 
end 

Como não? é so cria -__-

function killPed( p)  
    return setElementHealth(p,0)  
end 

Posted
@XeoN- Seu código ainda tem erros, não acho que seja necessário chamar o roots para isso.

o que ta errado filho?

Head deveria ser o id.

if (attacter and weapon == 69 and bodypart == Head) then   

Posted
@XeoN- Seu código ainda tem erros, não acho que seja necessário chamar o roots para isso.

o que ta errado filho?

Head deveria ser o id.

if (attacter and weapon == 69 and bodypart == Head) then   

Na verdade precisa ser 9 e voce ta precisando aulas do roots amigo.

d1de87a.png

Posted

Xeon troque o "attacter" por "attacker" :wink:

sua linha está

if (attacter and weapon == 69 and bodypart == Head) then   

atualizada fica

if (attacker and weapon == 69 and bodypart == Head) then   

se caso tiver mais algum erro, revisa o seu roteiro :wink:

Posted
Xeon troque o "attacter" por "attacker" :wink:

sua linha está

if (attacter and weapon == 69 and bodypart == Head) then   

atualizada fica

if (attacker and weapon == 69 and bodypart == Head) then   

se caso tiver mais algum erro, revisa o seu roteiro :wink:

Não corrige mano, xeon não aprende.

Posted
Xeon troque o "attacter" por "attacker" :wink:

sua linha está

if (attacter and weapon == 69 and bodypart == Head) then   

atualizada fica

if (attacker and weapon == 69 and bodypart == Head) then   

se caso tiver mais algum erro, revisa o seu roteiro :wink:

Isso nao e erro amigo, e apenas o nome e o codigo fuciona bem com attacter e attacker

Posted

o god...

function playerDamage_text ( attacker, weapon, bodypart, loss ) --when a player is damaged 
    if ( bodypart == 9 and weapon == 34) then -- if the body part is 9, i.e. the head 
            outputChatBox ( "Headshot!", getRootElement (), 255, 170, 0 ) --output "Headshot" into the chatbox 
        killPed ( source, attacker, weapon, bodypart ) -- and kill the player 
    end 
end 
addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage_text ) 

https://wiki.multitheftauto.com/wiki/OnPlayerDamage

Posted

Poxa alguem pode me mandar o script que mate com a sniper com apenas 1 tiro em qualquer parte do jogador obg :) ate agr so vi gente brigando U.u

Posted
Poxa alguem pode me mandar o script que mate com a sniper com apenas 1 tiro em qualquer parte do jogador obg :) ate agr so vi gente brigando U.u

ta ai amigo

-- Client 
addEventHandler('onClientPlayerDamage', localPlayer, 
    function (attacter,weapon,bodypart) 
        if (attacter and weapon == 34 and bodypart == 9) then   
        triggerServerEvent('killPlayer',source) 
    end 
end) 
  
-- Server 
addEvent('killPlayer', true) 
addEventHandler ('killPlayer', root, 
      function () 
      killPed(client) 
end) 

Posted
function onPlayerDamage(attacker, weapon, bodypart) 
    if attacker and weapon == 34 then 
        killPed(source, attacker, weapon, bodypart) 
    end 
end 
addEventHandler("onPlayerDamage",root,onPlayerDamage) 

Posted
function onPlayerDamage(attacker, weapon, bodypart) 
    if attacker and weapon == 34 then 
        killPed(source, attacker, weapon, bodypart) 
    end 
end 
addEventHandler("onPlayerDamage",root,onPlayerDamage) 

O Tremidinha postou o mesmo codigo, pra que postar dois vezez a mesma coisa amigo? voce sabia que double-post e proibido aqui?

obs: seu avatar e muietito bueno

Posted
function onPlayerDamage(attacker, weapon, bodypart) 
    if attacker and weapon == 34 then 
        killPed(source, attacker, weapon, bodypart) 
    end 
end 
addEventHandler("onPlayerDamage",root,onPlayerDamage) 

Vlw mano deu certo :)

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...