Jump to content

A few questions...


Xeno

Recommended Posts

Could you answer these questions for me?

Is it possible to minus a certain amount of health from the player? (This is for changing how powerful a gun is)

Is it possible to get a players weapon? like,

if getPlayerGun(m4, ect ect? 

I know about getPedWeapon, but thats only for weapon slots, not weapon ID's.

Link to comment
What do you mean? set player health? if so
setElementHealth 

I never thought of that... Tell me, would* this work?

function minusHealth(player) 
    local playerHealth = getElementHealth ( getLocalPlayer() ) 
setElementHealth( player, playerHeath-50) 

Its meant to minus -50 health, would it work if the function was finished?

Link to comment
Show us how are you using the function.
function playerDamage_text ( attacker, weapon, bodypart, loss, player )  
    if ( bodypart == 9 ) then  
local pedSlot = getPedWeaponSlot ( attacker ) 
    if (pedSlot == 6)   then     
        killPed ( source) 
triggerClientEvent(attacker,"playKillSound",root) 
elseif (pedSlot == 5) then 
setElementHealth(player,getElementHealth(player)-50) 
triggerClientEvent(attacker,"playKillSound2",root) 
  
end 
end 
end 
addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage_text ) 
  

Link to comment
function playerDamage_text ( attacker, weapon, bodypart, loss) 
    if ( bodypart == 9 ) then 
local pedSlot = getPedWeaponSlot ( attacker ) 
    if (pedSlot == 6)   then    
        killPed ( source) 
triggerClientEvent(attacker,"playKillSound",root) 
elseif (pedSlot == 5) then 
setElementHealth(source,getElementHealth(source)-50) 
triggerClientEvent(attacker,"playKillSound2",root) 
end 
end 
end 
addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage_text ) 

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