Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. print("======================5565================="")
  2. SWEP.Author = "Mekphen"
  3. SWEP.Base = "weapon_base"
  4. SWEP.Category = "SWTOR:RP"
  5.  
  6. SWEP.Instructions = "Links-Klick: Position auswählen\n Rechtsklick: NPC für Spawnpoint auswählen \n Reload: Alle Spawnpoints von NPC löschen"
  7.  
  8. SWEP.WorldModel = "models/weapons/w_toolgun.mdl"
  9. SWEP.ViewModel = "models/weapons/c_toolgun.mdl"
  10. SWEP.UseHands = true
  11. SWEP.SetHoldType = "pistol"
  12.  
  13.  
  14. SWEP.DrawAmmo = false
  15.  
  16. SWEP.Spawnable = true
  17. SWEP.AdminSpawnable = true
  18.  
  19. local currentVector = nil
  20.  
  21. SWEP.PrintName = "Fahrzeug Spawnpoint Tool"
  22. SWEP.Slot = 1
  23. SWEP.SlotPos = 2
  24.  
  25. function SWEP:Reload()
  26. if self.CoolDown and self.CoolDown > CurTime() then return end
  27. local tr = self.Owner:GetEyeTrace()
  28. if not tr.Entity then return end
  29. if tr.Entity:GetClass() == "npc_vehicleDealer" or tr.Entity:GetClass() == "npc_garage" then
  30. tr.Entity.SpawnPoints = {}
  31. end
  32. self.CoolDown = CurTime() + 1
  33. end
  34.  
  35. function SWEP:PrimaryAttack()
  36. if self.CoolDown and self.CoolDown > CurTime() then return end
  37. local tr = self.Owner:GetEyeTrace()
  38.  
  39. print(tr.HitWorld)
  40. if currentVector then currentVector = nil end
  41. if ( tr.HitWorld ) then
  42. currentVector = tr.HitPos
  43. self.Owner:PrintMessage( HUD_PRINTTALK, "Spawnpointposition erfolgreich ausgewählt")
  44. end
  45. self.CoolDown = CurTime() + 1
  46. end
  47.  
  48. function SWEP:SecondaryAttack()
  49. if self.CoolDown and self.CoolDown > CurTime() then return end
  50. // Objekt in Sichtlinie auflösen
  51. local tr = self.Owner:GetEyeTrace()
  52. //Überprüfen ob sich in der Sichtlinie ein Entity befindet
  53. if not tr.Entity then print("Entity not existing") return end
  54.  
  55. //Schauen ob der Entity der Fahrzeug Dealer oder die Garage ist.
  56. print( tr.Entity:GetClass() )
  57. if tr.Entity:GetClass() == "npc_vehicledealer" or tr.Entity:GetClass() == "npc_garage" then
  58. local spawnPoint = {}
  59. spawnPoint.Cooldown = CurTime()
  60. spawnPoint.Vector = currentVector
  61.  
  62. local spawnPoints = tr.Entity:GetSpawnPoints()
  63. table.insert(spawnPoints, spawnPoint)
  64. tr.Entity:SetSpawnPoints(spawnPoints)
  65. self.Owner:PrintMessage( HUD_PRINTTALK, "Spawnpoint erfolgreich zugewiesen")
  66. else
  67. self.Owner:PrintMessage( HUD_PRINTTALK, "Du schaust keinen Fahrzeug NPC an")
  68. end
  69. self.CoolDown = CurTime() + 1
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement