Jump to content

#setWeaponProperty


SycroX

Recommended Posts

Posted (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 by #x1AhMeD,-09

Chillin' with some demons, satans and vamps

Posted

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

Posted

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)

Posted (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 by #x1AhMeD,-09

Chillin' with some demons, satans and vamps

  • Moderators
Posted

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 

  Tutorials  4x 

 

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