Xeno Posted December 11, 2011 Share Posted December 11, 2011 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
Castillo Posted December 11, 2011 Share Posted December 11, 2011 You can do: getPedWeapon(thePlayer) and it'll return player's weapon ID. Link to comment
Xeno Posted December 11, 2011 Author Share Posted December 11, 2011 You can do: getPedWeapon(thePlayer) and it'll return player's weapon ID. I see, and how would I minus a certain ammount of health from the player? Link to comment
Castillo Posted December 11, 2011 Share Posted December 11, 2011 What do you mean? set player health? if so setElementHealth Link to comment
Xeno Posted December 11, 2011 Author Share Posted December 11, 2011 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
TAPL Posted December 11, 2011 Share Posted December 11, 2011 function minusHealth(player) setElementHealth(player,getElementHealth(player)-50) end Link to comment
Xeno Posted December 11, 2011 Author Share Posted December 11, 2011 function minusHealth(player) setElementHealth(player,getElementHealth(player)-50) end I get a bad arguement @ getPlayerHealth, and attempt to perform arithmetic on a boolean value Link to comment
Castillo Posted December 11, 2011 Share Posted December 11, 2011 Show us how are you using the function. Link to comment
Xeno Posted December 11, 2011 Author Share Posted December 11, 2011 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
TAPL Posted December 11, 2011 Share Posted December 11, 2011 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
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