Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("======================5565================="")
- SWEP.Author = "Mekphen"
- SWEP.Base = "weapon_base"
- SWEP.Category = "SWTOR:RP"
- SWEP.Instructions = "Links-Klick: Position auswählen\n Rechtsklick: NPC für Spawnpoint auswählen \n Reload: Alle Spawnpoints von NPC löschen"
- SWEP.WorldModel = "models/weapons/w_toolgun.mdl"
- SWEP.ViewModel = "models/weapons/c_toolgun.mdl"
- SWEP.UseHands = true
- SWEP.SetHoldType = "pistol"
- SWEP.DrawAmmo = false
- SWEP.Spawnable = true
- SWEP.AdminSpawnable = true
- local currentVector = nil
- SWEP.PrintName = "Fahrzeug Spawnpoint Tool"
- SWEP.Slot = 1
- SWEP.SlotPos = 2
- function SWEP:Reload()
- if self.CoolDown and self.CoolDown > CurTime() then return end
- local tr = self.Owner:GetEyeTrace()
- if not tr.Entity then return end
- if tr.Entity:GetClass() == "npc_vehicleDealer" or tr.Entity:GetClass() == "npc_garage" then
- tr.Entity.SpawnPoints = {}
- end
- self.CoolDown = CurTime() + 1
- end
- function SWEP:PrimaryAttack()
- if self.CoolDown and self.CoolDown > CurTime() then return end
- local tr = self.Owner:GetEyeTrace()
- print(tr.HitWorld)
- if currentVector then currentVector = nil end
- if ( tr.HitWorld ) then
- currentVector = tr.HitPos
- self.Owner:PrintMessage( HUD_PRINTTALK, "Spawnpointposition erfolgreich ausgewählt")
- end
- self.CoolDown = CurTime() + 1
- end
- function SWEP:SecondaryAttack()
- if self.CoolDown and self.CoolDown > CurTime() then return end
- // Objekt in Sichtlinie auflösen
- local tr = self.Owner:GetEyeTrace()
- //Überprüfen ob sich in der Sichtlinie ein Entity befindet
- if not tr.Entity then print("Entity not existing") return end
- //Schauen ob der Entity der Fahrzeug Dealer oder die Garage ist.
- print( tr.Entity:GetClass() )
- if tr.Entity:GetClass() == "npc_vehicledealer" or tr.Entity:GetClass() == "npc_garage" then
- local spawnPoint = {}
- spawnPoint.Cooldown = CurTime()
- spawnPoint.Vector = currentVector
- local spawnPoints = tr.Entity:GetSpawnPoints()
- table.insert(spawnPoints, spawnPoint)
- tr.Entity:SetSpawnPoints(spawnPoints)
- self.Owner:PrintMessage( HUD_PRINTTALK, "Spawnpoint erfolgreich zugewiesen")
- else
- self.Owner:PrintMessage( HUD_PRINTTALK, "Du schaust keinen Fahrzeug NPC an")
- end
- self.CoolDown = CurTime() + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement