Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rank = "donator" -- The ulx rank name to add the user to.
- local DonorPage = "http://usgamingservers.com/donate2/" -- Change this to the url of your donation page.
- --local rafflespage - "http://usgamingservers.com/donate2/raffle.php"
- hook.Add( "PlayerSpawn", "CheckEliteDonor", function(ply)
- db = mysqloo.connect( HOST, USERNAME, PASSWORD, DATABASE, 3306 )
- function db:onConnected()
- print( "Database has connected!" )
- local q = self:query( "UPDATE `elite_donations` SET `used`= '1' WHERE `steamid`='"..db:escape(ply:SteamID()).."' AND `server`='"..SERVER_ID.."';" )
- function q:onSuccess( data )
- if( q:affectedRows() > 0 ) then
- -- What to do if they bought donor.
- ply:ChatPrint("Thank you for your donation, You have been given your rank!") -- Tell them it worked
- RunConsoleCommand("ulx", "adduserid", ply:SteamID(), rank) -- set there rank to donor
- ply:addMoney(30000) -- Give them $30,000 cash
- -- Add anything else you want inside this if statement
- end
- end
- function q:onError( err, sql )
- print( "Query errored!" )
- ply:ChatPrint( "Query:", sql )
- ply:ChatPrint( "Error:", err )
- end
- q:start()
- end
- function db:onConnectionFailed( err )
- print( "Connection to database failed!" )
- print( "Error:", err )
- end
- db:connect()
- end)
- function donateCommand( pl, text, teamonly )
- if text == "!donate" or text == "/donate" then
- pl:SendLua('gui.OpenURL("'.DonorPage.'")') -- Make sure to replace this with the url to YOUR donation page!
- return ""
- end
- end
- hook.Add( "PlayerSay", "Chat", donateCommand )
- -- function rafflesCommand( pl, text, teamonly )
- -- if text == "!raffle" or text == "!raffles" then
- -- pl:SendLua('gui.OpenURL("'.rafflespage.'")') -- Make sure to replace this with the url to YOUR donation page!
- -- return ""
- -- end
- -- end
- -- hook.Add( "PlayerSay", "Chat", raffleCommand )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement