Jump to content

Make a player stand 1 headshot


knightscript

Recommended Posts

I´m currently using the mta resource, but what I don´t know how to do is to check which users can survive 1 headshot, lets say I saw a zombie resource that does the following:

CLIENT SIDE:

  
helmetzombies = {13,22,23,24} 
function zombiedamaged ( attacker, weapon, bodypart ) 
    if getElementType ( source ) == "ped" then 
        if (getElementData (source, "zombie") == true) then 
            if ( bodypart == 9 ) then 
                helmeted = "no" 
                local zskin = getElementModel ( source ) 
                for k, skin in pairs( helmetzombies ) do 
                    if skin == zskin then 
                        helmeted = "yes" 
                    end 
                end 
                if helmeted == "no" then 
                    triggerServerEvent ("headboom", source, source, attacker, weapon, bodypart ) 
                end 
            end 
        end 
    end 
end 
addEventHandler ( "onClientPedDamage", getRootElement(), zombiedamaged ) 
  

SERVER SIDE:

  
addEvent( "headboom", true ) 
function Zheadhit ( ped,attacker, weapon, bodypart) 
    if (getElementData (ped, "zombie") == true) then 
        killPed ( ped, attacker, weapon, bodypart ) 
        setPedHeadless  ( ped, true ) 
    end 
end 
addEventHandler( "headboom", getRootElement(), Zheadhit ) 

Maybe there is a way to adapt this code to check for users?

Link to comment

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