ramzi Posted March 29, 2016 Posted March 29, 2016 (edited) Hi guys,i have over here a simple headshot script which i've downloaded from the community: addEvent "onPlayerHeadshot" addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if bodypart == 9 and weapon == 34 then local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss) if result == true then killPed(source, attacker, weapon, bodypart) setPedHeadless( source, true ) setTimer( BackUp, 900, 1, source ) end end end ) function BackUp( source ) if getElementType ( source ) == "player" then setPedHeadless ( source, false ) end end The problem is that i want the "part 9" to be taken off becuase when i shoot the head,the player dies but the head still in its place ,thank you. Edited April 7, 2016 by Guest
swedishboy Posted March 29, 2016 Posted March 29, 2016 The problem is taht you added the script Client-side add it to Server-side
Saml1er Posted March 29, 2016 Posted March 29, 2016 Just remove line 9 (timer) from the code that you posted and add this code at bottom addEventHandler("onPlayerSpawn", root, function () setPedHeadless( source, false) end )
ramzi Posted March 29, 2016 Author Posted March 29, 2016 addEvent "onPlayerHeadshot" addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if bodypart == 9 and weapon == 34 then local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss) if result == true then killPed(source, attacker, weapon, bodypart) setPedHeadless( source, true ) addEventHandler("onPlayerSpawn", root, function () setPedHeadless( source, false) end ) end end end ) function BackUp( source ) if getElementType ( source ) == "player" then setPedHeadless ( source, false ) end end I did like this and it stills not working.
swedishboy Posted March 29, 2016 Posted March 29, 2016 I guess you start the headshot script that already exist, rename is like this in your Meta "Headshot" type="script" version="1.0.0" /> with a big H and 2st o like this Headshoot
swedishboy Posted March 29, 2016 Posted March 29, 2016 The script works fine for me, tested it.. So dont understand why it didnt work for you
ramzi Posted March 30, 2016 Author Posted March 30, 2016 Solved,the reason was my gameplay mod,becuz players were respawning fast.
ramzi Posted March 30, 2016 Author Posted March 30, 2016 The script works fine for me, tested it.. So dont understand why it didnt work for you Can i ask for something else please?i want to ristrict it to a team,can u help me?
swedishboy Posted March 30, 2016 Posted March 30, 2016 Try this one addEvent "onPlayerHeadshot" addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if getElementType ( attacker ) == "player" then if bodypart == 9 and weapon == 34 then local HSteam = getPlayerTeam(attacker) if HSteam and getTeamName(HSteam)=="YOUR GANG NAME HERE" then local result = triggerEvent("onPlayerHeadshot",source, attacker, weapon, loss) if result == true then killPed(source, attacker, weapon, bodypart) setPedHeadless( source, true ) addEventHandler("onPlayerSpawn", root, function () setPedHeadless( source, false) end ) end end end end end ) function BackUp( source ) if getElementType ( source ) == "player" then setPedHeadless ( source, false ) end end
Anubhav Posted March 31, 2016 Posted March 31, 2016 local restrict_team = "team name here" addEvent("onPlayerHeadshot", true ) addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if getElementType ( attacker ) == "player" then if bodypart == 9 and weapon == 34 then local HSteam = getPlayerTeam(attacker) if HSteam == getTeamFromName( restrict_team ) then local result = triggerEvent("onPlayerHeadshot",source, attacker, weapon, loss) if result == true then killPed(source, attacker, weapon, bodypart) setPedHeadless( source, true ) addEventHandler("onPlayerSpawn", root, function () setPedHeadless( source, false) end ) end end end end end ) function BackUp( source ) if getElementType ( source ) == "player" then setPedHeadless ( source, false ) end end
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