iPanda Posted January 21, 2014 Share Posted January 21, 2014 Hey, guys. My next problem - does not work function setWeaponProperty. I wanted to give the properties of the rifle "Country Rifle", but the function does not work. Help solve the problem. server.lua file local M1Garand = function() setWeaponProperty(33, "poor", "weapon_range", 180) setWeaponProperty(33, "poor", "target_range", 180) setWeaponProperty(33, "poor", "accuracy", 5) setWeaponProperty(33, "poor", "damage", 50) setWeaponProperty(33, "poor", "maximum_clip_ammo", -- s8) --> setWeaponProperty(33, "poor", "move_speed", 90) setWeaponProperty(33, "poor", "flags", 0x000010) setWeaponProperty(33, "poor", "flags", 0x008000) end addEventHandler("onResourceStart", getRootElement(), M1Garand ) ps I am using the server-side + prescribed minimum version client meta.xml Link to comment
Vector Posted January 21, 2014 Share Posted January 21, 2014 maybe the skill level of your player is not "poor". it can be "pro", "std" and "poor" local M1Garand = function() local skills = {"pro", "std", "poor"}; for _, skill in ipairs(skills) do setWeaponProperty(33, skill, "weapon_range", 180) setWeaponProperty(33, skill, "target_range", 180) setWeaponProperty(33, skill, "accuracy", 5) setWeaponProperty(33, skill, "damage", 50) setWeaponProperty(33, skill, "maximum_clip_ammo", -- s8) --> setWeaponProperty(33, skill, "move_speed", 90) setWeaponProperty(33, skill, "flags", 0x000010) setWeaponProperty(33, skill, "flags", 0x008000) end end addEventHandler("onResourceStart", getRootElement(), M1Garand ) Link to comment
Gallardo9944 Posted January 21, 2014 Share Posted January 21, 2014 keep in mind, that addEventHandler("onResourceStart", getRootElement(), M1Garand ) will trigger the function EVERY single time ANY resource starts. You'd better do it like that: addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), M1Garand ) Then it will be triggered only when the original resource starts. Link to comment
Tete omar Posted January 21, 2014 Share Posted January 21, 2014 @Gallardo9944: There's no need for all these functions, just one single variable does the job: addEventHandler ( "onResourceStart", resourceRoot, M1Garand ) Link to comment
Gallardo9944 Posted January 21, 2014 Share Posted January 21, 2014 @Tete omar, that totally depends on the tastes, I prefer the full functions Link to comment
Gallagher Posted January 22, 2014 Share Posted January 22, 2014 some of these flags is the sniper's crosshairs? https://wiki.multitheftauto.com/wiki/Weapon_Flags Link to comment
iPanda Posted January 23, 2014 Author Share Posted January 23, 2014 some of these flags is the sniper's crosshairs? https://wiki.multitheftauto.com/wiki/Weapon_Flags Rather Camera + terribly buggy Link to comment
Gallagher Posted January 23, 2014 Share Posted January 23, 2014 some of these flags is the sniper's crosshairs? https://wiki.multitheftauto.com/wiki/Weapon_Flags Rather Camera + terribly buggy why? 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