[B][U]Info:[/U][/B]
Server IP: 206.221.191.179:27015
Donation System: Donation System 2
MySQLOO Version 8.1
Server GM: DarkRP
I have setup the ranks properly I think, but what I'm not sure of is whether or not I setup the mysql connections properly.
Pretty much, everything works except the giving the rank automatically part.
Things that say REMOVED are things I'm not showing for security reasons.
Any help would be GREATLY appreciated.
[B]Donation System Config.php (Connects to website mysql):[/B]
[CODE]<?php
define("DB_HOST", "localhost"); // MySQL Server
define("DB_USERNAME", "troublegaming"); // MySQL Username
define("DB_PASSWORD", "REMOVED"); // MySQL Password
define("DB_DATABASE", "troublegaming_darkrp"); // MySQL Database. Not recommended to use same database that your server(s) use, but if you want you can
/*
To test donation system, enable sandbox and during purchase use following sandbox account:
email: edgarasf123-buyer@gmail.com
password: testtest1
When done testing switch sandbox off, and replace "realemail@example.com" with your email
*/
define("PAYPAL_CURRENCY", "USD"); // Currency for your system
define("PAYPAL_SANDBOX", true); // Sandbox mode
define("PAYPAL_ID", PAYPAL_SANDBOX ? "edgarasf123-facilitator@gmail.com" : "REMOVED"); // Replace realemail@example.com with your paypal login
define("STEAM_API", "REMOVED"); // http://steamcommunity.com/dev/apikey
define("DONATE_URL", "http://troublegaming.site.nfoservers.com/Donate/"); // Address where the system is located
$GAMES = array( // All games
"gmod" => array( // GameID
"name" => "Garry's Mod", //Game name
"icon" => "icons/gmod.png", //Game icon
"display" => true, // Should display on front page
"servers" => array("darkrp") // What servers does it have( defined in $SERVERS section), use ServerID
)
);
$SERVERS = array( // All servers
"darkrp" => array( // ServerID
"name" => "DarkRP", // Server Name
"icon" => "icons/gmod.png", // Server Icon
"dbtable" => "darkrp_orders", // Server database
"products" => array(1, 2) // What products does this server have( defined in $PRODUCTS section ), use ProductID
)
);
$PRODUCTS = array( // All products
1 => array( // ProductID, must be numbers
"title" => "Bronze VIP (One Month)", //Title that is displayed on third section(Products)
"buytitle" => "DarkRP - Bronze VIP (One Month)", //Title that is displayed on fourth section(Checkout) and during PayPal purchase
// Description is shown in third section when you select product, its in HTML
"description" => "
<b>Price: <b style='color:green;'>$5</b></b>
</br>
<b>Features:</b><br/>
<b>1.</b> $250,000 In-game Cash<br/>
<b>2.</b> Bronze In-game Name<br/>
<b>3.</b> Jobs Include: Access to SWAT, Military, Chinese Mob Boss, Italian Mob Boss, Crips Leader, Bloods Leader, & Many More!<br/><br/>
<b style='color:red;'>This rank is valid for 30 days and if abused it will be taken away. Also, you must be online to receive your rank!</b>",
"price" => 5, // Price of your product
"servers" => array( // Servers that this product going to be activated on
"darkrp" => array( // ServerID
"offline" => false, // Should ran when player is not connected? Not recommended
"execute" => array( // Execute certain commands, please refer to readme.html
"rank" => array( "group" => "vipbronze" , "duration" => 500000),
"darkrp_money" => 250000,
"pointshop_points" => 0,
"print" => array( array(255,0,0) ,"You have bought one month of Bronze VIP!" ),
"broadcast" => array( array(255,0,0) ,"%name% have bought one month of Bronze!" ),
"lua" => "ServerLog(PLAYER:Nick() .. ' bought bronze one month\\n')" // <- Dont put comma at the end of array
)
)
)
),
2 => array( // ProductID, must be numbers
"title" => "Bronze VIP (LifeTime)", //Title that is displayed on third section(Products)
"buytitle" => "DarkRP - Bronze VIP (LifeTime)", //Title that is displayed on fourth section(Checkout) and during PayPal purchase
// Description is shown in third section when you select product, its in HTML
"description" => "
<b>Price: <b style='color:green;'>$10</b></b>
</br>
<b>Features:</b><br/>
<b>1.</b> $250,000 In-game Cash<br/>
<b>2.</b> Bronze In-game Name<br/>
<b>3.</b> Jobs Include: Access to SWAT, Military, Chinese Mob Boss, Italian Mob Boss, Crips Leader, Bloods Leader, & Many More!<br/><br/>
<b style='color:red;'>This rank is valid for 30 days and if abused it will be taken away. Also, you must be online to receive your rank!</b>",
"price" => 10, // Price of your product
"servers" => array( // Servers that this product going to be activated on
"darkrp" => array( // ServerID
"offline" => false, // Should ran when player is not connected? Not recommended
"execute" => array( // Execute certain commands, please refer to readme.html
"rank" => array( "group" => "vipbronze" , "duration" => 500000),
"darkrp_money" => 250000,
"pointshop_points" => 0,
"print" => array( array(255,0,0) ,"You have bought one month of Bronze VIP!" ),
"broadcast" => array( array(255,0,0) ,"%name% have bought one month of Bronze!" ),
"lua" => "ServerLog(PLAYER:Nick() .. ' bought bronze one month\\n')" // <- Dont put comma at the end of array
)
)
)
)
);
// DONT TOUCH THIS
define("PAYPAL_URL", PAYPAL_SANDBOX ? "https://www.sandbox.paypal.com/cgi-bin/webscr" : "https://www.paypal.com/cgi-bin/webscr" )
?>
[/CODE]
[B]Rank_system.lua (Connects to MySQLOO):[/B]
[CODE]local DB_HOST = "REMOVED"
local DB_PORT = 3306
local DB_DATABASE = "CameronS"
local DB_USERNAME = "CameronS"
local DB_PASSWORD = "REMOVED"
local DB_TABLE = "darkrp_ranks"
require("mysqloo")
if not mysqloo then
Error("[RankSystem] No mysqloo was found")
return nil
end
RankSystem = {}
RankSystem.players = {}
local queue = {}
local db = mysqloo.connect( DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE, DB_PORT )
local function query( sql, callback ) -- If not connected, connect and repeat query
local q = db:query( sql )
if not q then
table.insert( queue, { sql, callback } )
db:connect()
return
end
function q:onSuccess( data )
callback( data )
end
function q:onError( err )
if db:status() == mysqloo.DATABASE_NOT_CONNECTED then
table.insert( queue, { sql, callback } )
db:connect()
return
end
Error( "[RankSystem] Query Error:", err, " sql: ", sql, "\n" )
end
q:start()
end
local function getSteamID( ply )
if type(ply) == "Player" then
return string.upper( ply:SteamID() )
elseif type(ply) == "string" then
return string.upper( ply )
end
return nil
end
function db:onConnected()
ServerLog("[RankSystem] Connected to database\n")
for k, v in pairs( queue ) do
query( v[ 1 ], v[ 2 ] )
end
queue = {}
end
function db:onConnectionFailed( err )
Error( "[RankSystem] Connection to database failed!\n" )
Error( "[RankSystem] Error:", err, "\n" )
end
db:connect()
local function DatabaseLoad()
query([[
CREATE TABLE IF NOT EXISTS `]]..DB_TABLE..[[` (
`steamid` varchar(40) NOT NULL,
`rank` varchar(20) NOT NULL,
`expire` INT UNSIGNED NOT NULL,
UNIQUE KEY (`steamid`)) ]], function()
query("SELECT * FROM `"..DB_TABLE.."`", function(data)
for _, plydata in pairs(data) do
if type(plydata) == "table" then
RankSystem.players[plydata.steamid] = {}
RankSystem.players[plydata.steamid].rank = data.rank
RankSystem.players[plydata.steamid].expire = tonumber(data.expire)
end
end
end)
end)
end
hook.Add( "Initialize", "RankSystemDatabaseLoad", DatabaseLoad )
function RankSystem.AddUser( ply, rank, duration )
local steamid = getSteamID( ply )
if steamid == nil then return end
ULib.ucl.addUser( steamid, allows, denies, rank )
RankSystem.players[steamid] = {}
RankSystem.players[steamid].rank = rank
if duration > 0 then
RankSystem.players[steamid].expire = os.time()+duration
else
RankSystem.players[steamid].expire = 0
end
Ra
Isn't this a ScriptFodder/CoderHire script? If so, you can contact the author you brought it from
Sorry, you need to Log In to post a reply to this thread.