Jump to content

SetWeaponProperty problem


JeViCo

Recommended Posts

Hi! I tried to make custom weapon stats, but got this:

DXRQ0F3.png

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 post
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 )

 

  • Thanks 1
Link to post
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 post

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 post

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