Sawos Posted January 13, 2018 Share Posted January 13, 2018 (edited) local friends = { ["Emergency"] = true, } function friendy () for index, theTeam in ipairs(friends) do if ( getTeamFriendlyFire ( theTeam ) == false ) then setTeamFriendlyFire ( theTeam, true ) end end end addEventHandler("onClientPlayerDamage", getRootElement(), friendy) Well, i wanted to restrict The Emergency team from getting Killed by each other for an exemple, The Scripts works fine without any Warnings/Errors But It's not running Correctly, there has to be a mistake. The Second Part : I've made a script in the past days experiencing The "setWeaponProperty" with some weapons such as M4/minigun Damage, i thought by deleting the script, the weapon damage should have been refreshed, but still NOT, so i'm asking for a little Help if someone can help me out to Get it back like every weapon used to be. Thank you. Edited January 13, 2018 by Saw^^ Link to comment
idarrr Posted January 13, 2018 Share Posted January 13, 2018 As you can see, function setTeamFriendlyFire is server only function so it doesn't work on client. 1 Link to comment
Sawos Posted January 13, 2018 Author Share Posted January 13, 2018 It's Server sided. Link to comment
idarrr Posted January 13, 2018 Share Posted January 13, 2018 Just now, Saw^^ said: It's Server sided. onClientPlayerDamage won't trigger on server, you can use onPlayerDamage on server side code. Link to comment
URBAN Posted January 14, 2018 Share Posted January 14, 2018 (edited) local friends = { ["Emergency"] = true, } function onStart () for index, theTeam in ipairs(friends) do if (getTeamFriendlyFire(getTeamFromName(theTeam)) == false) then setTeamFriendlyFire(getTeamFromName(theTeam),true) end end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onStart) setTeamFriendlyFire and getTeamFriendlyFire wants team, not team name. So u need to use getTeamFromName. And also you should call this function in onResourceStart --- function onStart () for i = 0,46 do setWeaponProperty(i,"poor","damage",getOriginalWeaponProperty(i,"poor","damage")) setWeaponProperty(i,"std","damage",getOriginalWeaponProperty(i,"std" "damage")) setWeaponProperty(i,"pro","damage",getOriginalWeaponProperty(i,"pro","damage")) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onStart) This code will revert all weapons damages to original. Edited January 14, 2018 by URBAN added answer of 2nd question 1 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