ramzi Posted March 29, 2016 Share 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 Link to comment
swedishboy Posted March 29, 2016 Share Posted March 29, 2016 The problem is taht you added the script Client-side add it to Server-side Link to comment
ramzi Posted March 29, 2016 Author Share Posted March 29, 2016 It is already in Server side Link to comment
swedishboy Posted March 29, 2016 Share Posted March 29, 2016 Then it should work, check your Meta then? Link to comment
ramzi Posted March 29, 2016 Author Share Posted March 29, 2016 Did.Nothing happened.still the same Link to comment
ramzi Posted March 29, 2016 Author Share Posted March 29, 2016 "Headshot" type="script" version="1.0.0" /> Link to comment
Saml1er Posted March 29, 2016 Share 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 ) Link to comment
ramzi Posted March 29, 2016 Author Share 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. Link to comment
swedishboy Posted March 29, 2016 Share 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 Link to comment
ramzi Posted March 29, 2016 Author Share Posted March 29, 2016 I have already deleted the old one. Link to comment
swedishboy Posted March 29, 2016 Share Posted March 29, 2016 The script works fine for me, tested it.. So dont understand why it didnt work for you Link to comment
ramzi Posted March 30, 2016 Author Share Posted March 30, 2016 Solved,the reason was my gameplay mod,becuz players were respawning fast. Link to comment
ramzi Posted March 30, 2016 Author Share 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? Link to comment
swedishboy Posted March 30, 2016 Share 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 Link to comment
Anubhav Posted March 31, 2016 Share 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 Link to comment
ramzi Posted March 31, 2016 Author Share Posted March 31, 2016 Thnx Guys!!!!!! u da best 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