Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.24 KB | None | 0 0
  1. ///////////////////////////////
  2. // © 2009-2010 Pulsar Effect //
  3. //    All rights reserved    //
  4. ///////////////////////////////
  5. // This material may not be  //
  6. //   reproduced, displayed,  //
  7. //  modified or distributed  //
  8. // without the express prior //
  9. // written permission of the //
  10. //   the copyright holder.   //
  11. ///////////////////////////////
  12. local NPC = {};
  13.  
  14. NPC.Name = "Garage";
  15. NPC.ID = 5;
  16.  
  17. NPC.Model = Model("models/players/PERP2/f_3_02.mdl");
  18. NPC.Invisible = false; // Used for ATM Machines, Casino Tables, etc.
  19.  
  20. NPC.Location = Vector(-5317.2427, -10296.3262, 71.0313);
  21. NPC.Angles = Angle(0, 0, 0);
  22. NPC.ShowChatBubble = "Normal";
  23.  
  24. NPC.Sequence = 6;
  25.  
  26. // This is always local player.
  27. function NPC.OnTalk ( )
  28.     GAMEMODE.DialogPanel:SetDialog("Can I help you?");
  29.    
  30.     if (LocalPlayer():Team() == TEAM_CITIZEN) then
  31.         GAMEMODE.DialogPanel:AddDialog("Yes, I've come to claim my car.", NPC.License)
  32.         GAMEMODE.DialogPanel:AddDialog("I think I'm lost...", LEAVE_DIALOG)
  33.     else
  34.         GAMEMODE.DialogPanel:AddDialog("No.", LEAVE_DIALOG)
  35.     end
  36.    
  37.     GAMEMODE.DialogPanel:Show();
  38. end
  39.  
  40.     function NPC.License()
  41.    
  42.     GAMEMODE.DialogPanel:SetDialog("Do you have a Driving License?")
  43.  
  44.     tmysql.query("SELECT `id`, `license` FROM `perp_users` WHERE `id`='".. Player.SMFID .."'", function ( DLicense )
  45.    
  46.     Player:SetUMsgInt("license", tonumber(DLicense[1][2]));
  47.    
  48.     if (DLicense[1][2] > 0) then
  49.    
  50.         GAMEMODE.DialogPanel:AddDialog("Yes, I've come to claim my car.", NPC.ClaimCar)
  51.         GAMEMODE.DialogPanel:AddDialog("Yes, I want to change cars, please.", NPC.NewCar)
  52.         GAMEMODE.DialogPanel:AddDialog("Nevermind, I don't want my car right now.", LEAVE_DIALOG)
  53.        
  54.         else
  55.        
  56.         GAMEMODE.DialogPanel:AddDialog("*Walks away arkwardly*", LEAVE_DIALOG)
  57.    
  58.     Player:SetPrivateInt("license", tonumber(DLicense[1][2]), true);
  59.     end
  60.     end);
  61.     end
  62.  
  63. function NPC.NewCar ( )
  64.         GAMEMODE.ShowGarageView();
  65.         LEAVE_DIALOG();
  66. end
  67.  
  68. function NPC.ClaimCar ( )
  69.     local CarID = LocalPlayer():GetLastCar();
  70.     -- LocalPlayer():Notify(""..CarID.."");
  71.     if LocalPlayer():GetLastCar() == 0 or LocalPlayer():GetLastCar() == nil or LocalPlayer():GetLastCar() == "" then
  72.         GAMEMODE.DialogPanel:SetDialog("It doesn't seem like you were in a car recently.\n(Use Change cars menu or buy a car.)");
  73.        
  74.         GAMEMODE.DialogPanel:AddDialog("Hmm, ok then.", LEAVE_DIALOG)
  75.     else
  76.     /*
  77.         if GAMEMODE.IsSerious then
  78.             if LocalPlayer():GetCash() < 2000 then
  79.                 GAMEMODE.DialogPanel:SetDialog("It seems you don't have enough cash on you.");
  80.            
  81.                 GAMEMODE.DialogPanel:AddDialog("Damn, I will be back when I get the cash.", LEAVE_DIALOG)
  82.             else
  83.                 --LocalPlayer():TakeCash(2000);
  84.                 RunConsoleCommand('perp_v_c', CarID, 1);
  85.                 LEAVE_DIALOG();
  86.             end
  87.         else
  88.             if LocalPlayer():GetCash() < 500 then
  89.                 GAMEMODE.DialogPanel:SetDialog("It seems you don't have enough cash on you.");
  90.            
  91.                 GAMEMODE.DialogPanel:AddDialog("Damn, I will be back when I get the cash.", LEAVE_DIALOG)
  92.             else
  93.                 --LocalPlayer():TakeCash(500);
  94.                 RunConsoleCommand('perp_v_c', CarID, 1);
  95.                 LEAVE_DIALOG();
  96.             end
  97.         end
  98.     */
  99.         RunConsoleCommand('perp_v_c', CarID);
  100.         LEAVE_DIALOG();
  101.     end
  102. end
  103.  
  104. function NPC.DoFuel ( )
  105.     local CarID = tostring(LocalPlayer():GetLastCar());
  106.     if LocalPlayer():GetCash() < 50 then
  107.         GAMEMODE.DialogPanel:SetDialog("It seems you don't have enough cash on you.");
  108.        
  109.         GAMEMODE.DialogPanel:AddDialog("Damn, I will be back when I get the cash.", LEAVE_DIALOG)
  110.     else
  111.         LocalPlayer():TakeCash(50);
  112.         RunConsoleCommand('perp_c_c', 50);
  113.         RunConsoleCommand('perp_v_c', CarID);
  114.         GAMEMODE.DialogPanel:AddDialog("", LEAVE_DIALOG)
  115.     end
  116. end
  117.  
  118. function NPC.DoFix ( )
  119.     local CarID = tostring(LocalPlayer():GetLastCar());
  120.     if LocalPlayer():GetCash() < 2000 then
  121.         GAMEMODE.DialogPanel:SetDialog("It seems you don't have enough cash on you.");
  122.  
  123.         GAMEMODE.DialogPanel:AddDialog("Damn, I will be back when I get the cash.", LEAVE_DIALOG)
  124.     else
  125.         RunConsoleCommand('perp_c_c', 2000);
  126.         LocalPlayer():SetCarState(0);
  127.         LocalPlayer():TakeCash(2000);
  128.         RunConsoleCommand('perp_v_c', CarID);
  129.         GAMEMODE.DialogPanel:AddDialog("", LEAVE_DIALOG);
  130.     end
  131. end
  132. GAMEMODE:LoadNPC(NPC);
  133.  
  134. function MiniDebug(Ply, Cmd, Args)
  135.     print (LocalPlayer():GetLastCar())
  136. end
  137. concommand.Add("perp_lastcar_debug", MiniDebug)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement