• Need help with LUA script
    4 replies, posted
Like in title. I wanna make this pernamently and place it in pointshop. Can someone help me? local EVENT = {} EVENT.Name = "Money" EVENT.Price = 2400 EVENT.Icon = "upgrade_icons/money.png" EVENT.Description = "Start the round with an extra credit." if SERVER then EVENT.Hooks = { "TTTBeginRound" } function EVENT:TTTBeginRound() for k,v in pairs(player.GetHumans()) do if v:IsActiveSpecial() and v:UpgradeEnabled("money") then v:AddCredits(1) end end end end TTT_AddUpgrade("money", EVENT) [highlight](User was banned for this post ("Missed the rules sticky, wrong section" - postal))[/highlight]
wrong section
There's a mega thread for this kind of thing under the Garry's mod section
[QUOTE=Dermal;45209449]Like in title. I wanna make this pernamently and place it in pointshop. Can someone help me? [code] if SERVER then EVENT.Hooks = { "TTTBeginRound" } function EVENT:TTTBeginRound() for k,v in pairs(player.GetHumans()) do if v:IsActiveSpecial() and v:UpgradeEnabled("money") then v:AddCredits(1) end end end end TTT_AddUpgrade("money", EVENT)[/code][/QUOTE] Are you sure about TTT_AddUpgrade and UpgradeEnabled? I would personally move the script to a different lua file, use an Dummy PS Item and use PS_HasItemEquipped instead. (untested) something like this: [code]function MoneyCreditsPS() local PlayerTable = player.GetAll() for k,v in pairs(PlayerTable) do if v:IsActiveSpecial() and v:PS_HasItemEquipped('money') then v:AddCredits(1) end end end hook.Add("TTTBeginRound", "MoneyCreditsPS", MoneyCreditsPS)[/code] edit:// Also this is a Section for Releases, not for Question about the Pointshop. [url]http://facepunch.com/forums/16[/url] would be more fittin. And the [ code ] tag, (# in the WYSIWYG) helps a lot to read your Lua Script :)
Thank you so much
Sorry, you need to Log In to post a reply to this thread.