Jump to content

Question about custom weapons


IIYAMA

Recommended Posts

  • Moderators
Posted

Why don't setweaponproperty from custom weapons work?

somebody does have the same problem?

meta:

  
local weapon1 = createWeapon ( "m4",0,0,0+5 ) 
setWeaponClipAmmo ( weapon1,99999) 
  
setWeaponProperty ( weapon1, "accuracy", 0.00001) 
setWeaponProperty ( weapon1,"weapon_range", 0.00001) 
  
setWeaponState (weapon1, "firing") 
  

Syntax (weapon creation)

bool setWeaponProperty ( weapon theWeapon, string strProperty, value theValue )

Required Arguments

theWeapon: the weapon to change the property of.

strProperty: the property to edit such as damage per hit ( "damage" ).

theValue: whatever you wish to set it to ( different properties use different data types so damage could be an int where as accuracy is a float ).

Sets an individual weapons property. Only a handful of useful properties are supported now and it uses the same property names as setWeaponProperty server side.

Returns true if the property was set.

Requirements

Minimum supported server n/a

Minimum supported client 1.3.0-9.04555

Note: Using this function requires the resource to have the above minimum version declared in the meta.xml section. e.g.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted

both are correct.

Normally that is in my vehicle weapon script.

Does it work for you, changing them?

(I get the boolean true returned, but it doesn't change anything)

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted

Does that mean it only supports "damage", :?

If that is true, then wiki mta is very unclear. -_-"

This is in ClintSide only

I script client side.

pls take me seriously, I am not a nab.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
Does that mean it only supports "damage", :?

If that is true, then wiki mta is very unclear. -_-"

This is in ClintSide only

I script client side.

pls take me seriously, I am not a nab.

why dont you write in Console "F8" debugscript 3 and hope that information is wrong.

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

  • Moderators
Posted
@6ArHxiMr'3a[Z]eF

why dont you write in Console "F8" debugscript 3 and hope that information is wrong.

You have no idea what I have created in the past, I AM NOT A NAB SCRIPTER. TAKE ME SERIOUSLY!@!

-_-"

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
@6ArHxiMr'3a[Z]eF

why dont you write in Console "F8" debugscript 3 and hope that information is wrong.

You have no idea what I have created in the past, I AM NOT A NAB SCRIPTER. TAKE ME SERIOUSLY!@!

-_-"

dude, i'll never help if i dont know the problem if you dont tell me about "debugscript 3"

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

  • Moderators
Posted

The problem: setWeaponProperty doesn't make changes, in weapon range and accuration and everthing else.

The result ends up "true", that means that it have to work. But it doesn't change a damn.

local weapon1 = createWeapon ( "m4",0,0,5 ) 
  
outputChatBox("result: " .. tostring(setWeaponProperty ( weapon1, "accuracy", 0.00001)).. " accuracy have been succesfull set") 
outputChatBox ("result: " .. tostring(setWeaponProperty ( weapon1, "weapon_range", 0.00001)) .. " weapon_range have been succesfull set") 
  
setWeaponState (weapon1, "firing") 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
@6ArHxiMr'3a[Z]eF

why dont you write in Console "F8" debugscript 3 and hope that information is wrong.

You have no idea what I have created in the past, I AM NOT A NAB SCRIPTER. TAKE ME SERIOUSLY!@!

-_-"

dude, i'll never help if i dont know the problem if you dont tell me about "debugscript 3"

He's trying to tell you that he isnt a newbie and that debugscript doesnt show anything...

Posted

I guess it's a bug from the function, you should report it in the bug tracker.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • 3 years later...

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