Hero192 Posted January 19, 2016 Share Posted January 19, 2016 Hey guys again, I want when a Law Team shoot with silenced gun or hit with nightstick the wanted players "Do not take their HPs" and Also the LAW team do not get Stars when they shoot wanted players I tried by doing this code but i fails, Can anyone correct me please? local law = {["Police"]=true, ["SWAT"]=true} function arrestPlayer (attacker, weapon, bodypart) if (attacker and getElementType(attacker) == "player" and attacker ~= source) and (weapon == 23 or weapon == 3) then if (getPlayerTeam(attacker) and law [getTeamName(getPlayerTeam(attacker))]) and getPlayerWantedLevel(source) > 0 then cancelEvent() setPedAnimation(source, "CRACK", "crckdeth2", 4000, false, true, false) end end end addEventHandler("onPlayerDamage", root, arrestPlayer) But It won't make the animation for the hitted wanted player, THANKS ALOT ! Link to comment
Hero192 Posted January 19, 2016 Author Share Posted January 19, 2016 Anyone can gjive a hand please Link to comment
tosfera Posted January 19, 2016 Share Posted January 19, 2016 As the wiki states; "Canceling this event has no effect. Cancel the client-side event onClientPlayerDamage instead.", you should use the event onClientPlayerDamage to cancel it. Link to comment
Hero192 Posted January 19, 2016 Author Share Posted January 19, 2016 And how to make the police team when shoots with silenced or nightstick wont become wanted ALSO , I tried that I don't know if I am wrong or right local law = {["Police"]=true, ["SWAT"]=true} addEventHandler("onClientPlayerDamage", localPlayer, function (attacker, weapon) local wanted = getPlayerWantedLevel() if attacker and getElementType(attacker) == "player" and weapon == 23 or weapon == 3 and wanted > 0 then local team = getPlayerTeam(attacker) if getPlayerTeam(attacker) and law [getTeamName(getPlayerTeam(attacker))]) then cancelEvent() end end end) Link to comment
Moderators IIYAMA Posted January 19, 2016 Moderators Share Posted January 19, 2016 RED or GREEN if attacker and getElementType(attacker) == "player" and weapon == 23 or weapon == 3 and wanted > 0 then How to solve: (weapon == 23 or weapon == 3) if attacker and getElementType(attacker) == "player" and (weapon == 23 or weapon == 3) and wanted > 0 then Link to comment
Hero192 Posted January 19, 2016 Author Share Posted January 19, 2016 Awesome ! Thanks alot for this idea, and by the way please How to make the police team when shoots with silenced or nightstick wont become wanted, I didn't find any way to do that maybe you know the solution Link to comment
Moderators IIYAMA Posted January 19, 2016 Moderators Share Posted January 19, 2016 It all depends how you make them wanted. You have to prevent it from happening in the code that is responsible for it. Link to comment
Hero192 Posted January 19, 2016 Author Share Posted January 19, 2016 It all depends how you make them wanted. You have to prevent it from happening in the code that is responsible for it. Yeah I got you, I just want an example to works on Link to comment
Moderators IIYAMA Posted January 19, 2016 Moderators Share Posted January 19, 2016 if weapon ~= 23 and weapon ~= 3 then -- add wanted end https://wiki.multitheftauto.com/wiki/OnPlayerDamage Link to comment
Hero192 Posted January 19, 2016 Author Share Posted January 19, 2016 Thanks I'll try that , I have a last question, I want to know how to make the silenced gun take 5HPs on each shoot , How to do that? Link to comment
Moderators IIYAMA Posted January 19, 2016 Moderators Share Posted January 19, 2016 https://wiki.multitheftauto.com/wiki/On ... ayerDamage element attacker, int weapon, int bodypart [, float loss ] local newHealth = getElementHealth(localPlayer)+loss-5 if newHealth > 0 then setElementHealth(localPlayer, newHealth) else setElementHealth(localPlayer, 0) -- or triggerServerSide + killPed end 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