Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.43 KB | None | 0 0
  1.  
  2.  
  3.  
  4. local NPC = {};
  5.  
  6. NPC.Name = "County Clerk";
  7. NPC.ID = 1;
  8.  
  9. NPC.Model = Model("models/players/perp2/f_2_02.mdl");
  10. NPC.Invisible = false; // Used for ATM Machines, Casino Tables, etc.
  11.  
  12. NPC.Location = { Vector(-4728, 11078, 416), Vector(-4728, 11445, 416) }
  13. NPC.Angles = { Angle(0, 180, 0), Angle(0, 180, 0) };
  14. NPC.ShowChatBubble = "Normal";
  15.  
  16. NPC.Sequence = 3;
  17.  
  18. // This is always local player.
  19.  
  20. local talkto = { "Can I help you?", "I am the city hall clerk, how may I be of assistance?", "What can I do for you?" }
  21.  
  22. function NPC.OnTalk ( )
  23. GAMEMODE.DialogPanel:SetDialog(table.Random(talkto));
  24.  
  25.  
  26. --GAMEMODE.DialogPanel:SetDialog("Welcome to the County Clerk's office, how many I help you?");
  27.  
  28. if (LocalPlayer():Team() == TEAM_CITIZEN) then
  29. if (LocalPlayer():GetUMsgInt("org", 0) == 0) then
  30. GAMEMODE.DialogPanel:AddDialog("I'd like to register an organization, please.", NPC.Chat2)
  31. elseif (GAMEMODE.OrganizationData && GAMEMODE.OrganizationData[LocalPlayer():GetUMsgInt("org", 0)] && GAMEMODE.OrganizationData[LocalPlayer():GetUMsgInt("org", 0)][4]) then
  32. GAMEMODE.DialogPanel:AddDialog("I'd like to disband my organization, please.", NPC.Chat4)
  33. else
  34. GAMEMODE.DialogPanel:AddDialog("I'd like to leave my organization, please.", NPC.Chat6)
  35. end
  36. end
  37.  
  38. GAMEMODE.DialogPanel:AddDialog("What is the process of getting a name change?", NPC.NameChange)
  39.  
  40. if (LocalPlayer():Team() == TEAM_CITIZEN) then
  41. if (GAMEMODE.IsRunningForMayor) then
  42. GAMEMODE.DialogPanel:AddDialog("I'd like to retract my bid for mayordom.", NPC.RunForMayor)
  43. else
  44. GAMEMODE.DialogPanel:AddDialog("I'd like to run for mayor.", NPC.RunForMayor)
  45. end
  46.  
  47. GAMEMODE.DialogPanel:AddDialog("Is the city looking for any Secret Service agents?", NPC.AskAboutSS)
  48. elseif (LocalPlayer():Team() == TEAM_SECRET_SERVICE) then
  49. GAMEMODE.DialogPanel:AddDialog("I'm here to pick up the mayor's limo...", NPC.GrabLimo)
  50. GAMEMODE.DialogPanel:AddDialog("I'd like to resign from my post as a Secret Service agent.", NPC.QuitSS)
  51. end
  52.  
  53. GAMEMODE.DialogPanel:AddDialog("Nevermind... Sorry for bothering you.", LEAVE_DIALOG)
  54.  
  55. GAMEMODE.DialogPanel:Show();
  56. end
  57.  
  58. function NPC.Chat2 ( )
  59. GAMEMODE.DialogPanel:SetDialog("Wonderful! There will be a five thousand dollar filing fee which is only taken in cash; is that okay?");
  60.  
  61. if (LocalPlayer():GetCash() >= 5000) then
  62. GAMEMODE.DialogPanel:AddDialog("Sure, that sounds great.", NPC.Chat3)
  63. GAMEMODE.DialogPanel:AddDialog("Ehh... That seems a tad expensive. I'll have to pass.", LEAVE_DIALOG)
  64. elseif (LocalPlayer():GetCash() + LocalPlayer():GetBank() >= 5000) then
  65. GAMEMODE.DialogPanel:AddDialog("I don't have enough cash on me... Damn beaurocracy.", LEAVE_DIALOG)
  66. else
  67. GAMEMODE.DialogPanel:AddDialog("Looks like I can't aford it... Damn beaurocracy.", LEAVE_DIALOG)
  68. end
  69. end
  70.  
  71. function NPC.Chat3 ( )
  72. GAMEMODE.DialogPanel:SetDialog("(3 Hours Later...) Alright, all the paper work is done. Have a nice day.\n\n[ You can open the Organizations tab with F3. ]");
  73. LocalPlayer():TakeCash(5000);
  74.  
  75. RunConsoleCommand("perp_o_n");
  76.  
  77. GAMEMODE.DialogPanel:AddDialog("Thank you!", LEAVE_DIALOG)
  78. end
  79.  
  80. function NPC.Chat4 ( )
  81. GAMEMODE.DialogPanel:SetDialog("Are you sure? Once I file the paperwork, I can't reform your organization.\n\n[ WARNING: You CANNOT undo this. ]");
  82.  
  83. GAMEMODE.DialogPanel:AddDialog("Yes, I'm sure.", NPC.Chat5)
  84. GAMEMODE.DialogPanel:AddDialog("Nevermind. I need to think about it more.", LEAVE_DIALOG)
  85. end
  86.  
  87. function NPC.Chat5 ( )
  88. GAMEMODE.DialogPanel:SetDialog("Okay, I'll file the paperwork immediately.");
  89.  
  90. RunConsoleCommand("perp_o_q");
  91.  
  92. GAMEMODE.DialogPanel:AddDialog("Thank you.", LEAVE_DIALOG)
  93. end
  94.  
  95. function NPC.Chat6 ( )
  96. GAMEMODE.DialogPanel:SetDialog("Okay, I'll remove you from the organization roster. Have a nice day.");
  97.  
  98. RunConsoleCommand("perp_o_q");
  99.  
  100. GAMEMODE.DialogPanel:AddDialog("Thank you.", LEAVE_DIALOG)
  101. end
  102.  
  103. function NPC.NameChange ( )
  104. GAMEMODE.DialogPanel:SetDialog("It's a simple matter of you paying a nominal filing fee of " .. DollarSign() .. GAMEMODE.RenamePrice .. " and telling us the name that you want.");
  105.  
  106. if (LocalPlayer():GetCash() >= GAMEMODE.RenamePrice) then
  107. GAMEMODE.DialogPanel:AddDialog("Okay, let's do it.", NPC.DoNameChange)
  108. end
  109.  
  110. GAMEMODE.DialogPanel:AddDialog("That seems a little too expensive...", LEAVE_DIALOG)
  111. end
  112.  
  113. function NPC.DoNameChange ( )
  114. LocalPlayer():TakeCash(GAMEMODE.RenamePrice, true);
  115. ShowRenamePanel();
  116. LEAVE_DIALOG();
  117. end
  118.  
  119. function NPC.RunForMayor ( )
  120. if (team.NumPlayers(TEAM_MAYOR) > 0) then
  121. GAMEMODE.DialogPanel:SetDialog("We already have a mayor, so you'll need to wait for the next election cycle.");
  122. GAMEMODE.DialogPanel:AddDialog("Okay, I'll check back later.", LEAVE_DIALOG)
  123. return;
  124. end
  125.  
  126. if (LocalPlayer():Team() != TEAM_CITIZEN) then
  127. GAMEMODE.DialogPanel:SetDialog("Unfortunately you cannot run for mayor while serving as a government official. Conflict of interests, unfortunately.\n\n(If you wish to run for mayor, you must first quit your other job.)");
  128. GAMEMODE.DialogPanel:AddDialog("Oh, okay.", LEAVE_DIALOG)
  129. return;
  130. end
  131.  
  132. if (LocalPlayer():GetNetworkedBool("warrent", false)) then
  133. GAMEMODE.DialogPanel:SetDialog("We do not allowed people with an active warrent to run for mayor.\n\n(You have a warrent; you must get rid of it before running for mayor.)");
  134. GAMEMODE.DialogPanel:AddDialog("Oh, okay.", LEAVE_DIALOG)
  135. return;
  136. end
  137.  
  138. /*
  139. if (LocalPlayer():GetPERPLevel(GENE_INFLUENCE) < 1) then
  140. GAMEMODE.DialogPanel:SetDialog("You do not seem to possess the characteristics that we look for in mayors.\n\n(You must have at least level 1 of the influence gene to be mayor.)");
  141. GAMEMODE.DialogPanel:AddDialog("That's unfortunate.", LEAVE_DIALOG)
  142. return;
  143. end
  144. */
  145.  
  146. if (LocalPlayer():HasBlacklist(GAMEMODE.teamToBlacklist[TEAM_MAYOR])) then
  147. local expires = LocalPlayer():HasBlacklist(GAMEMODE.teamToBlacklist[TEAM_FIREMAN]);
  148.  
  149. if (expires == 0) then
  150. GAMEMODE.DialogPanel:SetDialog("I'm afraid you've reached your term limits.\n\n(You are permanently blacklisted from this occupation.)");
  151. elseif (GAMEMODE.Options_EuroStuff:GetBool()) then
  152. GAMEMODE.DialogPanel:SetDialog("I'm afraid you've reached your term limits.\n\n(You are currently blacklisted from this occupation. Expires on " .. os.date("%B %d, 20%y at %H:%M", expires) .. ".)");
  153. else
  154. GAMEMODE.DialogPanel:SetDialog("I'm afraid you've reached your term limits.\n\n(You are currently blacklisted from this occupation. Expires on " .. os.date("%B %d, 20%y at %I:%M %p", expires) .. ".)");
  155. end
  156.  
  157. GAMEMODE.DialogPanel:AddDialog("Oh, right...", LEAVE_DIALOG);
  158. return;
  159. end
  160.  
  161. if (GAMEMODE.IsRunningForMayor) then
  162. GAMEMODE.DialogPanel:SetDialog("Okay, I've taken your name off of the ballot.");
  163. GAMEMODE.DialogPanel:AddDialog("Okay, thank you.", LEAVE_DIALOG)
  164. GAMEMODE.IsRunningForMayor = nil;
  165.  
  166. RunConsoleCommand("perp_g_b");
  167. else
  168. GAMEMODE.IsRunningForMayor = true;
  169. GAMEMODE.DialogPanel:SetDialog("Okay, I've added your name to the ballot.");
  170. GAMEMODE.DialogPanel:AddDialog("Okay, thank you.", LEAVE_DIALOG)
  171.  
  172. RunConsoleCommand("perp_g_b");
  173. end
  174. end
  175.  
  176. function NPC.AskAboutSS ( )
  177. local SSNumber = team.NumPlayers(TEAM_SECRET_SERVICE);
  178.  
  179. if (team.NumPlayers(TEAM_MAYOR) == 0) then
  180. GAMEMODE.DialogPanel:SetDialog("We do not currently have a mayor - what would be the point in protecting someone who doesn't exist?");
  181.  
  182. GAMEMODE.DialogPanel:AddDialog("I guess that makes sense...", LEAVE_DIALOG);
  183. elseif (SSNumber >= GAMEMODE.MaximumSecretService) then
  184. GAMEMODE.DialogPanel:SetDialog("Sorry, we're not currently looking to hire any new secret service agents.\n\n(This class is full. Try again later.)");
  185.  
  186. GAMEMODE.DialogPanel:AddDialog("Alright. I'll check back in later, then.", LEAVE_DIALOG);
  187. elseif (LocalPlayer():GetNetworkedBool("warrent", false)) then
  188. GAMEMODE.DialogPanel:SetDialog("We do not allow criminals to serve as government officials.\n\n(You have a warrent; you must get rid of it before becoming a police officer.)");
  189.  
  190. GAMEMODE.DialogPanel:AddDialog("Oh, okay...", LEAVE_DIALOG);
  191. elseif (LocalPlayer():HasBlacklist(GAMEMODE.teamToBlacklist[TEAM_SECRET_SERVICE])) then
  192. local expires = LocalPlayer():HasBlacklist(GAMEMODE.teamToBlacklist[TEAM_SECRET_SERVICE]);
  193.  
  194. if (expires == 0) then
  195. GAMEMODE.DialogPanel:SetDialog("I don't think I can trust you after what happened last time.\n\n(You are permanently blacklisted from this occupation.)");
  196. elseif (GAMEMODE.Options_EuroStuff:GetBool()) then
  197. GAMEMODE.DialogPanel:SetDialog("I don't think I can trust you after what happened last time.\n\n(You are currently blacklisted from this occupation. Expires on " .. os.date("%B %d, 20%y at %H:%M", expires) .. ".)");
  198. else
  199. GAMEMODE.DialogPanel:SetDialog("I don't think I can trust you after what happened last time.\n\n(You are currently blacklisted from this occupation. Expires on " .. os.date("%B %d, 20%y at %I:%M %p", expires) .. ".)");
  200. end
  201.  
  202. GAMEMODE.DialogPanel:AddDialog("Oh, right...", LEAVE_DIALOG);
  203. elseif (LocalPlayer():GetTimePlayed() < GAMEMODE.RequiredTime_SecretService * 60 * 60 && !LocalPlayer():IsBronze()) then
  204. GAMEMODE.DialogPanel:SetDialog("Sorry, but it appears that you are not qualified for this position.\n\n(You need at least " .. GAMEMODE.RequiredTime_SecretService .. " hours of play time or VIP to be an officer.)");
  205.  
  206. GAMEMODE.DialogPanel:AddDialog("Alright. I'll check back in later, then.", LEAVE_DIALOG);
  207. elseif (GAMEMODE.IsRunningForMayor) then
  208. GAMEMODE.DialogPanel:SetDialog("Sorry, but people running for mayordom cannot be hired by the city due to legal issues.");
  209.  
  210. GAMEMODE.DialogPanel:AddDialog("Oh, that's lame.", LEAVE_DIALOG);
  211. else
  212. GAMEMODE.DialogPanel:SetDialog("Yes, of course. Welcome to the Evocity branch of the Secret Service. As a member of the secret service, you are tasked with the protection of the mayor at all cost. You will also have, if the mayor so chooses to supply you with one, a stretch limo that you can use to help the mayor travel about the city.\n\n(If you abuse your new-found power, you will be blacklisted and possibly banned.)");
  213.  
  214. RunConsoleCommand('perp_ss_j');
  215.  
  216. GAMEMODE.DialogPanel:AddDialog("Thank you. I'll get my suit on!", LEAVE_DIALOG);
  217. end
  218. end
  219.  
  220. function NPC.QuitSS ( )
  221. LEAVE_DIALOG();
  222.  
  223. RunConsoleCommand('perp_ss_q');
  224. ClientCar = 0;
  225. end
  226.  
  227. function NPC.GrabLimo ( )
  228. local numSquadCars = 0;
  229.  
  230. for k, v in pairs(ents.FindByClass("prop_vehicle_jeep")) do
  231. local vT = lookForVT(v);
  232.  
  233. if (vT && vT.RequiredClass == TEAM_SECRET_SERVICE && v:GetNetworkedEntity("owner", nil) != LocalPlayer()) then
  234. numSquadCars = numSquadCars + 1;
  235. end
  236. end
  237.  
  238. if (GAMEMODE.MaxStretch == 0) then
  239. GAMEMODE.DialogPanel:SetDialog("Sorry, but the limo is out for repairs.\n\n(The mayor has not chosen to fund a limo for the Secret Service.)");
  240.  
  241. GAMEMODE.DialogPanel:AddDialog("Okay, I'll check back later.", LEAVE_DIALOG);
  242. elseif (numSquadCars >= GAMEMODE.MaxStretch) then
  243. GAMEMODE.DialogPanel:SetDialog("Sorry, but the limo is already out. Try calling your partner, perhaps?");
  244.  
  245. GAMEMODE.DialogPanel:AddDialog("Good idea.", LEAVE_DIALOG);
  246. else
  247. GAMEMODE.DialogPanel:SetDialog("Sure, here are the keys.\n\n(The limo can be found on the sidewalk outside of the Government Center.)");
  248.  
  249. RunConsoleCommand('perp_ss_c');
  250.  
  251. GAMEMODE.DialogPanel:AddDialog("Thank you!", LEAVE_DIALOG);
  252. end
  253. end
  254.  
  255. GAMEMODE:LoadNPC(NPC);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement