Home Garry's Mod Setting Up a Donation Rewards System on a Garry's Mod Server

Setting Up a Donation Rewards System on a Garry's Mod Server

Last updated on Feb 13, 2025

In this tutorial, you'll learn how to set up a donation rewards system on your Garry's Mod server using the VolticHost Game Panel. With this system, you can reward players with exclusive in-game items or perks when they donate, encouraging more support and enhancing community engagement. 🚀


📌 Prerequisites

  • A Garry's Mod server purchased at VolticHost.com

  • Access to the VolticHost Game Panel

  • A payment gateway setup (e.g., PayPal or Stripe) with configured webhooks for donation processing

  • Basic knowledge of Lua scripting and server file management

  • A list of rewards and corresponding donation tiers


1️⃣ First Step - Creating the Donation Rewards Script

  1. Log in to VolticHost Game Panel.

  2. Navigate to the File Manager from the main dashboard.

  3. Go to the /garrysmod/lua/autorun/server/ directory.

  4. Create a new file named donation_rewards.lua.

  5. Open donation_rewards.lua for editing and paste the following code snippet:

    if SERVER then
        util.AddNetworkString("RewardUpdate")
        local donationRewards = {
            [10] = "Exclusive Skin",
            [25] = "VIP Chat Color",
            [50] = "Special Weapon"
        }
        
        -- Function to grant rewards based on donation amount
        function GrantDonationReward(ply, amount)
            for tier, reward in pairs(donationRewards) do
                if amount >= tier then
                    ply:ChatPrint("Thank you for your donation of $" .. amount .. "! You've earned: " .. reward)
                    -- Insert code here to grant the reward (e.g., add a weapon, change chat color, etc.)
                    net.Start("RewardUpdate")
                    net.WriteString(reward)
                    net.Send(ply)
                end
            end
        end
        
        -- Simulate donation command for testing
        concommand.Add("simulate_donation", function(ply, cmd, args)
            local amount = tonumber(args[1])
            if amount then
                GrantDonationReward(ply, amount)
            else
                ply:ChatPrint("Usage: simulate_donation <amount>")
            end
        end)
    end
    
  6. Save the file after editing.

  7. Restart your server from the VolticHost Game Panel to load the new donation rewards script.

Donation rewards script created and loaded successfully!


2️⃣ Next Step - Integrating with Your Payment Gateway

  1. Configure your payment gateway webhook to trigger a server-side event upon a successful donation.

  2. Modify your webhook handler to parse the donation amount and associate the donor's SteamID with the donation.

  3. Once the donation is verified, call the GrantDonationReward function with the player's entity and donation amount.

  4. For testing purposes, simulate a donation by running:

    simulate_donation 25
    

    This should grant the donor the reward corresponding to the $25 tier.

Payment gateway integration tested and donation rewards granted successfully!


🎉 Conclusion

You have now successfully set up a donation rewards system on your Garry's Mod server using the VolticHost Game Panel! Reward your supporters with exclusive in-game perks and enhance community engagement. 🚀

For more assistance, contact VolticHost Support.