orcun99 Posted February 26, 2018 Share Posted February 26, 2018 (edited) server side function sendHeadshot ( attacker, weapon, bodypart, loss ) local x, y, z = getElementPosition ( source) if (getZoneName (x, y, z, true) == "Las Venturas") then if attacker == getLocalPlayer() then if bodypart == 9 then setPedAnimation ( source, "KNIFE", "KILL_Knife_Ped_Damage", -1, false, false, false ) triggerServerEvent( "onServerHeadshot", getRootElement(), source, attacker, weapon, loss ) setElementHealth ( source, 0 ) setPedHeadless( source, true ) end end end end addEventHandler ( "onClientPlayerDamage", getRootElement(), sendHeadshot ) there is no anim direct die I want to IF player have headshot then setPedAnimation ( source, "KNIFE", "KILL_Knife_Ped_Damage", -1, false, false, false ) 1one time this anim before die Edited February 26, 2018 by orcun99 Link to comment
NeXuS™ Posted February 26, 2018 Share Posted February 26, 2018 Add a timer to the trigger and setElementHealth. 1 Link to comment
orcun99 Posted February 27, 2018 Author Share Posted February 27, 2018 Can u edit this code pls Link to comment
NeXuS™ Posted February 27, 2018 Share Posted February 27, 2018 Try to edit it yourself. If you can't, I'll help you a bit. 1 Link to comment
orcun99 Posted February 28, 2018 Author Share Posted February 28, 2018 (edited) function sendHeadshot ( attacker, weapon, bodypart, loss ) local x, y, z = getElementPosition ( source) if (getZoneName (x, y, z, true) == "Las Venturas") then if attacker == getLocalPlayer() then if bodypart == 9 then setPedAnimation ( source, "KNIFE", "KILL_Knife_Ped_Damage", -1, false, false, false ) triggerServerEvent( "onServerHeadshot", getRootElement(), source, attacker, weapon, loss ) setPedHeadless( source, true ) oldur() end end end end addEventHandler ( "onClientPlayerDamage", getRootElement(), sendHeadshot ) function oldur ( player ) setElementHealth ( source, 0 ) end setTimer ( oldur, 2000, 1, "Hello, World!" ) 21 hours ago, NeXuS™ said: Try to edit it yourself. If you can't, I'll help you a bit. note script client side Edited February 28, 2018 by orcun99 Link to comment
NeXuS™ Posted March 1, 2018 Share Posted March 1, 2018 function sendHeadshot ( attacker, weapon, bodypart, loss ) local x, y, z = getElementPosition ( source) if (getZoneName (x, y, z, true) == "Las Venturas") then if attacker == getLocalPlayer() then if bodypart == 9 then setPedHeadless( source, true ) setPedAnimation ( source, "KNIFE", "KILL_Knife_Ped_Damage", -1, false, false, false ) setTimer(function() triggerServerEvent( "onServerHeadshot", getRootElement(), source, attacker, weapon, loss ) end, 2000, 1) end end end end addEventHandler ( "onClientPlayerDamage", getRootElement(), sendHeadshot ) But, I dont get this. How is the localPlayer going to damage his own head? 2 Link to comment
Storm-Hanma Posted March 1, 2018 Share Posted March 1, 2018 use this functions if ( getElementType ( attacker ) == "player" ) then 1 2 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