SycroX Posted August 18, 2017 Posted August 18, 2017 (edited) hello guys. i want to create a levels for weapons. i've created it and it's work well exept 2 weapons the sniper and the rifle idk why buy when i use setWeaponProperty with any weapons it works but when i use it with sniper and rifle nothing happen and the properties of all levels pro - std - poor set to poor that's a simple code for my problem setPedStat to change player weaponSkills the stat of sniper is 79 addEventHandler("onResourceStart", resourceRoot, function() setWeaponProperty("sniper", "pro", "damage", 130) setWeaponProperty("sniper", "pro", "accuracy", 1) setWeaponProperty("sniper", "pro", "flag_move_and_shoot", true) setWeaponProperty("sniper", "pro", "target_range", 350) setWeaponProperty("sniper", "pro", "weapon_range", 400) -- setWeaponProperty("sniper", "std", "damage", 130) setWeaponProperty("sniper", "std", "accuracy", 1) setWeaponProperty("sniper", "std", "flag_move_and_shoot", true) setWeaponProperty("sniper", "std", "target_range", 350) setWeaponProperty("sniper", "std", "weapon_range", 400) -- setWeaponProperty("sniper", "poor", "damage", 130) setWeaponProperty("sniper", "poor", "accuracy", 1) setWeaponProperty("sniper", "poor", "flag_move_and_shoot", true) setWeaponProperty("sniper", "poor", "target_range", 350) setWeaponProperty("sniper", "poor", "weapon_range", 400) end ) Edited August 18, 2017 by #x1AhMeD,-09 Chillin' with some demons, satans and vamps
SycroX Posted August 18, 2017 Author Posted August 18, 2017 i've spent 1 day trying to solve that problem but i failed .. the code is simple and i don't see any mistakes in it so can any one help me ??? Chillin' with some demons, satans and vamps
Dretax Posted August 18, 2017 Posted August 18, 2017 10 hours ago, #x1AhMeD,-09 said: i've spent 1 day trying to solve that problem but i failed .. the code is simple and i don't see any mistakes in it so can any one help me ??? setPedStat (ped, 79, 999) setPedStat (ped, 79, 500) ? Software Engineer, available for hire. http://github.com/dretax
iMr.WiFi..! Posted August 19, 2017 Posted August 19, 2017 did you try it without "onResourceStart" -Event ? Experienced MTA developer for 4 years. | MTA خبرة 4 سنين في برمجة ليس عليك اسعاد الجميع , ولكن عليك بإن لا تؤذي أحداً =========You do not have to make everyone happy, But you should not hurt anyone Want to contact with me? Discord: JustCarry#2616 (Always there)Skype: Live:JustCarry10 (Not always)
SycroX Posted August 19, 2017 Author Posted August 19, 2017 (edited) i've tried many ways but the result it same .. * Note : all weapons are worked exept the sniper and the rifle .. - the code is working with the other weapons this is another way addEventHandler("onPlayerWeaponSwitch", root, function(_, curWep) if curWep == 34 then local stat = getPedStat(source, 79) if stat < 300 then setWeaponProperty(34, "poor", "damage", 1000) elseif stat >= 300 and stat < 999 then setWeaponProperty(34, "std", "damage", 500) elseif stat >= 999 then setWeaponProperty(34, "pro", "damage", 100) end end end ) + i've created a code to check the result but the result always same addCommandHandler("wep", function(player,_,id,s,p) local id = tonumber(id) outputChatBox("Original : "..getOriginalWeaponProperty(id, tostring(s), tostring(p)), player) outputChatBox("Current : "..getWeaponProperty(id, tostring(s), tostring(p)), player) end ) Edited August 19, 2017 by #x1AhMeD,-09 Chillin' with some demons, satans and vamps
SycroX Posted August 20, 2017 Author Posted August 20, 2017 wow 116 views and no one can help me ??? Chillin' with some demons, satans and vamps
Moderators IIYAMA Posted August 20, 2017 Moderators Posted August 20, 2017 afaik it is a bug, nothing you can do about it except of reporting it: https://bugs.multitheftauto.com/my_view_page.php Or use: onClientPlayerDamage to adjust the player damage. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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