Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.01 KB | None | 0 0
  1. --[[
  2. Catwork © 2016-2017 TeslaCloud Studios
  3. Do not share.
  4.  
  5. Original code by Alex Grist, 'impulse and Conna Wiles
  6. with contributions from Cloud Sixteen community.
  7. --]]
  8.  
  9. util.Include("cl_schema.lua")
  10. util.Include("cl_hooks.lua")
  11. util.Include("cl_theme.lua")
  12. util.Include("sv_schema.lua")
  13. util.Include("sv_hooks.lua")
  14.  
  15. Schema.customPermits = Schema.customPermits or {}
  16.  
  17. Schema.City = "City-24"
  18. Schema.City_cp = "C24"
  19. Schema.CitizenFactions = {
  20. "#Faction_Citizen",
  21. "#Faction_CWU",
  22. "#Faction_Rebel",
  23. "#Faction_Loyalist",
  24. "#Faction_Vort",
  25. "#Faction_Refugee",
  26. "#Faction_Admin"
  27. }
  28.  
  29. Schema.CitizenStates = {
  30. Unverified = Color(150, 150, 150),
  31. Citizen = Color(70, 140, 70),
  32. AntiCitizen = Color(140, 70, 70),
  33. NoData = Color(70, 70, 140),
  34. Unknown = Color(170, 170, 0),
  35. Deceased = Color(40, 40, 40)
  36. }
  37.  
  38. Schema.LoyalistTiers = {} -- has to go on refresh
  39.  
  40. for k, v in ipairs(_file.Find("models/humans/group17/*.mdl", "GAME")) do
  41. cw.animation:AddMaleHumanModel("models/humans/group17/"..v)
  42. end
  43.  
  44. cw.animation:AddCivilProtectionModel("models/eliteghostcp.mdl")
  45. cw.animation:AddCivilProtectionModel("models/eliteshockcp.mdl")
  46. cw.animation:AddCivilProtectionModel("models/leet_police2.mdl")
  47. cw.animation:AddCivilProtectionModel("models/sect_police2.mdl")
  48. cw.animation:AddCivilProtectionModel("models/policetrench.mdl")
  49. cw.animation:AddCivilProtectionModel("models/metropolice/c08.mdl")
  50. cw.animation:AddFemaleCivilProtectionModel("models/metropolice/c08_female.mdl")
  51. cw.animation:AddFemaleCivilProtectionModel("models/metropolice/c08_female_2.mdl")
  52. cw.animation:AddFemaleCivilProtectionModel("models/n7/cca-c24/donators/n7_792-6.mdl")
  53.  
  54.  
  55. for i = 1, 24 do
  56. cw.animation:AddCivilProtectionModel("models/half_life2/jnstudio/cp_c08_"..i..".mdl")
  57. end
  58.  
  59. for i = 1, 7 do
  60. cw.animation:AddFemaleCivilProtectionModel("models/half_life2/jnstudio/cp_female_c08_"..i..".mdl")
  61. end
  62.  
  63. cw.animation:AddCombineOverwatchModel("models/city8_ow_elite.mdl")
  64. cw.animation:AddCombineOverwatchModel("models/city8_overwatch.mdl")
  65. cw.animation:AddCombineOverwatchModel("models/city8_overwatch_elite.mdl")
  66. cw.animation:AddCombineOverwatchModel("models/city8ow.mdl")
  67.  
  68. cw.animation:AddVortigauntModel("models/vortigaunt_ozaxi.mdl")
  69.  
  70. cw.option:SetKey("default_date", {month = 1, year = 2016, day = 1})
  71. cw.option:SetKey("default_time", {minute = 0, hour = 0, day = 1})
  72. cw.option:SetKey("format_singular_cash", "%a")
  73. cw.option:SetKey("model_shipment", "models/items/item_item_crate.mdl")
  74. cw.option:SetKey("intro_image", "halfliferp/logo4")
  75. cw.option:SetKey("schema_logo", "halfliferp/logo4")
  76. cw.option:SetKey("format_cash", "%a %n")
  77. cw.option:SetKey("menu_music", "")
  78. cw.option:SetKey("name_cash", "#HL2RP_CashName")
  79. cw.option:SetKey("model_cash", "models/props_lab/box01a.mdl")
  80. cw.option:SetKey("gradient", "halfliferp/bg_gradient")
  81.  
  82. config.ShareKey("intro_text_small")
  83. config.ShareKey("intro_text_big")
  84. config.ShareKey("business_cost")
  85. config.ShareKey("permits")
  86. config.ShareKey("sxbase_force_fov")
  87.  
  88. cw.quiz:SetEnabled(true)
  89. cw.quiz:AddQuestion("Что необходимо для RolePlay", 3,
  90. "Администрация",
  91. "Предметы",
  92. "Чат или другой способ коммуникации",--
  93. "Команды '/me', '/it', '/roll' и др.",
  94. "Персонаж в какой-либо фракции")
  95.  
  96. cw.quiz:AddQuestion("Выберите корректное описание персонажа.", 2,
  97. "Мужик высотой 2.5 метра мускулистого телосложения.",
  98. "Мужчина|Темные волосы и карие глаза, имеется бородка|Одет в чистую форму гражданина 'City 17'",--
  99. "Гражданин, долгое время трудящийся на благо Альянса. По натуре добрый и отзывчивый.",
  100. "Мужчина / 23-25 лет / Рост 180-185 см / Вес 80 кг / Арбалет [СПРЯТАН]")
  101.  
  102. cw.quiz:AddQuestion("Вы отыгрываете действие против окружения. Как определить, успешно ли действие?", 2,
  103. "Кинуть /roll 2 раза, если последний ролл больше - успех.",
  104. "Кинуть /roll, если значение больше или равно 50 - успех.",--
  105. "Действия против окружения отыгрываются без /roll.")
  106.  
  107. cw.quiz:AddQuestion("Выберите правильное действие при РП бое.", 3,
  108. "/me ударил",
  109. "/me пинком в солнечное сплетение вывел из строя противника.",
  110. "/me попытался ударить гражданина кулаком в живот.");--
  111.  
  112. cw.flag:Add("v", "Light Blackmarket", "Access to light blackmarket goods.")
  113. cw.flag:Add("V", "Heavy Blackmarket", "Access to heavy blackmarket goods.")
  114. cw.flag:Add("m", "Resistance Manager", "Access to the resistance manager's goods.")
  115. cw.flag:Add("d", "Perma Death", "Disables permanent kill on character's death.")
  116.  
  117. function Schema:DefineLoyalistTier(name, description, color, min, max)
  118. return table.insert(self.LoyalistTiers, {
  119. name = name,
  120. description = description,
  121. color = color,
  122. min = min,
  123. max = max
  124. })
  125. end
  126.  
  127. function Schema:DetermineLoyalistTier(num)
  128. local tier = nil -- we do this to let it loop through everything and see if we've hit the limit.
  129.  
  130. for k, v in ipairs(self.LoyalistTiers) do
  131. if (num >= v.min and ((v.max == -1 and true) or num <= v.max)) then
  132. tier = v
  133. end
  134. end
  135.  
  136. return tier or self.LoyalistTiers[1] or {name = "ERROR", description = "ERROR", color = Color(255, 0, 255), min = -1, max = -1}
  137. end
  138.  
  139. function Schema:PlayerIsLoyalistTier(player, tier)
  140. local points = player:GetCharacterData("LoyaltyPoints", 0)
  141. local tierObj = self:DetermineLoyalistTier(points)
  142.  
  143. if (tierObj) then
  144. return tierObj.name:utf8lower():find(tier:utf8lower())
  145. end
  146.  
  147. return false
  148. end
  149.  
  150. Schema:DefineLoyalistTier("#Loyalist_Grey", "A citizen with no real rights or power", Color(150, 150, 150), 0, 10)
  151. Schema:DefineLoyalistTier("#Loyalist_White", "An ordinary citizen.", Color(255, 255, 255), 11, 30)
  152. Schema:DefineLoyalistTier("#Loyalist_Green", "A citizen, distinguished for their service to the Universal Union.", Color(120, 210, 120), 31, 60)
  153. Schema:DefineLoyalistTier("#Loyalist_Blue", "Lower tier loyalist that has pledged to serve to the Combine.", Color(100, 100, 210), 61, 100)
  154. Schema:DefineLoyalistTier("#Loyalist_Orange", "Highly reputable higher tier loyalist.", Color(210, 180, 50), 101, 149)
  155. Schema:DefineLoyalistTier("#Loyalist_Red", "Ultimate tier loyalist with more rights than some CP recruits.", Color(210, 100, 100), 150, -1)
  156.  
  157. function Schema:CanUseCP(player)
  158. return true
  159. end
  160.  
  161. -- A function to add a custom permit.
  162. function Schema:AddCustomPermit(name, flag, model)
  163. local formattedName = string.gsub(name, "[%s%p]", "")
  164. local lowerName = string.lower(name)
  165.  
  166. self.customPermits[string.lower(formattedName)] = {
  167. model = model,
  168. name = name,
  169. flag = flag,
  170. key = cw.core:SetCamelCase(formattedName, true)
  171. }
  172. end
  173.  
  174. -- A function to check if a string is a Combine rank.
  175. function Schema:IsStringCombineRank(text, rank)
  176. if (type(rank) == "table") then
  177. for k, v in ipairs(rank) do
  178. if (self:IsStringCombineRank(text, v)) then
  179. return true
  180. end
  181. end
  182. elseif (rank == "EpU") then
  183. if (string.find(text, "%pSeC%p") or string.find(text, "%pDvL%p")
  184. or string.find(text, "%pEpU%p") or string.find(text, "%pCmD%p")) then
  185. return true
  186. end
  187. else
  188. return string.find(text, "%p"..rank.."%p")
  189. end
  190. end
  191.  
  192. -- A function to check if a player is a Combine rank.
  193. function Schema:IsPlayerCombineRank(player, rank, realRank)
  194. local name = player:Name()
  195. local faction = player:GetFaction()
  196.  
  197. if (self:IsCombineFaction(faction)) then
  198. if (type(rank) == "table") then
  199. for k, v in ipairs(rank) do
  200. if (self:IsPlayerCombineRank(player, v, realRank)) then
  201. return true
  202. end
  203. end
  204. elseif (rank == "EpU" and !realRank) then
  205. if (string.find(name, "%pSeC%p") or string.find(name, "%pDvL%p")
  206. or string.find(name, "%pEpU%p") or string.find(name, "%pCmD%p")) then
  207. return true
  208. end
  209. else
  210. return string.find(name, "%p"..rank.."%p")
  211. end
  212. end
  213. end
  214.  
  215. -- A function to get a player's Combine rank.
  216. function Schema:GetPlayerCombineRank(player)
  217. local faction = player:GetFaction()
  218.  
  219. if (faction == FACTION_OTA) then
  220. if (self:IsPlayerCombineRank(player, "OWS")) then
  221. return 0
  222. elseif (self:IsPlayerCombineRank(player, "OWC")) then
  223. return 1
  224. elseif (self:IsPlayerCombineRank(player, "EOW")) then
  225. return 2
  226. else
  227. return 3
  228. end
  229. elseif (self:IsPlayerCombineRank(player, "RCT")) then
  230. return 0
  231. elseif (self:IsPlayerCombineRank(player, "04")) then
  232. return 1
  233. elseif (self:IsPlayerCombineRank(player, "03")) then
  234. return 2
  235. elseif (self:IsPlayerCombineRank(player, "02")) then
  236. return 3
  237. elseif (self:IsPlayerCombineRank(player, "01")) then
  238. return 4
  239. elseif (self:IsPlayerCombineRank(player, "GHOST")) then
  240. return 6
  241. elseif (self:IsPlayerCombineRank(player, "OfC")) then
  242. return 7
  243. elseif (self:IsPlayerCombineRank(player, "EpU", true)) then
  244. return 8
  245. elseif (self:IsPlayerCombineRank(player, "DvL")) then
  246. return 9
  247. elseif (self:IsPlayerCombineRank(player, "CmD")) then
  248. return 10
  249. elseif (self:IsPlayerCombineRank(player, "SCN")) then
  250. if (!self:IsPlayerCombineRank(player, "SYNTH")) then
  251. return 11
  252. else
  253. return 12
  254. end
  255. else
  256. return 5
  257. end
  258. end
  259.  
  260. -- A function to get if a faction is Combine.
  261. function Schema:IsCombineFaction(faction)
  262. return (faction == FACTION_MPF or faction == FACTION_OTA)
  263. end
  264.  
  265. function Schema:GetLP(player)
  266. return player:GetNetVar("LoyaltyPoints", 0)
  267. end
  268.  
  269. function Schema:GetCP(player)
  270. return player:GetNetVar("CriminalPoints", 0)
  271. end
  272.  
  273. function Schema:GetCitizenStatus(player)
  274. return player:GetNetVar("CitizenStatus", "Unknown")
  275. end
  276.  
  277. function Schema:GetResidence(player)
  278. return player:GetNetVar("Residence", "Unknown")
  279. end
  280.  
  281. function Schema:GetJailed(player)
  282. return player:GetNetVar("Jailed", false)
  283. end
  284.  
  285. function Schema:GetJob(player)
  286. return player:GetNetVar("Job", "None")
  287. end
  288.  
  289. function Schema:GetWorkPoints(player)
  290. return player:GetNetVar("WorkPoints", 0)
  291. end
  292. -- легион пидор
  293. function Schema:GetCitizenStatusColor(player)
  294. return self.CitizenStates[self:GetCitizenStatus(player)] or Color(255, 255, 255)
  295. end
  296.  
  297. do
  298. local playerMeta = FindMetaTable("Player")
  299.  
  300. function playerMeta:IsCombine()
  301. if (SERVER) then
  302. if (self:GetCharacter()) then
  303. local faction = self:GetFaction()
  304.  
  305. if (Schema:IsCombineFaction(faction) or faction == FACTION_ADMIN) then
  306. return true
  307. end
  308. end
  309. else
  310. local faction = self:GetFaction()
  311.  
  312. if (Schema:IsCombineFaction(faction) or faction == FACTION_ADMIN) then
  313. return true
  314. end
  315. end
  316. end
  317.  
  318. function playerMeta:IsCitizen()
  319. return table.HasValue(Schema.CitizenFactions, self:GetFaction())
  320. end
  321. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement