Need help with getting weapons from the Pointshop



  • Yes I’m currently trying to setup a weapon tier system but I’ve run into a rather confusing problem.

    What I want to do is check a value on the weapon then set a bool within it but currently even if that bool and number are defined in shared.lua of the weapon base it still returns nil

    Here is the section I’m talking about, this is found in cl_init.lua of the gamemode within net.Receive(“zs_wavestart”, function(length)

    		for _, tab in pairs(GAMEMODE.Items) do
    			if tab.SWEP then
    				local stored = weapons.GetStored(tab.SWEP)
    				if GAMEMODE.ObjectiveMap then
    					stored.IsUnlocked = true
    				end
    				if stored.Wave <= wave and not stored.IsUnlocked then
    					stored.IsUnlocked = true
    				end
    			end
    		end
    

    So far stored.Wave is returning nil even though all the weapons have SWEP.Wave defined



  • Yes I’m currently trying to setup a weapon tier system but I’ve run into a rather confusing problem.

    What I want to do is check a value on the weapon then set a bool within it but currently even if that bool and number are defined in shared.lua of the weapon base it still returns nil

    Here is the section I’m talking about, this is found in cl_init.lua of the gamemode within net.Receive(“zs_wavestart”, function(length)

    		for _, tab in pairs(GAMEMODE.Items) do
    			if tab.SWEP then
    				local stored = weapons.GetStored(tab.SWEP)
    				if GAMEMODE.ObjectiveMap then
    					stored.IsUnlocked = true
    				end
    				if stored.Wave <= wave and not stored.IsUnlocked then
    					stored.IsUnlocked = true
    				end
    			end
    		end
    

    So far stored.Wave is returning nil even though all the weapons have SWEP.Wave defined



  • Edit: Nevermind



  • FP has more lua coders than NN.



  • @ritzbits:

    FP has more lua coders than NN.

    Yes but it’s doubtful they would know how the ZS system works


  • Administrators

    Modifying the SWEP table mid-run is an awful way of doing this for a variety of reasons. I’d check for “weapon_entry.Wave and weapon_entry.Wave >= current_wave or false” on both the client and the server, likely in a function.



  • @Zetanor:

    Modifying the SWEP table mid-run is an awful way of doing this for a variety of reasons. I’d check for “weapon_entry.Wave and weapon_entry.Wave >= current_wave or false” on both the client and the server, likely in a function.

    Hmm interesting, could you provide an example of this? as I’m not entirely sure what you mean by “weapon_entry”


  • Administrators

    They’re placeholder variables. Use your own names.



  • @Zetanor:

    They’re placeholder variables. Use your own names.

    Hmm I’m still confused, LUA is still kinda rather new to me.

    I was able to get it working by just doing a few things in the gamemode, only thing I needed to access was Wave in the SWEP


Log in to reply
 

7
Online

10975
Users

15257
Topics

297323
Posts

Looks like your connection to NoXiousNet was lost, please wait while we try to reconnect.