Doffy Posted January 27, 2020 Posted January 27, 2020 Hello, i wanna make zombie head shot with selected weapons Deagle , Sniper, Shotgun and when i set a weapon check code not working and no debug Code: --client function zombiedamaged ( attacker, weapon, bodypart ) if getElementType ( source ) == "ped" then if (getElementData (source, "zombie") == true) then if ( bodypart == 9 ) then triggerServerEvent ("headboom", source, source, attacker, weapon, bodypart ) end end end end addEventHandler ( "onClientPedDamage", getRootElement(), zombiedamaged ) --server addEvent( "headboom", true ) function Zheadhit ( ped,attacker, weapon, bodypart) if (getElementData (ped, "zombie") == true) then local w = getPlayerWeapon(attacker) if ( w == 34 ) and ( w == 24 ) and ( w == 25 ) then killPed ( ped, attacker, weapon, bodypart ) setPedHeadless ( ped, true ) end end end addEventHandler( "headboom", getRootElement(), Zheadhit )
Moderators Patrick Posted January 27, 2020 Moderators Posted January 27, 2020 (edited) On server side, in the 18th row where you check the IDs, you need to use or instead of and. Edited January 27, 2020 by stPatrick
Doffy Posted January 27, 2020 Author Posted January 27, 2020 3 minutes ago, stPatrick said: On server side, in the 18th row where you chech the IDs, you need to use or instead of and. i didn't understand u
Moderators Patrick Posted January 27, 2020 Moderators Posted January 27, 2020 1 minute ago, !#DesTroyeR_,) said: i didn't understand u What do not you understand?
Doffy Posted January 27, 2020 Author Posted January 27, 2020 1 minute ago, stPatrick said: What do not you understand? My code is right but is not anything work
Moderators Patrick Posted January 27, 2020 Moderators Posted January 27, 2020 1 minute ago, !#DesTroyeR_,) said: My code is right but is not anything work Your code is not right and I have described what you need to do.
!#NssoR_) Posted January 27, 2020 Posted January 27, 2020 function zombiedamaged ( attacker, weapon, bodypart ) if getElementType ( source ) == "ped" and getElementType ( attacker ) == "player" then if (getElementData (source, "zombie") == true) then if ( bodypart == 9 and weapon == 24 or weapon == 25 or weapon == 34 ) then triggerServerEvent ("headboom", localPlayer, source, attacker, weapon, bodypart ) end end end end addEventHandler ( "onClientPedDamage", getRootElement(), zombiedamaged ) addEvent( "headboom", true ) function Zheadhit ( ped,attacker, weapon, bodypart) killPed ( ped, attacker, weapon, bodypart ) setPedHeadless ( ped, true ) end addEventHandler( "headboom", getRootElement(), Zheadhit )
Doffy Posted January 27, 2020 Author Posted January 27, 2020 17 minutes ago, !#NssoR_) said: function zombiedamaged ( attacker, weapon, bodypart ) if getElementType ( source ) == "ped" and getElementType ( attacker ) == "player" then if (getElementData (source, "zombie") == true) then if ( bodypart == 9 and weapon == 24 or weapon == 25 or weapon == 34 ) then triggerServerEvent ("headboom", localPlayer, source, attacker, weapon, bodypart ) end end end end addEventHandler ( "onClientPedDamage", getRootElement(), zombiedamaged ) addEvent( "headboom", true ) function Zheadhit ( ped,attacker, weapon, bodypart) killPed ( ped, attacker, weapon, bodypart ) setPedHeadless ( ped, true ) end addEventHandler( "headboom", getRootElement(), Zheadhit ) not working actully this make zombie die with one shot in any body part in his body !
Moderators Patrick Posted January 27, 2020 Moderators Posted January 27, 2020 41 minutes ago, !#DesTroyeR_,) said: not working actully this make zombie die with one shot in any body part in his body ! if ( bodypart == 9 and weapon == 24 or weapon == 25 or weapon == 34 ) then replace to: if ( bodypart == 9 and ( weapon == 24 or weapon == 25 or weapon == 34 ) ) then 1
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