Advertisement
Guest User

Create soucrebans account from ingame

a guest
Apr 11th, 2016
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.63 KB | None | 0 0
  1. util.AddNetworkString("SB_GTA::ProcessAccount")
  2. util.AddNetworkString("SB_GTA::RemoveAccount")
  3. util.AddNetworkString("SB_GTA::AddAccount")
  4.  
  5. local PLAYER = FindMetaTable("Player")
  6.  
  7. function PLAYER:GetAdminID()
  8.     return self.AdminID
  9. end
  10.  
  11. function PLAYER:AssignAdminID(adminID)
  12.     self.AdminID = adminID
  13. end
  14.  
  15. -- Assigns their adminID after creation --
  16. function PLAYER:ReloadSBAccount()
  17.     local steamid = self:SteamID()
  18.     GTA_BANS:Query("SELECT `aid` FROM `sbans_admins` WHERE `authid`='" .. steamid .. "' LIMIT 1", function ( bansAdmin )
  19.         if (bansAdmin and bansAdmin[1] and bansAdmin[1].data[1]) then
  20.             self:AssignAdminID(bansAdmin[1].data[1]["aid"])
  21.             Msg("" ..self:Name() .. " adminID is " ..self:GetAdminID().. "\n")
  22.             self:Notify("AdminID: " .. self:GetAdminID() .. "")
  23.         else
  24.             self:Notify("Something went wrong reloading your account. Please contact Nykez")
  25.             Msg("[ERROR] << RELOADING SB ACCOUNT >>\n")
  26.         end
  27.     end)
  28. end
  29.  
  30. function GetAdminBySteamID(ply)
  31.     if IsValid(ply) then
  32.         timer.Simple(10, function()
  33.             if ply:IsEVAdmin() then
  34.                 local steamid = ply:SteamID()
  35.                 GTA_BANS:Query("SELECT `aid` FROM `sbans_admins` WHERE `authid`='" .. steamid .. "' LIMIT 1", function ( bansAdmin )
  36.                     if (bansAdmin and bansAdmin[1] and bansAdmin[1].data[1]) then
  37.                         ply:AssignAdminID(bansAdmin[1].data[1]["aid"])
  38.                         Msg("" ..ply:Name() .. " adminID is " ..ply:GetAdminID().. "\n")
  39.                     else
  40.                         Msg("Admin has no sourceban account!\n")
  41.                         ply:Notify("We've noticed you do not have a source bans account")
  42.                         ply:Notify("You need to create one!")
  43.                     end
  44.                 end)
  45.             end
  46.         end)
  47.     end
  48. end
  49. hook.Add( "PlayerInitialSpawn", "GetAdminID", GetAdminBySteamID)
  50.  
  51.  
  52. net.Receive("SB_GTA::ProcessAccount", function( len, Player )
  53.     if !Player then return end
  54.    
  55.     if !Player:IsEVAdmin() then
  56.         Player:Kick("Trying to exploit...")
  57.         return
  58.     end
  59.    
  60.     if Player:GetAdminID() then
  61.         Player:Notify("You already have a SBan account, dumbass.")
  62.         return
  63.     end
  64.  
  65.     local f_tbl_temp = net.ReadTable();
  66.     if !Player or !f_tbl_temp then return end
  67.  
  68.     local Name = f_tbl_temp.arg1
  69.     local steamid = Player:SteamID()
  70.     local Password = f_tbl_temp.arg2
  71.     local ServerRank = 2
  72.     local Email = f_tbl_temp.arg3
  73.    
  74.     timer.Simple(1, function()
  75.         GTA_BANS:Query("INSERT INTO `sbans_admins` (`user`, `authid`, `password`, `gid`, `email`) VALUES ('" .. Name .. "', '" .. steamid .. "', '" .. Password .. "', '" .. ServerRank .. "', '" .. Email .. "')")
  76.         Msg("Created SB Account\n")
  77.         Player:Notify("Username: " .. Name .. "")
  78.         Player:Notify("Password: " .. Password .. "")
  79.         Player:Notify("Email: " .. Email .. "")
  80.         Player:ReloadSBAccount()
  81.     end)
  82. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement