Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 16th, 2010 | Syntax: Lua | Size: 7.38 KB | Hits: 30 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. RPExtraTeams = {}
  2. function AddExtraTeam( Name, color, model, Description, Weapons, command, maximum_amount_of_this_class, Salary, admin, Vote, Haslicense, NeedToChangeFrom)
  3.         if not Name or not color or not model or not Description or not Weapons or not command or not maximum_amount_of_this_class or not Salary or not admin or Vote == nil then
  4.                 local text = "One of the custom teams is wrongly made! Attempt to give name of the wrongly made team!(if it's nil then I failed):\n" .. tostring(Name)
  5.                 print(text)
  6.                 hook.Add("PlayerSpawn", "TeamError", function(ply)
  7.                         if ply:IsAdmin() then ply:ChatPrint("WARNING: "..text) end
  8.                 end)   
  9.         end
  10.         local CustomTeam = {name = Name, model = model, Des = Description, Weapons = Weapons, command = command, max = maximum_amount_of_this_class, salary = Salary, admin = admin or 0, Vote = tobool(Vote), NeedToChangeFrom = NeedToChangeFrom, Haslicense = Haslicense}
  11.         table.insert(RPExtraTeams, CustomTeam)
  12.         team.SetUp(#RPExtraTeams, Name, color)
  13.         local Team = #RPExtraTeams
  14.         if SERVER then
  15.                 timer.Simple(0.1, function(CustomTeam) AddTeamCommands(CustomTeam) end, CustomTeam)
  16.         end
  17.         return Team
  18. end
  19.  
  20. hook.Add("InitPostEntity", "AddTeams", function()
  21.         if file.Exists("CustomTeams.txt") then
  22.                 RunString(file.Read("CustomTeams.txt"))
  23.                 if SERVER then resource.AddFile("data/CustomTeams.txt") end
  24.                 if CLIENT and not LocalPlayer():IsSuperAdmin() then file.Delete("CustomTeams.txt") end
  25.         end
  26. end)
  27.  
  28. /*--------------------------------------------------------
  29. Default teams. If you make a team above the citizen team, people will spawn with that team!
  30. --------------------------------------------------------*/
  31. TEAM_CITIZEN = AddExtraTeam("Citizen", Color(20, 150, 20, 255), "models/player/group01/male_01.mdl", [[The Citizen is the most basic level of society you can hold
  32. besides being a hobo.
  33. You have no specific role in city life.]], {}, "citizen", 0, 45, 0, false, false)
  34.  
  35. TEAM_POLICE = AddExtraTeam("Civil Protection", Color(25, 25, 170, 255), "models/player/police.mdl", [[The protector of every citizen that lives in the city .
  36. You have the power to arrest criminals and protect innocents.
  37. Hit them with your arrest baton to put them in jail
  38. Bash them with a stunstick and they might learn better than to disobey
  39. the law.
  40. The Battering Ram can break down the door of a criminal with a warrant
  41. for his/her arrest.
  42. The Battering Ram can also unfreeze frozen props(if enabled).
  43. Type /wanted <name> to alert the public to this criminal
  44. OR go to tab and warrant someone by clicking the warrant button]], {"arrest_stick", "unarrest_stick", "weapon_glock2", "stunstick", "door_ram", "weaponchecker", "item_ammo_pistol"}, "cp", 4, 65, 0, true, true)
  45.  
  46. TEAM_GANG = AddExtraTeam("Gangster", Color(75, 75, 75, 255), "models/player/group03/male_01.mdl", [[The lowest person of crime.
  47. A gangster generally works for the Mobboss who runs the crime family.
  48. The Mobboss sets your agenda and you follow it or you might be punished.]], {}, "gangster", 3, 45, 0, false, false)
  49.  
  50. TEAM_MOB = AddExtraTeam("Mob boss", Color(25, 25, 25, 255), "models/player/gman_high.mdl", [[The Mobboss is the crimboss in the city.
  51. With his power he coordinates the gangsters and forms an efficent crime
  52. organization.
  53. He has the ability to break into houses by using a lockpick.
  54. The Mobboss also can unarrest you.]], {"lockpick", "unarrest_stick"}, "mobboss", 1, 60, 0, false, false)
  55.  
  56. TEAM_GUN = AddExtraTeam("Gun Dealer", Color(255, 140, 0, 255), "models/player/monk.mdl", [[A gun dealer is the only person who can sell guns to other
  57. people.
  58. However, make sure you aren't caught selling guns that are illegal to
  59. the public.
  60. /Buyshipment <name> to Buy a  weapon shipment
  61. /Buygunlab to Buy a gunlab that spawns P228 pistols]], {}, "gundealer", 2, 45, 0, false, false)
  62.  
  63. TEAM_MEDIC = AddExtraTeam("Medic", Color(47, 79, 79, 255), "models/player/kleiner.mdl", [[With your medical knowledge, you heal players to proper
  64. health.
  65. Without a medic, people can not be healed.
  66. Left click with the Medical Kit to heal other players.
  67. Right click with the Medical Kit to heal yourself.]], {"med_kit"}, "medic", 3, 45, 0, false, false)
  68.  
  69. TEAM_COOK = AddExtraTeam("Cook", Color(238, 99, 99, 255), "models/player/mossman.mdl", [[As a cook, it is your responsibility to feed the other members
  70. of your city.
  71. You can spawn a microwave and sell the food you make:
  72. /Buymicrowave]], {}, "cook", 2, 45, 0, 0, false)
  73.  
  74. TEAM_CHIEF = AddExtraTeam("Civil Protection Chief", Color(20, 20, 255, 255), "models/player/combine_soldier_prisonguard.mdl", [[The Chief is the leader of the Civil Protection unit.
  75. Coordinate the police forces to bring law to the city
  76. Hit them with arrest baton to put them in jail
  77. Bash them with a stunstick and they might learn better than to
  78. disobey the law.
  79. The Battering Ram can break down the door of a criminal with a
  80. warrant for his/her arrest.
  81. Type /wanted <name> to alert the public to this criminal
  82. Type /jailpos to set the Jail Position]], {"arrest_stick", "unarrest_stick", "weapon_deagle2", "stunstick", "door_ram", "weaponchecker", "item_ammo_pistol"}, "chief", 1, 75, 0, false, true, TEAM_POLICE)
  83.  
  84. TEAM_MAYOR = AddExtraTeam("Mayor", Color(150, 20, 20, 255), "models/player/breen.mdl", [[The Mayor of the city creates laws to serve the greater good
  85. of the people.
  86. If you are the mayor you may create and accept warrants.
  87. Type /wanted <name>  to warrant a player
  88. Type /jailpos to set the Jail Position
  89. Type /lockdown initiate a lockdown of the city.
  90. Everyone must be inside during a lockdown.
  91. The cops patrol the area
  92. /unlockdown to end a lockdown]], {"item_ammo_pistol"}, "mayor", 1, 85, 0, true, false/*, {TEAM_CHIEF, TEAM_POLICE}*/)
  93. /*
  94. --------------------------------------------------------
  95. HOW TO MAKE AN EXTRA CLASS!!!!
  96. --------------------------------------------------------
  97.  
  98. You can make extra classes here. Set everything up here and the rest will be done for you! no more editing 100 files without knowing what you're doing!!!
  99. Ok here's how:
  100.  
  101. To make an extra class do this:
  102. AddExtraTeam( "<NAME OF THE CLASS>", Color(<red>, <Green>, <blue>, 255), "<Player model>" , [[<the description(it can have enters)>]], { "<first extra weapon>","<second extra weapon>", etc...}, "<chat command to become it(WITHOUT THE /!)>", <maximum amount of this team> <the salary he gets>, 0/1/2 = public /admin only / superadmin only, <1/0/true/false Do you have to vote to become it>,  true/false DOES THIS TEAM HAVE A GUN LICENSE?, TEAM: Which team you need to be to become this team)
  103.  
  104. The real example is here: it's the Hobo:                */
  105.  
  106. --VAR without /!!!                      The name    the color(what you see in tab)                   the player model                                   The description
  107. TEAM_HOBO = AddExtraTeam("Hobo", Color(80, 45, 0, 255), "models/player/corpse1.mdl", [[The lowest member of society. All people see you laugh.
  108. You have no home.
  109. Beg for your food and money
  110. Sing for everyone who passes to get money
  111. Make your own wooden home somewhere in a corner or
  112. outside someone else's door]], {"weapon_bugbait"}, "hobo", 5, 0, 0, false)
  113. //No extra weapons           say /hobo to become hobo  Maximum hobo's = 5               his salary = 0 because hobo's don't earn money.          0 = everyone can become hobo ,      false = you don't have to vote to become hobo
  114. // MAKE SURE THAT THERE IS NO / IN THE TEAM NAME OR IN THE TEAM COMMAND:
  115. // TEAM_/DUDE IS WROOOOOONG !!!!!!
  116. // HAVING "/dude" IN THE COMMAND FIELD IS WROOOOOOOONG!!!!
  117. //ADD TEAMS UNDER THIS LINE: