An infinite mag script

Discuss Sub Rosa Modding
Post Reply
User avatar
STAR_Founder
Posts: 11
Joined: Thu Feb 15, 2024 9:24 pm

An infinite mag script

Post by STAR_Founder »

Any suggestions on how to improve this? I was thinking of making it purchaseable in world mode, but the price would double every time its purchased. The hardest part would be to make it double only for an individual player, requiring a database for how many times each player has bought the infinite mag.

Code: Select all

---@type Plugin
local plugin = ...
plugin.name = 'Infmag'
plugin.author = 'LOL'
plugin.description = 'The holy grail'

function minigun()
	
end
	
plugin.commands["/infmag"] = {
    info = "practice mode",
    canCall = function(ply) return ply.isAdmin end,
    call = function(ply, man, args)
        assert(man, "Not spawned in.")
        local itm = items.create(itemTypes[3], man.pos, orientations.s)
        if itm then
        man:mountItem(itm,0)
        itm.data.infMag = true
        end
    end,
}

plugin:addHook('Logic', function()
    for _, itm in ipairs(items.getAll()) do
        if itm.data.infMag then
            itm.bullets = 255
		end
	end
end)
Is this thing on? :?:
User avatar
olv
Posts: 37
Joined: Thu Feb 15, 2024 7:59 pm
Location: your screen
Contact:

Re: An infinite mag script

Post by olv »

You seem to be doing an infinite chamber for the M-16 rather than an infinite mag, but otherwise this is pretty okay.
If you're looking to make it purchaseable in the World mode, you'd need a custom tab menu system if you're going for that, or a command to buy it; either way works.
Making a SQLite database is not hard at all. You can look up guides on the internet. ;)
256-2679 / 4669
precious, literate, fluffy, lyrical, mellow, selective, coordinated, kindhearted, conscious, parallel, fair, fragile, grandiose, joyous, reminiscent, familiar, righteous, free
Post Reply