Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- RadNation Addon.
- :>
- ]]--
- -- Create the serverside table.
- local radnationSrv = {};
- local pMeta = FindMetaTable("Player");
- require("tmysql");
- -- Create the connection to the mysql database.
- local host = "localhost";
- local username = "root";
- local password = "";
- local database = "radnation_general";
- -- Initialize a connection to the MySQL database.
- tmysql.initialize(host, username, password, database, 3306, 5, 5);
- function InitialSpawn(pl)
- local steamID = tmysql.escape(pl:SteamID());
- print(steamID);
- tmysql.query("SELECT * FROM `player_admins` WHERE `steamid`='"..steamID.."'", function(result, status, error)
- if(error != 0) then
- print(error)
- end
- result = result[1]
- if( result ) then
- pl:ChatPrint("You are an admin")
- pl.RamAdmin = true
- pl.RamLevel = tonumber(result.level)
- else
- pl:ChatPrint("You are not an admin")
- pl.RamAdmin = false
- pl.RamLevel = 5
- end
- end, 1)
- end
- hook.Add("PlayerInitialSpawn","RamInitialSpawn", InitialSpawn)
- function AddAdmin(ply)
- local SteamID = tmysql.escape(ply:SteamID())
- tmysql.query("INSERT INTO `player_admins` VALUES ('"..SteamID.."', '2')",function(result, status, error)
- if(error != 0) then
- print(error)
- end
- end, 1)
- end
- function RemAdmin(ply)
- local SteamID = tmysql.escape(ply:SteamID())
- tmysql.query("DELETE FROM `radnation_general`.`player_admins` WHERE `player_admins`.`steamid` = "..SteamID.." AND `player_admins`.`level` = 2",function(result, status, error)
- if(error != 0) then
- print(error)
- end
- end, 1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement