Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER then
- include("team.lua")
- end
- concommand.Add("uw_setlevel",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local target = args[1]
- local number = tonumber(args[2])
- local found = FindPlayerByName(target) or NULL
- if not found:IsValid() then
- ply:PrintMessage(HUD_PRINTCONSOLE,"Player not found")
- return
- end
- found:SetLevel(number)
- if number <= found:GetMaxLevel() and number >= 0 then
- GAMEMODE:PrintAll(ply:Name().." set "..found:Name().."'s level to "..number..".")
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"Number out of range (0-"..found:GetMaxLevel()..")")
- end
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"No access.")
- end
- end)
- concommand.Add("uw_setprestige",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local target = args[1]
- local number = tonumber(args[2])
- local found = FindPlayerByName(target) or NULL
- if not found:IsValid() then
- ply:PrintMessage(HUD_PRINTCONSOLE,"Player not found")
- return
- end
- found:SetPrestige(number)
- if number <= 5 and number >= 0 then
- GAMEMODE:PrintAll(ply:Name().." set "..found:Name().."'s prestige to "..number..".")
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"Number out of range (0-5)")
- end
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"No access.")
- end
- end)
- concommand.Add("uw_doublexp",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local number = tonumber(args[1])
- if number <= 1 and number >= 0 then
- for _,v in pairs(player.GetAll()) do
- v:SetDoubleExp(number)
- end
- GamemodeData.DoubleXP = number
- GAMEMODE:PrintAll(ply:Name().." set double exp to "..((number == 1 and "enabled") or "disabled")..".")
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"Number out of range (0-1)")
- end
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"No access.")
- end
- end)
- concommand.Add("uw_setmoney",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local target = args[1]
- local number = tonumber(args[2])
- local found = FindPlayerByName(target) or NULL
- if not found:IsValid() then
- ply:PrintMessage(HUD_PRINTCONSOLE,"Player not found")
- return
- end
- if number <= 999999999999 and number >= 0 then
- GAMEMODE:PrintAll(ply:Name().." set "..found:Name().."'s money to $"..FormatMoney(number)..".")
- found:SetMoney(number)
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"Number out of range (0-999999999999)")
- end
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"No access.")
- end
- end)
- concommand.Add("uw_addmoney",function(ply,cmd,args)
- //if ply:IsSuperAdmin() then
- if !ply:IsPlayer() or ply:IsSuperAdmin() then
- local target = args[1]
- local number = tonumber(args[2])
- if target == "*" then
- if number <= 999999999999 and number >= 0 then
- GAMEMODE:PrintAll(ply:Name().." gave everyone $"..FormatMoney(number)..".")
- for k,v in pairs(player.GetAll()) do
- v:SetMoney(v:GetMoney() + number)
- end
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"Number out of range (0-999999999999)")
- end
- else
- local found = FindPlayerByName(target) or NULL
- if not found:IsValid() then
- ply:PrintMessage(HUD_PRINTCONSOLE,"Player not found")
- return
- end
- if number <= 999999999999 and number >= 0 then
- GAMEMODE:PrintAll(ply:Name().." gave "..found:Name().." $"..FormatMoney(number)..".")
- found:SetMoney(found:GetMoney() + number)
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"Number out of range (0-999999999999)")
- end
- end
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"No access.")
- end
- end)
- concommand.Add("uw_adminears",function(ply,cmd,args)
- if ply:IsAdmin() then
- local num = tonumber(args[1])
- if num == 1 or num == 0 then
- ply.AdminEars = num
- ply:ChatPrint("You "..((num==1 and "can") or "cannot").." hear everyone.")
- end
- end
- end)
- concommand.Add("uw_adminspeak",function(ply,cmd,args)
- if ply:IsAdmin() then
- local num = tonumber(args[1])
- if num == 1 or num == 0 then
- ply.AdminSpeak = num
- ply:ChatPrint("Everyone "..((num==1 and "can") or "cannot").." hear you.")
- end
- end
- end)
- concommand.Add("uw_settokens",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local target = args[1]
- local number = tonumber(args[2])
- local found = FindPlayerByName(target) or NULL
- if not found:IsValid() then
- ply:PrintMessage(HUD_PRINTCONSOLE,"Player not found")
- return
- end
- if number <= 999999999999 and number >= 0 then
- GAMEMODE:PrintAll(ply:Name().." set "..found:Name().."'s donation tokens to "..number..".")
- found:SetDonateTokens(number)
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"Number out of range (0-999999999999)")
- end
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"No access.")
- end
- end)
- concommand.Add("uw_addtokens",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local target = args[1]
- local number = tonumber(args[2])
- local found = FindPlayerByName(target) or NULL
- if not found:IsValid() then
- ply:PrintMessage(HUD_PRINTCONSOLE,"Player not found")
- return
- end
- if number <= 999999999999 and number >= 0 then
- GAMEMODE:PrintAll(ply:Name().." gave "..found:Name().." "..number.." donation tokens.")
- found:AddDonateTokens(number)
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"Number out of range (0-999999999999)")
- end
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,"No access.")
- end
- end)
- concommand.Add("uw_commands",function(ply,cmd,args)
- local cmds = {
- "uw_setlevel <name> <level>\nSet someones level.",
- "uw_setprestige <name> <prestige>\nSet someones prestige.",
- "uw_doublexp <1/0>\nEnable double exp.",
- "uw_setmoney <name> <money>\nSet someones money.",
- "uw_addmoney <name> <amount>\nGive someone money.",
- "uw_adminears <1/0>\n makes you hear everyone.",
- "uw_adminspeak <1/0>\n makes everyone hear you.",
- "uw_settokens <name> <amount>\n set someones donation tokens.",
- "uw_addtokens <name> <amount>\n give someone donation tokens."
- }
- for _,v in pairs(cmds) do
- ply:PrintMessage(HUD_PRINTCONSOLE,v)
- end
- end)
- concommand.Add("BuyWeapon",function(ply,cmd,args)
- if ply.InMarketZone then
- local data = GetWeaponByName(args[1])
- if data then
- local name = data[1]
- local price = data[3]
- local spreaddata = data[7]
- local minspread = spreaddata[1]
- local maxspread = spreaddata[2]
- local damagedata = data[8]
- local mindamage = damagedata[1]
- local maxdamage = damagedata[2]
- local recoildata = data[9]
- local minrecoil = recoildata[1]
- local maxrecoil = recoildata[2]
- local leveldata = data[10]
- local minlevel = leveldata[1]
- local maxlevel = leveldata[2]
- local socketsdata = data[11]
- local minsockets = socketsdata[1]
- local maxsockets = socketsdata[2]
- local numsockets = math.random(minsockets,maxsockets)
- local sockets = {}
- for i=1,numsockets do
- table.insert(sockets,1)
- end
- if ply:CanAfford(price) then
- ply:ChatPrint("You bought a "..name.." for $"..FormatMoney(price)..".")
- ply:TakeMoney(price)
- ply:AddToInventory({Name = name,ItemType="weapon",Data={firerate=1,spread=math.Rand(minspread,maxspread),damage=math.Rand(mindamage,maxdamage),recoil=math.Rand(minrecoil,maxrecoil),levelreq=math.random(minlevel,maxlevel)},Sockets=sockets})
- else
- ply:ChatPrint("You cannot affort that.")
- end
- else
- ply:ChatPrint("Error: invalid weapon.")
- end
- else
- ply:ChatPrint("You arent in the market.")
- end
- end)
- concommand.Add("SellWeapon",function(ply,cmd,args)
- local id = tonumber(args[1])
- if not id then return end
- local item = ply:GetInventory()[id]
- local data = GetWeaponByName(item.Name)
- if data then
- if item.ItemType == "weapon" then
- local price = data[3]
- ply:TakeMoney(-(price*0.25))
- ply:ChatPrint("You succesfully sold "..item.Name.." for $"..FormatMoney(price*0.25)..".")
- ply:RemoveInventorySlot(id)
- else
- ply:ChatPrint("Not a weapon.")
- end
- else
- ply:ChatPrint("Invalid Slot.")
- end
- end)
- concommand.Add("SellArmor",function(ply,cmd,args)
- local id = tonumber(args[1])
- if not id then return end
- local item = ply:GetInventory()[id]
- local data = GetArmorByName(item.Name)
- if data then
- if item.ItemType == "armor" then
- local price = data[2]
- ply:TakeMoney(-(price*0.25))
- ply:ChatPrint("You succesfully sold "..item.Name.." for $"..FormatMoney(price*0.25)..".")
- ply:RemoveInventorySlot(id)
- else
- ply:ChatPrint("Not an armor.")
- end
- else
- ply:ChatPrint("Invalid Slot.")
- end
- end)
- concommand.Add("EquipWeapon",function(ply,cmd,args)
- local id = tonumber(args[1])
- local slot = tonumber(args[2])
- if not (ply:GetInventory()[id] and ply:GetInventory()[id].Name) then return end
- local wepdata = GetWeaponByName(ply:GetInventory()[id].Name)
- if not wepdata then return end
- local goesto = wepdata[5]
- local bonus = GetWeaponSocketBonuses(ply:GetInventory()[id])
- local levelreq = ply:GetInventory()[id].Data.levelreq + bonus[5]
- if ply:GetLevel() >= levelreq then
- if not ply:GetEquipped()["weapon"..slot] or ply:GetEquipped()["weapon"..slot].Name == "0" then
- if slot == goesto then
- ply:Equip("weapon"..slot,ply:GetInventory()[id])
- ply:ChatPrint("Equipped "..ply:GetInventory()[id].Name.." to "..(slot == 1 and "Primary" or "Secondary"))
- ply:RemoveInventorySlot(id)
- else
- if goesto == 1 then
- ply:ChatPrint("This weapon can only be equipped to Primary.")
- elseif goesto == 2 then
- ply:ChatPrint("This weapon can only be equipped to Secondary.")
- end
- end
- else
- ply:ChatPrint("Slot "..slot.." already taken, please unequip first.")
- end
- else
- ply:ChatPrint("Your level isn't high enough.")
- end
- end)
- concommand.Add("UnEquipWeapon",function(ply,cmd,args)
- local slot = args[1]
- if ply:GetEquipped()[slot] and ply:GetEquipped()[slot].Name != "0" and ply:Alive() then
- ply:UnEquip(slot)
- else
- ply:ChatPrint("Slot "..slot.." is already empty.")
- end
- end)
- concommand.Add("SocketWeapon",function(ply,cmd,args)
- local sockets = {}
- local slot = tonumber(args[1])
- table.remove(args,1)
- for _,v in pairs(args) do
- local data = string.Explode(",",v)
- sockets[tonumber(data[1])] = tonumber(data[2])
- end
- if table.Count(sockets) == 0 then
- ply:ChatPrint("All sockets empty.")
- return
- end
- local socketcounts = {}
- for k,v in pairs(sockets) do
- if v != 1 then
- if not socketcounts[tostring(v)] then
- socketcounts[tostring(v)] = 1
- else
- socketcounts[tostring(v)] = socketcounts[tostring(v)] + 1
- end
- end
- end
- local foundsocketables = {}
- local counts = {}
- for k,v in pairs(ply:GetInventory()) do
- if v.ItemType == "wepsocketable" then
- if table.HasValue(sockets,tonumber(v.Data.num)) then
- if not counts[tostring(v.Data.num)] then
- counts[tostring(v.Data.num)] = 0
- end
- if counts[tostring(v.Data.num)] < socketcounts[tostring(v.Data.num)] then
- foundsocketables[tostring(v.Data.num)] = k
- counts[tostring(v.Data.num)] = counts[tostring(v.Data.num)] + 1
- end
- end
- end
- end
- local hasall = true
- for k,v in pairs(counts) do
- if not (tonumber(socketcounts[k]) >= tonumber(v)) then
- hasall = false
- end
- end
- local weapon = ply:GetInventory()[slot]
- if weapon and sockets and weapon.Sockets then
- local tsockets = {}
- for k,v in pairs(weapon.Sockets) do
- tsockets[tonumber(k)] = tonumber(v)
- end
- for k,v in pairs(sockets) do
- if v != 1 then
- tsockets[k] = sockets[k]
- end
- end
- if table.Count(weapon.Sockets) == table.Count(tsockets) then
- if hasall then
- ply:GetInventory()[slot] = {Name=weapon.Name,ItemType="weapon",Data=weapon.Data,Sockets=tsockets}
- ply:UpdateInventorySlot(slot)
- for k,v in pairs(foundsocketables) do
- ply:RemoveInventorySlot(tonumber(v))
- end
- ply:ChatPrint("Socketed "..weapon.Name)
- else
- ply:ChatPrint("You dont have all the socketables.")
- end
- else
- ply:ChatPrint("Invalid sockets.")
- end
- else
- ply:ChatPrint("Invalid weapon.")
- end
- end)
- concommand.Add("SocketArmor",function(ply,cmd,args)
- local sockets = {}
- local slot = tonumber(args[1])
- table.remove(args,1)
- for _,v in pairs(args) do
- local data = string.Explode(",",v)
- sockets[tonumber(data[1])] = tonumber(data[2])
- end
- if table.Count(sockets) == 0 then
- ply:ChatPrint("All sockets empty.")
- return
- end
- local socketcounts = {}
- for k,v in pairs(sockets) do
- if v != 1 then
- if not socketcounts[tostring(v)] then
- socketcounts[tostring(v)] = 1
- else
- socketcounts[tostring(v)] = socketcounts[tostring(v)] + 1
- end
- end
- end
- local foundsocketables = {}
- local counts = {}
- for k,v in pairs(ply:GetInventory()) do
- if v.ItemType == "armorsocketable" then
- if table.HasValue(sockets,tonumber(v.Data.num)) then
- if not counts[tostring(v.Data.num)] then
- counts[tostring(v.Data.num)] = 0
- end
- if counts[tostring(v.Data.num)] < socketcounts[tostring(v.Data.num)] then
- foundsocketables[tostring(v.Data.num)] = k
- counts[tostring(v.Data.num)] = counts[tostring(v.Data.num)] + 1
- end
- end
- end
- end
- local hasall = true
- for k,v in pairs(counts) do
- if not (tonumber(socketcounts[k]) >= tonumber(v)) then
- hasall = false
- end
- end
- local armor = ply:GetInventory()[slot]
- if armor and sockets and armor.Sockets then
- local tsockets = {}
- for k,v in pairs(armor.Sockets) do
- tsockets[tonumber(k)] = tonumber(v)
- end
- for k,v in pairs(sockets) do
- if v != 1 then
- tsockets[k] = sockets[k]
- end
- end
- if table.Count(armor.Sockets) == table.Count(tsockets) then
- if hasall then
- ply:GetInventory()[slot] = {Name=armor.Name,ItemType="armor",Data=armor.Data,Sockets=tsockets}
- ply:UpdateInventorySlot(slot)
- for k,v in pairs(foundsocketables) do
- ply:RemoveInventorySlot(tonumber(v))
- end
- ply:ChatPrint("Socketed "..armor.Name)
- else
- ply:ChatPrint("You dont have all the socketables.")
- end
- else
- ply:ChatPrint("Invalid sockets.")
- end
- else
- ply:ChatPrint("Invalid armor.")
- end
- end)
- concommand.Add("AdminUpdateWeapon",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local id = tonumber(args[1])
- local firerate = tonumber(args[2])/100
- local spread = tonumber(args[3])/100
- local damage = tonumber(args[4])/100
- local recoil = tonumber(args[5])/100
- local levelreq = tonumber(args[6])
- local name = args[7]
- if ply:IsAdmin() then
- if ply:GetInventory()[id] then
- ply:GetInventory()[id] = {Name=name,ItemType="weapon",Data={firerate=firerate,spread=spread,damage=damage,recoil=recoil,levelreq=levelreq},Sockets=ply:GetInventory()[id].Sockets}
- ply:UpdateInventorySlot(id)
- ply:ChatPrint("Weapon "..name.." updated!")
- GAMEMODE:PrintAll(ply:Name().." edited a weapon.")
- end
- end
- end
- end)
- concommand.Add("BuyArmor",function(ply,cmd,args)
- if ply.InMarketZone then
- local data = GetArmorByName(args[1])
- local name = data[1]
- local price = data[2]
- local socketsdata = data[4]
- local minsockets = socketsdata[1]
- local maxsockets = socketsdata[2]
- local numsockets = math.random(minsockets,maxsockets)
- local sockets = {}
- for i=1,numsockets do
- sockets[i] = 1
- end
- local health = math.Rand(data[5][1],data[5][2])
- local armor = math.Rand(data[6][1],data[6][2])
- local speed = math.Rand(data[7][1],data[7][2])
- local defence = math.Rand(data[8][1],data[8][2])
- local levelreq = math.random(data[9][1],data[9][2])
- if ply:CanAfford(price) then
- ply:ChatPrint("Item: "..name)
- ply:ChatPrint("Buy succesful!")
- ply:TakeMoney(price)
- ply:AddToInventory({Name = name,ItemType="armor",Data={Health = health,Armor = armor,Speed = speed,Defence = defence,Levelreq = levelreq},Sockets=sockets})
- else
- ply:ChatPrint("You cannot affort that.")
- end
- else
- ply:ChatPrint("You arent in the market.")
- end
- end)
- concommand.Add("EquipArmor",function(ply,cmd,args)
- local id = tonumber(args[1])
- if ply:GetEquipped()["armor"] and ply:GetEquipped()["armor"].Name == "No armor" then
- local levelreq = tonumber(ply:GetInventory()[id].Data.Levelreq)
- if ply:GetLevel() >= levelreq then
- ply:Equip("armor",ply:GetInventory()[id])
- ply:ChatPrint("Equipped "..ply:GetInventory()[id].Name)
- ply:RemoveInventorySlot(id)
- else
- ply:ChatPrint("Your level isnt high enough")
- end
- else
- ply:ChatPrint("Unequip current armor first.")
- end
- end)
- concommand.Add("UnequipArmor",function(ply,cmd,args)
- if ply:GetEquipped()["armor"] and ply:GetEquipped()["armor"].Name != "No armor" and ply:Alive() then
- ply:UnEquip("armor")
- else
- ply:ChatPrint("You aren't wearing any armor.")
- end
- end)
- concommand.Add("BuyAmmo",function(ply,cmd,args)
- if ply.InMarketZone then
- local count = tonumber(args[2])
- local data = GetItemByName(args[1])
- local name = data[1]
- local price = count*tonumber(data[2])
- local ammotype = data[3]
- local ammos = ply:GetInventory()[1].Data
- if count <= 0 then return end -- dont even bother
- if ply:CanAfford(price) and ammos then
- ammos[ammotype] = ammos[ammotype] + count
- ply:GiveAmmo(count,ammotype)
- ply:ChatPrint("You bought "..count.." "..name.." for $"..FormatMoney(price)..".")
- ply:TakeMoney(price)
- ply:GetInventory()[1] = {Name="ammopackage",ItemType="ammo",Data=ammos,Sockets={}}
- ply:UpdateInventorySlot(1)
- else
- ply:ChatPrint("You cannot affort that.")
- end
- else
- ply:ChatPrint("You arent in the market.")
- end
- end)
- concommand.Add("NewGang",function(ply,cmd,args)
- if ply.InMarketZone then
- if ply:CanAfford(250000) then
- ply:TakeMoney(250000)
- local name = args[1]
- local r = args[2]
- local g = args[3]
- local b = args[4]
- NewTeam(#GamemodeData.Teams+1,name,Color(r,g,b,255),ply:SteamID(),{},{Damage = 1,Health = 1,Armor = 1,Speed = 1,Xp = 1,Money = 1},0)
- ply:ChatPrint("Gang created!")
- else
- ply:ChatPrint("You cannot afford that.")
- end
- else
- ply:ChatPrint("You arent in the market.")
- end
- end)
- concommand.Add("UpgradeGang",function(ply,cmd,args)
- if ply.InMarketZone then
- local Upgrade = args[1]
- local CurTeam = GamemodeData.Teams[ply:Team()]
- local CurLevel = CurTeam.Upgrades[Upgrade]
- local GangBank = tonumber(CurTeam.Bank)
- if CurTeam.Leader == ply:SteamID() then
- if CurLevel < 10 then
- local amt = (CurLevel*2)*1000000
- if GangBank >= amt then
- AddToGangBank(ply:Team(),-amt,true)
- CurTeam.Upgrades[Upgrade] = CurLevel + 1
- UpgradeTeam(ply:Team())
- ply:ChatPrint(Upgrade.." upgraded!")
- else
- ply:ChatPrint("Your gang cannot afford that.")
- end
- else
- ply:ChatPrint("Max Level Reached.")
- end
- else
- ply:ChatPrint("You aren't the leader.")
- end
- else
- ply:ChatPrint("You arent in the market.")
- end
- end)
- concommand.Add("InviteToGang",function(ply,cmd,args)
- local toteam = tonumber(args[1])
- local sid = args[2]
- local invited = FindPlayerBySteamID(sid)
- local CurTeam = GamemodeData.Teams[ply:Team()]
- if not (toteam or sid) then return end
- if toteam == ply:Team() and CurTeam.Leader == ply:SteamID() then
- if invited then
- if invited.InvitedTo == 0 then
- umsg.Start("ConfirmInvitation",invited)
- umsg.String(team.GetName(toteam))
- umsg.End()
- invited.InvitedTo = toteam
- else
- ply:ChatPrint("Player "..invited:Name().." already has a pending invite.")
- end
- else
- ply:ChatPrint("Couldnt find player.")
- end
- else
- ply:ChatPrint("You aren't the leader.")
- end
- end)
- concommand.Add("InvitedToGang",function(ply,cmd,args)
- local answ = args[1]
- if ply.InvitedTo > 0 then
- if answ == "yes" then
- ply:ChatPrint("Joined gang "..team.GetName(ply.InvitedTo))
- ply:SetTeam(ply.InvitedTo)
- table.insert(GamemodeData.Teams[ply.InvitedTo].Members,ply:SteamID())
- SaveTeam(ply.InvitedTo)
- ply.InvitedTo = 0
- else
- ply:ChatPrint("Didn't join gang "..team.GetName(ply.InvitedTo))
- ply.InvitedTo = 0
- end
- else
- ply:ChatPrint("You havent been invited to any gang.")
- end
- end)
- concommand.Add("LeaveGang",function(ply,cmd,args)
- local tnum = ply:Team()
- local gang = GamemodeData.Teams[tnum]
- local sid = ply:SteamID()
- if tnum != 0 then
- if sid == gang.Leader then
- ply:SetTeam(0)
- for k,v in pairs(team.GetPlayers(tnum)) do
- v:SetTeam(0)
- end
- ply:ChatPrint("Gang \""..team.GetName(tnum).."\" destroyed.")
- RemoveTeam(tnum)
- else
- for k,v in pairs(gang.Members) do
- if v == sid then
- table.remove(gang.Members,k)
- ply:SetTeam(0)
- ply:ChatPrint("You left "..team.GetName(tnum)..".")
- SaveTeam(tnum)
- break
- end
- end
- end
- else
- ply:ChatPrint("Can't leave gangless.")
- end
- end)
- concommand.Add("DepositToGangBank",function(ply,cmd,args)
- local tnum = tonumber(args[1])
- local amt = tonumber(args[2])
- if ply:Team() == tnum and ply:Team() > 0 then
- if amt > 0 then
- if ply:CanAfford(amt) then
- ply:TakeMoney(amt)
- ply:ChatPrint("You deposit $"..FormatMoney(amt).." into your gangs bank.")
- AddToGangBank(tnum,amt)
- else
- ply:ChatPrint("You cant afford that.")
- end
- else
- ply:ChatPrint("Invalid amount.")
- end
- else
- ply:ChatPrint("Invalid team.")
- end
- end)
- concommand.Add("KickFromGang",function(ply,cmd,args)
- local tsid = args[1]
- local t = FindPlayerBySteamID(tsid)
- local tnum = ply:Team()
- local gang = GamemodeData.Teams[tnum]
- local sid = ply:SteamID()
- if sid == gang.Leader then
- for k,v in pairs(gang.Members) do
- if tsid == sid then
- ply:ChatPrint("You cant kick yourself.")
- break
- end
- if v == tsid then
- table.remove(gang.Members,k)
- if t then
- t:SetTeam(0)
- t:ChatPrint("You have been kicked from "..team.GetName(tnum)..".")
- ply:ChatPrint("You kicked "..t:Name().." from your gang.")
- SaveTeam(tnum)
- end
- break
- end
- end
- else
- ply:ChatPrint("You aren't the leader.")
- end
- end)
- concommand.Add("VoteRoundLength",function(ply,cmd,args)
- if GamemodeData.Round.Voting and not ply.Voted then
- local len = args[1]
- if len == "short" then
- GamemodeData.Round.Votes.Short = GamemodeData.Round.Votes.Short + 1
- GAMEMODE:PrintAll("Recieved a vote for short round ("..GamemodeData.Round.Votes.Short.." total).")
- elseif len == "normal" then
- GamemodeData.Round.Votes.Normal = GamemodeData.Round.Votes.Normal + 1
- GAMEMODE:PrintAll("Recieved a vote for normal round ("..GamemodeData.Round.Votes.Normal.." total).")
- elseif len == "long" then
- GamemodeData.Round.Votes.Long = GamemodeData.Round.Votes.Long + 1
- GAMEMODE:PrintAll("Recieved a vote for long round ("..GamemodeData.Round.Votes.Long.." total).")
- else
- ply:ChatPrint("Invalid option.")
- end
- ply.Voted = true
- else
- ply:ChatPrint("Not the time to vote.")
- end
- end)
- concommand.Add("SelectClass",function(ply,cmd,args)
- local selection = args[1]
- if IsClassValid(selection) then
- if table.HasValue(ply.Data.UnlockedClasses,GetClassByName(selection)[1]) then
- ply.Data.Class.Selection = GetClassByName(selection)[1]
- ply:ChatPrint("You will become a "..GetClassByName(selection)[1].." when you respawn")
- else
- ply:ChatPrint("You havent unlocked that class.")
- end
- else
- ply:ChatPrint("Invalid class: "..selection)
- end
- end)
- concommand.Add("AddClass",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local name = args[1]
- local bonuses = string.Explode("|",args[2])
- local unlockable = (tonumber(args[3]) == 1 and true or false)
- local unlockprice = tonumber(args[4])
- for k,v in pairs(bonuses) do
- bonuses[k] = tonumber(v)
- end
- local class = {name,bonuses,unlockable,unlockprice}
- table.insert(Classes,class)
- umsg.Start("AddClass")
- umsg.String(name)
- umsg.String(table.concat(bonuses,"|"))
- umsg.String(tostring((unlockable and 1 or 0)))
- umsg.String(tostring(unlockprice))
- umsg.End()
- DB.Query("INSERT INTO classes(name,bonuses,unlockable,unlockprice) VALUES('"..name.."','"..table.concat(bonuses,"|").."',"..(unlockable and 1 or 0)..","..unlockprice..") ON DUPLICATE KEY UPDATE name=VALUES(name),bonuses=VALUES(bonuses),unlockable=VALUES(unlockable),unlockprice=VALUES(unlockprice)")
- end
- end)
- concommand.Add("EditClass",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local oldname = args[1]
- local name = args[2]
- local bonuses = string.Explode("|",args[3])
- local unlockable = (tonumber(args[4]) == 1 and true or false)
- local unlockprice = tonumber(args[5])
- for k,v in pairs(bonuses) do
- bonuses[k] = tonumber(v)
- end
- local num = 1
- for k,v in pairs(Classes) do
- if v[1] == oldname then
- num = k
- break
- end
- end
- local class = {name,bonuses,unlockable,unlockprice}
- Classes[num] = class
- umsg.Start("EditClass")
- umsg.String(oldname)
- umsg.String(name)
- umsg.String(table.concat(bonuses,"|"))
- umsg.String(tostring((unlockable and 1 or 0)))
- umsg.String(tostring(unlockprice))
- umsg.End()
- DB.Query("UPDATE classes SET name='"..name.."',bonuses='"..table.concat(bonuses,"|").."',unlockable="..(unlockable and 1 or 0)..",unlockprice="..unlockprice.."")
- end
- end)
- concommand.Add("RemoveClass",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local name = args[1]
- local num = 1
- for k,v in pairs(Classes) do
- if v[1] == name then
- num = k
- break
- end
- end
- table.remove(Classes,num)
- umsg.Start("RemoveClass")
- umsg.String(name)
- umsg.End()
- DB.Query("DELETE FROM classes WHERE name='"..name.."'")
- end
- end)
- concommand.Add("UnlockClass",function(ply,cmd,args)
- local name = args[1]
- local data = GetClassByName(name)
- local unlockable = data[3]
- local price = data[4]
- if unlockable then
- if not table.HasValue(ply.Data.UnlockedClasses,name) then
- if ply:CanAfford(price) then
- table.insert(ply.Data.UnlockedClasses,name)
- umsg.Start("UnlockClass",ply)
- umsg.String(name)
- umsg.End()
- ply:TakeMoney(price)
- local sid = ply:SteamID()
- DB.Query("UPDATE players SET unlockedclasses='"..table.concat(ply.Data.UnlockedClasses,"|").."' WHERE steamid='"..sid.."'")
- ply:ChatPrint("Unlocked "..name)
- else
- ply:ChatPrint("You cant afford that.")
- end
- else
- ply:ChatPrint("You have already unlocked this class.")
- end
- else
- ply:ChatPrint("The class "..name.." isnt unlockable.")
- end
- end)
- concommand.Add("GenerateAlphaKey",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local len = 20
- local key = {}
- local exists = false
- local chars = {48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122}
- for i=1,len do
- table.insert(key,string.char(table.Random(chars)))
- end
- local _key = table.concat(key,"")
- local dir = "underworld_saves/alphakeys/"
- local keys = file.FindDir(dir.."*")
- for _,v in pairs(keys) do
- if _key == v then
- exists = true
- end
- end
- if not exists then
- file.Write(dir.._key.."/".."steamid.txt","")
- ply:ChatPrint("Key Generated: ".._key)
- else
- ply:ChatPrint("Generating somehow failed, please try again.")
- end
- end
- end)
- concommand.Add("GetAlphaKeys",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local filter = args[1]
- local dir = "underworld_saves/alphakeys/"
- local keys = file.FindDir(dir.."*")
- local tbl = {}
- for k,v in pairs(keys) do
- tbl[k] = {}
- local used = false
- if file.Read(dir..v.."/steamid.txt") != "" then
- used = true
- tbl[k].usedby = file.Read(dir..v.."/steamid.txt")
- else
- used = false
- end
- tbl[k].key = v
- tbl[k].used = used
- end
- for k,v in pairs(tbl) do
- if filter == "used" then
- if v.used then
- ply:PrintMessage(HUD_PRINTCONSOLE,(v.used and "Used: " or "Not Used: ")..(v.key)..(v.used and " ("..v.usedby..")" or ""))
- end
- elseif filter == "notused" then
- if not v.used then
- ply:PrintMessage(HUD_PRINTCONSOLE,(v.used and "Used: " or "Not Used: ")..(v.key)..(v.used and " ("..v.usedby..")" or ""))
- end
- else
- ply:PrintMessage(HUD_PRINTCONSOLE,(v.used and "Used: " or "Not Used: ")..(v.key)..(v.used and " ("..v.usedby..")" or ""))
- end
- end
- end
- end)
- concommand.Add("AlphaKeyMenu",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local dir = "underworld_saves/alphakeys/"
- local keys = file.FindDir(dir.."*")
- local tbl = {}
- for k,v in pairs(keys) do
- tbl[k] = {}
- local used = false
- if file.Read(dir..v.."/steamid.txt") != "" then
- used = true
- tbl[k].usedby = file.Read(dir..v.."/steamid.txt")
- tbl[k].usedbyname = file.Read(dir..v.."/name.txt")
- else
- used = false
- end
- tbl[k].key = v
- tbl[k].used = used
- end
- if table.Count(tbl) == 0 then
- ply:ChatPrint("There are no alpha keys, generating one.")
- ply:ConCommand("GenerateAlphaKey")
- timer.Simple(0.1,function() ply:ChatPrint("Done, try again.") end,ply)
- return
- end
- ply:ChatPrint("Sending data, please wait.")
- ply.num = 1
- ply.keyspamtime = CurTime()
- timer.Create("SendDataSlowlyForFucksSake_"..ply:SteamID(),0.01,0,function(tbl,ply)
- if ply.num <= table.Count(tbl) then
- if ply.num <= table.Count(tbl) then
- for i=0,table.Count(tbl),5 do
- if ply.num == i or ply.num == table.Count(tbl) then
- ply:ChatPrint(ply.num.."/"..table.Count(tbl))
- break
- end
- end
- else
- ply:ChatPrint(ply.num.."/"..table.Count(tbl))
- end
- local v = tbl[ply.num]
- umsg.Start("GetAlphaKeys",ply)
- umsg.Bool(ply.num == 1)
- umsg.String(v.key)
- umsg.Bool(v.used)
- umsg.String(v.usedby or "none")
- umsg.String(v.usedbyname or "none")
- umsg.End()
- ply.num = ply.num + 1
- else
- ply:ChatPrint("Done, sending "..(ply.num-1).." keys took "..(CurTime()-ply.keyspamtime).. " seconds.")
- umsg.Start("AlphaKeyList",ply)
- umsg.End()
- timer.Destroy("SendDataSlowlyForFucksSake_"..ply:SteamID())
- end
- end,tbl,ply)
- end
- end)
- concommand.Add("UseAlphaKey",function(ply,cmd,args)
- if ply.ActivatingKey then
- local usekey = args[1]
- local dir = "underworld_saves/alphakeys/"
- local keys = file.FindDir(dir.."*")
- local tbl = {}
- for k,v in pairs(keys) do
- local used = false
- if file.Read(dir..v.."/steamid.txt") != "" then
- used = true
- else
- used = false
- end
- tbl[k] = {}
- tbl[k].key = v
- tbl[k].used = used
- end
- local done = false
- for k,v in pairs(tbl) do
- if v.key == usekey and not v.used then
- file.Write("underworld_saves/alphakeys/"..(v.key).."/steamid.txt",ply:SteamID())
- file.Write("underworld_saves/alphakeys/"..(v.key).."/name.txt",ply:Name())
- ply:UnLock()
- ply:ChatPrint("Welcome, "..ply:Name())
- ply.ActivatingKey = false
- done = true
- break
- end
- end
- if not done then
- umsg.Start("AlphaKeyMenu",ply)
- umsg.End()
- end
- end
- end)
- concommand.Add("Destiny",function(ply,cmd,args)
- local destiny = args[1]
- if !ply:Alive() and ply.CanRespawn then
- if destiny == "1" then
- ply:Spawn()
- elseif destiny == "2" then
- local spawns = {}
- if ply:IsUserGroup("donator") or ply:IsUserGroup("silvervip") or ply:IsUserGroup("goldvip") or ply:IsUserGroup("platinumvip") or ply:IsUserGroup("diamondvip") or ply:IsAdmin() then
- spawns = ents.FindByClass( "info_player_counterterrorist" )
- else
- spawns = ents.FindByClass( "info_player_start" )
- end
- ply:Spawn()
- ply:SetPos(table.Random(spawns):GetPos())
- timer.Create(ply:SteamID().."_inthefuckingmarket",1,30,function(ply)
- if ply and ply:IsValid() then
- ply.InMarketZone = true
- end
- end,ply)
- ply:ChatPrint("You are now in the market, press F3 to return to the battlefield.")
- end
- end
- end)
- concommand.Add("AddWeaponSocketable",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local name = args[1]
- local bonuses = string.Explode("|",args[2])
- local num = tostring(table.Count(WeaponSocketTable)+1)
- for k,v in pairs(bonuses) do
- bonuses[k] = tonumber(v)
- end
- local sock = {name,bonuses}
- WeaponSocketTable[num] = sock
- umsg.Start("AddWepSocketable")
- umsg.String(tostring(table.Count(WeaponSocketTable)))
- umsg.String(name)
- umsg.String(table.concat(bonuses,"|"))
- umsg.End()
- DB.Query("INSERT INTO weapon_socketables(num,name,bonuses) VALUES('"..num.."','"..name.."','"..table.concat(bonuses,"|").."')")
- end
- end)
- concommand.Add("EditWeaponSocketable",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local num = args[1]
- local name = args[2]
- local bonuses = string.Explode("|",args[3])
- for k,v in pairs(bonuses) do
- bonuses[k] = tonumber(v)
- end
- local sock = {name,bonuses}
- WeaponSocketTable[num] = sock
- umsg.Start("EditWeaponSocketable")
- umsg.String(num)
- umsg.String(name)
- umsg.String(table.concat(bonuses,"|"))
- umsg.End()
- DB.Query("UPDATE weapon_socketables SET name='"..name.."',bonuses='"..table.concat(bonuses,"|").."' WHERE num='"..num.."'")
- end
- end)
- concommand.Add("RemoveWeaponSocketable",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local num = args[1]
- umsg.Start("RemoveWepSocketable")
- umsg.String(num)
- umsg.End()
- for k,v in pairs(WeaponSocketTable) do
- if k == num then
- table.remove(WeaponSocketTable,k)
- break
- end
- end
- DB.Query("DELETE FROM weapon_socketables WHERE num='"..num.."'")
- end
- end)
- concommand.Add("BuyWeaponSocketable",function(ply,cmd,args)
- local id = args[1]
- local socketdata = WeaponSocketTable[id]
- local name = socketdata[1]
- local tier = socketdata[2][6]
- local price = 0
- if tier == 1 then
- price = 50000
- elseif tier == 2 then
- price = 100000
- elseif tier == 3 then
- price = 200000
- elseif tier == 4 then
- price = 350000
- elseif tier == 5 then
- price = 500000
- elseif tier == 6 then
- price = 1000000
- else
- return
- end
- if ply:CanAfford(price) then
- ply:AddToInventory({Name = name,ItemType="wepsocketable",Data={num=id},Sockets={}})
- ply:TakeMoney(price)
- ply:ChatPrint("Succesfully bought "..name..".")
- else
- ply:ChatPrint("You can't afford that.")
- end
- end)
- concommand.Add("AddArmorSocketable",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local name = args[1]
- local bonuses = string.Explode("|",args[2])
- local num = tostring(table.Count(ArmorSocketTable)+1)
- for k,v in pairs(bonuses) do
- bonuses[k] = tonumber(v)
- end
- local sock = {name,bonuses}
- ArmorSocketTable[num] = sock
- umsg.Start("AddArmorSocketable")
- umsg.String(num)
- umsg.String(name)
- umsg.String(table.concat(bonuses,"|"))
- umsg.End()
- DB.Query("INSERT INTO armor_socketables(num,name,bonuses) VALUES('"..num.."','"..name.."','"..table.concat(bonuses,"|").."')")
- end
- end)
- concommand.Add("EditArmorSocketable",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local num = args[1]
- local name = args[2]
- local bonuses = string.Explode("|",args[3])
- for k,v in pairs(bonuses) do
- bonuses[k] = tonumber(v)
- end
- local sock = {name,bonuses}
- ArmorSocketTable[num] = sock
- umsg.Start("EditArmorSocketable")
- umsg.String(num)
- umsg.String(name)
- umsg.String(table.concat(bonuses,"|"))
- umsg.End()
- DB.Query("UPDATE armor_socketables SET name='"..name.."',bonuses='"..table.concat(bonuses,"|").."' WHERE num='"..num.."'")
- end
- end)
- concommand.Add("RemoveArmorSocketable",function(ply,cmd,args)
- if ply:IsSuperAdmin() then
- local num = args[1]
- umsg.Start("RemoveArmorSocketable")
- umsg.String(num)
- umsg.End()
- local num = 0
- for k,v in pairs(ArmorSocketTable) do
- if k == num then
- table.remove(ArmorSocketTable,k)
- break
- end
- end
- DB.Quer("DELETE FROM armor_socketables WHERE num='"..num.."'")
- end
- end)
- concommand.Add("BuyArmorSocketable",function(ply,cmd,args)
- local id = args[1]
- local socketdata = ArmorSocketTable[id]
- local name = socketdata[1]
- local tier = socketdata[2][6]
- local price = 0
- if tier == 1 then
- price = 50000
- elseif tier == 2 then
- price = 100000
- elseif tier == 3 then
- price = 200000
- elseif tier == 4 then
- price = 350000
- elseif tier == 5 then
- price = 500000
- elseif tier == 6 then
- price = 1000000
- else
- return
- end
- if ply:CanAfford(price) then
- ply:AddToInventory({Name = name,ItemType="armorsocketable",Data={num=id},Sockets={}})
- ply:TakeMoney(price)
- ply:ChatPrint("Succesfully bought "..name..".")
- else
- ply:ChatPrint("You can't afford that.")
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment