Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- util.AddNetworkString("SB_GTA::ProcessAccount")
- util.AddNetworkString("SB_GTA::RemoveAccount")
- util.AddNetworkString("SB_GTA::AddAccount")
- local PLAYER = FindMetaTable("Player")
- function PLAYER:GetAdminID()
- return self.AdminID
- end
- function PLAYER:AssignAdminID(adminID)
- self.AdminID = adminID
- end
- -- Assigns their adminID after creation --
- function PLAYER:ReloadSBAccount()
- local steamid = self:SteamID()
- GTA_BANS:Query("SELECT `aid` FROM `sbans_admins` WHERE `authid`='" .. steamid .. "' LIMIT 1", function ( bansAdmin )
- if (bansAdmin and bansAdmin[1] and bansAdmin[1].data[1]) then
- self:AssignAdminID(bansAdmin[1].data[1]["aid"])
- Msg("" ..self:Name() .. " adminID is " ..self:GetAdminID().. "\n")
- self:Notify("AdminID: " .. self:GetAdminID() .. "")
- else
- self:Notify("Something went wrong reloading your account. Please contact Nykez")
- Msg("[ERROR] << RELOADING SB ACCOUNT >>\n")
- end
- end)
- end
- function GetAdminBySteamID(ply)
- if IsValid(ply) then
- timer.Simple(10, function()
- if ply:IsEVAdmin() then
- local steamid = ply:SteamID()
- GTA_BANS:Query("SELECT `aid` FROM `sbans_admins` WHERE `authid`='" .. steamid .. "' LIMIT 1", function ( bansAdmin )
- if (bansAdmin and bansAdmin[1] and bansAdmin[1].data[1]) then
- ply:AssignAdminID(bansAdmin[1].data[1]["aid"])
- Msg("" ..ply:Name() .. " adminID is " ..ply:GetAdminID().. "\n")
- else
- Msg("Admin has no sourceban account!\n")
- ply:Notify("We've noticed you do not have a source bans account")
- ply:Notify("You need to create one!")
- end
- end)
- end
- end)
- end
- end
- hook.Add( "PlayerInitialSpawn", "GetAdminID", GetAdminBySteamID)
- net.Receive("SB_GTA::ProcessAccount", function( len, Player )
- if !Player then return end
- if !Player:IsEVAdmin() then
- Player:Kick("Trying to exploit...")
- return
- end
- if Player:GetAdminID() then
- Player:Notify("You already have a SBan account, dumbass.")
- return
- end
- local f_tbl_temp = net.ReadTable();
- if !Player or !f_tbl_temp then return end
- local Name = f_tbl_temp.arg1
- local steamid = Player:SteamID()
- local Password = f_tbl_temp.arg2
- local ServerRank = 2
- local Email = f_tbl_temp.arg3
- timer.Simple(1, function()
- GTA_BANS:Query("INSERT INTO `sbans_admins` (`user`, `authid`, `password`, `gid`, `email`) VALUES ('" .. Name .. "', '" .. steamid .. "', '" .. Password .. "', '" .. ServerRank .. "', '" .. Email .. "')")
- Msg("Created SB Account\n")
- Player:Notify("Username: " .. Name .. "")
- Player:Notify("Password: " .. Password .. "")
- Player:Notify("Email: " .. Email .. "")
- Player:ReloadSBAccount()
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement