Jump to content

Weapon properties in a table


Negriukas

Recommended Posts

Posted

Hello, I'm trying to fix some weapons range by writing this simple script, anyway is it safe like this way?

server:

--FIXING WEAPON PROPERTIES 
function setWeaponAutomaticRangeFixOn() 
rangeProperty = {  
    {"M4", 31, "pro", "weapon_range", 200}, 
    {"M4", 31, "std", "weapon_range", 150}, 
    {"M4", 31, "poor", "weapon_range", 90}, 
     
    {"SNIPER", 34, "pro", "weapon_range", 500}, 
    {"SNIPER", 34, "std", "weapon_range", 300}, 
    {"SNIPER", 34, "poor", "weapon_range", 200}, 
     
    {"AK47", 30, "pro", "weapon_range", 200}, 
    {"AK47", 30, "std", "weapon_range", 150}, 
    {"AK47", 30, "poor", "weapon_range", 90}, 
    } 
    for i,v in ipairs( rangeProperty ) do 
    local weaponID = v[2] 
    local weaponSkill = v[3] 
    local weaponProperty = v[4] 
    local weaponValue = v[5] 
        for i = 1,9 do 
            setWeaponProperty(weaponID, weaponSkill, weaponProperty, weaponValue) 
        end 
    end 
end 
  
function startTheResource() 
    setWeaponAutomaticRangeFixOn() 
end 
addEventHandler("onResourceStart", getRootElement(), startTheResource) 

Screw putin

Posted
--FIXING WEAPON PROPERTIES 
local rangeProperty = { 
    {"M4", 31, "pro", "weapon_range", 200}, 
    {"M4", 31, "std", "weapon_range", 150}, 
    {"M4", 31, "poor", "weapon_range", 90}, 
    
    {"SNIPER", 34, "pro", "weapon_range", 500}, 
    {"SNIPER", 34, "std", "weapon_range", 300}, 
    {"SNIPER", 34, "poor", "weapon_range", 200}, 
    
    {"AK47", 30, "pro", "weapon_range", 200}, 
    {"AK47", 30, "std", "weapon_range", 150}, 
    {"AK47", 30, "poor", "weapon_range", 90}, 
    } 
  
function setWeaponAutomaticRangeFixOn() 
    for i,data in ipairs( rangeProperty ) do 
        local id, skill, property, value = unpack(data) 
        setWeaponProperty(id, skill, property, value) 
    end 
end 
addEventHandler("onResourceStart", getRootElement(), setWeaponAutomaticRangeFixOn) 

Omerta Roleplay

Posted
--FIXING WEAPON PROPERTIES 
local rangeProperty = { 
    {"M4", 31, "pro", "weapon_range", 200}, 
    {"M4", 31, "std", "weapon_range", 150}, 
    {"M4", 31, "poor", "weapon_range", 90}, 
    
    {"SNIPER", 34, "pro", "weapon_range", 500}, 
    {"SNIPER", 34, "std", "weapon_range", 300}, 
    {"SNIPER", 34, "poor", "weapon_range", 200}, 
    
    {"AK47", 30, "pro", "weapon_range", 200}, 
    {"AK47", 30, "std", "weapon_range", 150}, 
    {"AK47", 30, "poor", "weapon_range", 90}, 
    } 
  
function setWeaponAutomaticRangeFixOn() 
    for i,data in ipairs( rangeProperty ) do 
        local id, skill, property, value = unpack(data) 
        setWeaponProperty(id, skill, property, value) 
    end 
end 
addEventHandler("onResourceStart", getRootElement(), setWeaponAutomaticRangeFixOn) 

Same thing, + It works fine i just asked if it's okay like that...

Can you write something useful in stead of spamming to increase the number of posts...

Screw putin

Posted (edited)
He cleaned it up, which is useful.

You should say thanks to that guy instead of complaining. Btw yeah, it's okay.

He didn't clean it up lol, Read Wassim's code again..

compare this

{"AK47", 30, "pro", "weapon_range", 200} 

with this

(id, skill, property, value) 

so basically

id = ak47, skill = 30, property = pro, value weapon_range? 

that's why franklin deifned them here

local weaponID = v[2] 
    local weaponSkill = v[3] 
    local weaponProperty = v[4] 
    local weaponValue = v[5] 

Edited by Guest

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

  • Moderators
Posted
Hello, I'm trying to fix some weapons range by writing this simple script, anyway is it safe like this way?

To answer your main question,

Yes it is.

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

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
Hello, I'm trying to fix some weapons range by writing this simple script, anyway is it safe like this way?

To answer your main question,

Yes it is.

Thanks.

Screw putin

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