Advertisement
SirMasters

Example THingy

Jan 13th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.60 KB | None | 0 0
  1.  
  2. if HL2.GetWorkVar(1) == nil then
  3.     HL2.StoreWorkVar(1, "weapon_ar2" )
  4. end
  5. if HL2.GetWorkVar(2) == nil then
  6.     HL2.StoreWorkVar(2,"weapon_smg1" )
  7. end
  8. if HL2.GetWorkVar(3) == nil then
  9.     HL2.StoreWorkVar(3, "weapon_pistol" )
  10. end
  11. if HL2.GetWorkVar(4) == nil then
  12.     HL2.StoreWorkVar(4, "weapon_crowbar" )
  13. end
  14.  
  15. LoadOutExtra = {}
  16. LoadOutExtra["primary"] = HL2.GetWorkVar(1)
  17. LoadOutExtra["secondary"] = HL2.GetWorkVar(2)
  18. LoadOutExtra["pistol"] = HL2.GetWorkVar(3)
  19. LoadOutExtra["melee"] = HL2.GetWorkVar(4)
  20.  
  21. function Disallowed(slot)
  22.     if NoSlot == nil then
  23.         return false
  24.     end
  25.     for k,v in pairs(NoSlot) do
  26.         if v == slot then
  27.             return true
  28.         end
  29.     end
  30.     return false
  31. end
  32.  
  33. function InstantSpawnEntity(class, pos)
  34.  
  35.     local ent = HL2.CreateEntity(class, pos, VECTORZERO)
  36.     if ent ~= nil then
  37.         HL2.SpawnEntity(ent)
  38.     end
  39.  
  40.     return ent
  41.  
  42. end
  43.  
  44. function LoadOut()
  45.        local   plr = HL2.GetPlayer()
  46.     local pos = HL2.GetAbsOrigin(plr)
  47.     if pos ~= nil then
  48.         if plr ~= nil then
  49.             for k,v in pairs(LoadOutExtra) do
  50.                 if not Disallowed(k) then
  51.                     print(k,v)
  52.                     InstantSpawnEntity(v, pos)
  53.                 end
  54.             end
  55.         --  InstantSpawnEntity("weapon_crowbar", pos)
  56.         end
  57.     end
  58.  
  59. end
  60.  
  61. function GiveSuit()
  62.     local   plr = HL2.GetPlayer()
  63.     local pos = HL2.GetAbsOrigin(plr)
  64.     if pos ~= nil then
  65.         if plr ~= nil then
  66.             InstantSpawnEntity("item_suit", pos)
  67.         --  InstantSpawnEntity("weapon_crowbar", pos)
  68.         end
  69.     end
  70. end
  71.  
  72. print("*** load constant values. \n")
  73. print("Is: " .. HL2.GetWorkVar(1))
  74. print("Is: " .. HL2.GetWorkVar(2))
  75. print("Is: " .. HL2.GetWorkVar(3))
  76. print("Is: " .. HL2.GetWorkVar(4))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement