zezim Posted August 3, 2022 Share Posted August 3, 2022 Hey boys, i would like to know if my code is correct. Do you think it would be necessary for me to put an 'OnPlayerJoin' or a 'StartResource' in the code? 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, 40, 31, 30, 29, 24, 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 ( "sniper", v, "damage", 225 ) setWeaponProperty ( "m4", v, "damage", 80 ) setWeaponProperty ( "ak47", v, "damage", 60 ) setWeaponProperty ( "mp5", v, "damage", 30 ) setWeaponProperty ( "deagle", v, "damage", 45 ) setWeaponProperty ( "colt45", v, "damage", 20 ) setWeaponProperty ( "combatshotgun", v, "damage", 120 ) setWeaponProperty ( "uzi", v, "damage", 25 ) setWeaponProperty ( "tec-9", v, "damage", 35 ) end Link to comment
AngelAlpha Posted August 3, 2022 Share Posted August 3, 2022 12 hours ago, zezim said: Hey boys, i would like to know if my code is correct. Do you think it would be necessary for me to put an 'OnPlayerJoin' or a 'StartResource' in the code? 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, 40, 31, 30, 29, 24, 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 ( "sniper", v, "damage", 225 ) setWeaponProperty ( "m4", v, "damage", 80 ) setWeaponProperty ( "ak47", v, "damage", 60 ) setWeaponProperty ( "mp5", v, "damage", 30 ) setWeaponProperty ( "deagle", v, "damage", 45 ) setWeaponProperty ( "colt45", v, "damage", 20 ) setWeaponProperty ( "combatshotgun", v, "damage", 120 ) setWeaponProperty ( "uzi", v, "damage", 25 ) setWeaponProperty ( "tec-9", v, "damage", 35 ) end -- SERVER -- 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 ) addEventHandler ("onResourceStart", resourceRoot, function() for _, v in ipairs ( { "pro", "std", "poor" } ) do setWeaponProperty ( "sniper", v, "damage", 225 ) setWeaponProperty ( "m4", v, "damage", 80 ) setWeaponProperty ( "ak47", v, "damage", 60 ) setWeaponProperty ( "mp5", v, "damage", 30 ) setWeaponProperty ( "deagle", v, "damage", 45 ) setWeaponProperty ( "colt45", v, "damage", 20 ) setWeaponProperty ( "combatshotgun", v, "damage", 120 ) setWeaponProperty ( "uzi", v, "damage", 25 ) setWeaponProperty ( "tec-9", v, "damage", 35 ) end end) -- CLIENT -- local weapons = {20, 40, 31, 30, 29, 24, 22, 27} local function isWeaponInTable (id) for i, v in ipairs (weapons) do if v == id then return true end end return false end function onClientPedDamage(_, weapon) if(getElementType(source) == "player") then if isWeaponInTable(weapon) then return killPed(source) end end end addEventHandler("onClientPedDamage", getRootElement(), onClientPedDamage) Link to comment
zezim Posted August 3, 2022 Author Share Posted August 3, 2022 1 hour ago, AngelAlpha said: -- SERVER -- 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 ) addEventHandler ("onResourceStart", resourceRoot, function() for _, v in ipairs ( { "pro", "std", "poor" } ) do setWeaponProperty ( "sniper", v, "damage", 225 ) setWeaponProperty ( "m4", v, "damage", 80 ) setWeaponProperty ( "ak47", v, "damage", 60 ) setWeaponProperty ( "mp5", v, "damage", 30 ) setWeaponProperty ( "deagle", v, "damage", 45 ) setWeaponProperty ( "colt45", v, "damage", 20 ) setWeaponProperty ( "combatshotgun", v, "damage", 120 ) setWeaponProperty ( "uzi", v, "damage", 25 ) setWeaponProperty ( "tec-9", v, "damage", 35 ) end end) -- CLIENT -- local weapons = {20, 40, 31, 30, 29, 24, 22, 27} local function isWeaponInTable (id) for i, v in ipairs (weapons) do if v == id then return true end end return false end function onClientPedDamage(_, weapon) if(getElementType(source) == "player") then if isWeaponInTable(weapon) then return killPed(source) end end end addEventHandler("onClientPedDamage", getRootElement(), onClientPedDamage) hey bro thanks i love u bby god bless uuuuuuuuuuuuuuu Link to comment
zezim Posted August 4, 2022 Author Share Posted August 4, 2022 (edited) Its about the weapon guns damage change weapon damage Edited August 4, 2022 by zezim google search 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