Jump to content

[HELP]FriendlyFire || SetWeaponProperty Issue.


Sawos

Recommended Posts

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 by Saw^^
Link to comment
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 by URBAN
added answer of 2nd question
  • Like 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...