JeViCo Posted January 27, 2018 Share Posted January 27, 2018 Hi! I tried to make custom weapon stats, but got this: Here: function stats() setWeaponProperty(30, "poor", "maximum_clip_ammo", 1) end addEvent("stats",true) addEventHandler ("stats", root, stats) Tried to use wiki code - same Link to comment
NeXuS™ Posted January 27, 2018 Share Posted January 27, 2018 Try it with the actual string. setWeaponProperty("ak-47", "poor", "maximum_clip_ammo", 1) Link to comment
Sawos Posted January 27, 2018 Share Posted January 27, 2018 function stats() weaponList = { "ak-47" } for _,weapon in ipairs( weaponList ) do for _,skill in ipairs( { "poor", "std", "pro" } ) do setWeaponProperty( weapon, skill, "maximum_clip_ammo", 1) end end end addEvent("stats",true) addEventHandler ("stats", root, stats) addEventHandler ( "onResourceStart", getRootElement(), stats ) 1 Link to comment
JeViCo Posted January 28, 2018 Author Share Posted January 28, 2018 9 hours ago, NeXuS™ said: Try it with the actual string. setWeaponProperty("ak-47", "poor", "maximum_clip_ammo", 1) already tried this( 8 hours ago, Saw^^ said: function stats() weaponList = { "ak-47" } for _,weapon in ipairs( weaponList ) do for _,skill in ipairs( { "poor", "std", "pro" } ) do setWeaponProperty( weapon, skill, "maximum_clip_ammo", 1) end end end addEvent("stats",true) addEventHandler ("stats", root, stats) addEventHandler ( "onResourceStart", getRootElement(), stats ) Thank you, it works. But what was wrong? Link to comment
Sawos Posted January 28, 2018 Share Posted January 28, 2018 You should define all of 3 skills into the weapon (poor, std , pro) . and most importantly you didn't call the resource on the script starting with this : addEventHandler ( "onResourceStart", getRootElement(), stats ) and you cant remove these 2 lines unless you won't be using them in other side to trigger them : addEvent("stats",true) addEventHandler ("stats", root, stats) You're welcome 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