Jump to content

Moony

Recommended Posts

I've made a server-type .Lua that should apply several 'setWeaponProperties' to the weapons. It works for some weapons, but not for others. For example, I've set the Deagle (replaced with a 6 bullet drum) to 'maxiumum_clip_ammo' = 6. This works correctly. However, with other weapons, it doesn't.

Here's the script:

function weaponProps ()
-- M9 --
	setWeaponProperty(22, "pro", "maximum_clip_ammo", 14)
	
-- Revolver --
	setWeaponProperty(24, "pro", "maximum_clip_ammo", 6)
	
-- Shotgun --
	setWeaponProperty(25, "pro", "maximum_clip_ammo", 7)
	
-- Uzi --
	setWeaponProperty(28, "pro", "maximum_clip_ammo", 30)
	
-- AKMS --
	setWeaponProperty(30, "pro", "maximum_clip_ammo", 35)
	
-- G36 --
	setWeaponProperty(31, "pro", "maximum_clip_ammo", 40)
	
-- Kar --
	setWeaponProperty(33, "pro", "maximum_clip_ammo", 5)
	
-- Mosin --
	setWeaponProperty(34, "pro", "maximum_clip_ammo", 1)
	
end
addEventHandler ("onResourceStart", getRootElement(), weaponProps)

Essentially, it runs as soon as the resource is started. As a beginner's test, I'm only modifying the max ammo clip.

It works for:
- Deagle (Revolver)
- Shotgun
- AK-47 (AKMS)
- M4 (G36)
- Rifle (Kar)
- Sniper (Mosin)

It doesn't work for:
- Colt (M9)
- UZI

Link to comment

[SOLVED]

Solution: stopping the resources that max's out the stats will set the stats to 0 (reminder). Thus, it is better to make a new resource that either:
- sets the weapons properties to apply in each level (just in case), for which you'd have to set every property to "poor", "std", and "pro".
- max's out the stats to each player (if you plan to keep the max stats resource).

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...