#nofear Posted May 3, 2023 Posted May 3, 2023 I have a problem with rocket damage. The damage is absolutely unchanged. There is no problem with weapons such as M4, sniper. I can change their damage. What should I do to increase rocket damage? addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if bodypart == 9 then local result = triggerEvent("", source, attacker, weapon, loss) if result == true then killPed(source, attacker, weapon, bodypart) end end end ) local weapons = {20, 19, 40, 31, 30, 29, 24, 25, 34, 35, 36, 22, 27} function onClientPedDamage(_, weapon) if(getElementType(source) == "player") then if(weapons[weapon]) then return killPed(source) end end end addEventHandler("onClientPedDamage", getRootElement(), onClientPedDamage) for _, v in ipairs ( { "pro", "std", "poor" } ) do setWeaponProperty ( "m4", v, "damage", 150 ) -- 20 Yazan kısım silahın vereceği hasar. setWeaponProperty ( "ak47", v, "damage", 200 ) setWeaponProperty ( "mp5", v, "damage", 95 ) setWeaponProperty ( "deagle", v, "damage", 50 ) setWeaponProperty ( "uzi", v, "damage", 0 ) setWeaponProperty ( "tec-9", v, "damage", 15 ) setWeaponProperty ( "rocket launcher", v, "damage", 1000 ) setWeaponProperty ( "rocket launcher hs", v, "damage", 1000 ) setWeaponProperty ( "sniper", v, "damage", 1000 ) setWeaponProperty ( "rocket", v, "damage", 2000 ) end
Shady1 Posted May 3, 2023 Posted May 3, 2023 (edited) 7 hours ago, #nofear said: I have a problem with rocket damage. The damage is absolutely unchanged. There is no problem with weapons such as M4, sniper. I can change their damage. What should I do to increase rocket damage? addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if bodypart == 9 then local result = triggerEvent("", source, attacker, weapon, loss) if result == true then killPed(source, attacker, weapon, bodypart) end end end ) local weapons = {20, 19, 40, 31, 30, 29, 24, 25, 34, 35, 36, 22, 27} function onClientPedDamage(_, weapon) if(getElementType(source) == "player") then if(weapons[weapon]) then return killPed(source) end end end addEventHandler("onClientPedDamage", getRootElement(), onClientPedDamage) for _, v in ipairs ( { "pro", "std", "poor" } ) do setWeaponProperty ( "m4", v, "damage", 150 ) -- 20 Yazan kısım silahın vereceği hasar. setWeaponProperty ( "ak47", v, "damage", 200 ) setWeaponProperty ( "mp5", v, "damage", 95 ) setWeaponProperty ( "deagle", v, "damage", 50 ) setWeaponProperty ( "uzi", v, "damage", 0 ) setWeaponProperty ( "tec-9", v, "damage", 15 ) setWeaponProperty ( "rocket launcher", v, "damage", 1000 ) setWeaponProperty ( "rocket launcher hs", v, "damage", 1000 ) setWeaponProperty ( "sniper", v, "damage", 1000 ) setWeaponProperty ( "rocket", v, "damage", 2000 ) end Hi @#nofear Welcome to the forum!, you can tell me or other community your new questions and requests as you wish, I will help you with your problem, server-side : local rocketDamage = 50 --Fixed amount of damage for rocket damage addEvent("handleDamage",true) addEventHandler("handleDamage", root, function(attacker, damage_causing, bodypart, loss) if(getElementHealth(client) - rocketDamage <= 0) then --if the damage done leaves the player's hp at or below 0 then kill him directly killPed(client, attacker, damage_causing, bodypart) else setElementHealth(client, getElementHealth(client) - rocketDamage) --if it doesn't kill then reduce health end end ) client-side : function damageHandler(attacker, damage_causing, bodypart, loss) if(damage_causing == 19) then cancelEvent() --cancel current damage because we will give triggerServerEvent("handleDamage", source, attacker, damage_causing, bodypart, loss) --Send the information to the server side, here we will process the damage end end addEventHandler("onClientPlayerDamage", root, damageHandler) As an example, I can recommend these codes to you, I tested them and they are working, you can develop them through these codes. Edited May 3, 2023 by Shady1 notes.
#nofear Posted May 4, 2023 Author Posted May 4, 2023 (edited) Thank you @Shady1, but even though I shoot from a distance, I am dying too and the damage to the vehicles does not increase. they don't explode with 1 or 2 rockets because I increased the durability of the vehicles on my server. I take no damage when shooting at a far wall, but I also take damage when shooting at a far player. Edited May 4, 2023 by #nofear
Shady1 Posted May 4, 2023 Posted May 4, 2023 2 minutes ago, #nofear said: Thank you @Shady1, but even though I shoot from a distance, I am dying too and the damage to the vehicles does not increase. they don't explode with 1 or 2 rockets because I increased the durability of the vehicles on my server. there was no problem when i tested it
Shady1 Posted May 4, 2023 Posted May 4, 2023 As I said before, this was just a test code, you can do it for the vehicle by looking at it.
#nofear Posted May 5, 2023 Author Posted May 5, 2023 @Shady1 I can probably do something for the car, but as I said, when I shoot at another player, I take damage even though it's far away.
#nofear Posted May 7, 2023 Author Posted May 7, 2023 @Shady1merhaba konu hakkında bir gelişme var mı ? rahatsız ettiğim için üzgünüm.
FLUSHBICEPS Posted May 7, 2023 Posted May 7, 2023 This could be because the rocket launcher actual damage is done by the explosion it creates in ur code it’s probably changing the rocket direct hit -- use on onClientExplosion to change the explosion damage
#nofear Posted May 9, 2023 Author Posted May 9, 2023 @FLUSHBICEPSCan you help me with this? I do not know about this
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