Ergebnis 1 bis 6 von 6

Thema: Remove | UnOwn - SWEP

  1. #1

    Standard Remove | UnOwn - SWEP

    Lua Code:
    1. if (SERVER) then
    2. 	AddCSLuaFile( "shared.lua" )
    3.  
    4. 	SWEP.Weight		= 5
    5. 	SWEP.AutoSwitchTo	= false
    6. 	SWEP.AutoSwitchFrom	= false
    7. end
    8.  
    9. if ( CLIENT ) then
    10. 	SWEP.Slot			= 2
    11. 	SWEP.SlotPos		= 10
    12. 	SWEP.IconLetter		= "x"
    13. 	SWEP.IconFont		= "CSSelectIcons"
    14. 	SWEP.BounceWeaponIcon	= true
    15. 	SWEP.DrawWeaponInfoBox	= false
    16. 	SWEP.DrawAmmo		= false
    17. 	SWEP.DrawCrosshair	= true
    18. 	SWEP.ViewModelFOV	= 75
    19. 	SWEP.ViewModelFlip	= false
    20. 	SWEP.CSMuzzleFlashes	= true
    21. 	SWEP.SwayScale		= 1.0
    22. 	SWEP.BobScale		= 1.0
    23. 	SWEP.WepSelectIcon	= surface.GetTextureID( "weapons/swep" )
    24. 	--SWEP.SpeechBubbleLid	= surface.GetTextureID( "gui/speech_lid" )
    25.  
    26. 	surface.CreateFont( "csd", ScreenScale( 60 ), 500, true, true, "CSSelectIcons" )
    27. 	surface.CreateFont( "HalfLife2", ScreenScale( 60 ), 500, true, true, "HL2SelectIcons" )
    28. end
    29.  
    30. SWEP.PrintName		= "Multigun"
    31. SWEP.Author			= "Stoned"
    32. SWEP.Contact		= ""
    33. SWEP.Purpose		= "Control Props"
    34. SWEP.Instructions	= "Press Left to unown a prop | right to delete it!"
    35. SWEP.Spawnable		= true
    36. SWEP.AdminSpawnable	= true
    37. SWEP.ViewModel 		= "models/weapons/v_357.mdl"
    38. SWEP.WorldModel 	= "models/weapons/w_357.mdl"
    39.  
    40. SWEP.Primary.Delay			= 0.15
    41. SWEP.Primary.ClipSize		= -1
    42. SWEP.Primary.DefaultClip	= -1
    43. SWEP.Primary.Automatic		= false
    44. SWEP.Primary.Ammo			= "none"
    45.  
    46. SWEP.Secondary.ClipSize		= -1
    47. SWEP.Secondary.DefaultClip	= -1
    48. SWEP.Secondary.Automatic	= false
    49. SWEP.Secondary.Ammo			= "none"
    50.  
    51. module( "UPS", package.seeall )
    52.  
    53. function SWEP:PrimaryAttack()
    54. 	if CLIENT then return end
    55. 	local trace1= {}
    56.     trace.start = self.Owner:GetShootPos()
    57.     trace.endpos = trace.start + (self.Owner:GetAimVector() * 500)
    58.     trace.mask = MASK_SOLID
    59.  	trace.filter = self.Owner
    60.     local tr = util.TraceLine(trace)
    61. 	if !tr.Entity then return false end
    62.     local ent = tr.Entity
    63.     if ent:IsValid() ~= true then return false end
    64.     if ent:GetClass() == "player" then return false end
    65. 	if ent:GetClass() == "worldspawn" then return false end
    66. 	if ent:GetClass() == "gf_bb_spawner" then return false end
    67. 	if ent:GetClass() == "gf_playerspawn" then return false end
    68. 	if ent:GetClass() == "func_brush" then return false end
    69. 	local name = "Unknown" -- Default
    70. 	local id = ent:UPSGetOwner()
    71. 	if id == OWNERID_MAP then
    72. 		name = "1"
    73. 	elseif id == OWNERID_UPFORGRABS then
    74. 		name = "2"
    75. 	elseif id == OWNERID_DEFER then
    76. 		name = "3"
    77. 	else
    78. 		name = nameFromID( id ) or name -- Using "or name" in case we get nil back
    79. 	end
    80.  	if name == self.Owner:Name() or self.Owner:IsSuperAdmin() then
    81.  	    self.Owner:EmitSound(Sound("weapons/357/357_spin1.wav"))
    82.  		ent:UPSClearOwner()
    83.  		self.Owner:PrintMessage( HUD_PRINTTALK, "Prop has been Cleared!" )
    84.  	end
    85.  
    86.  	self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) 		-- View model animation 
    87.  	--self.Owner:MuzzleFlash()								-- Crappy muzzle light 
    88.  	self.Owner:SetAnimation( PLAYER_ATTACK1 )				-- 3rd Person Animation
    89. end
    90.  
    91. function SWEP:SecondaryAttack()
    92. 	if CLIENT then return end
    93. 	local trace = {}
    94.     trace.start = self.Owner:GetShootPos()
    95.     trace.endpos = trace2.start + (self.Owner:GetAimVector() * 500)
    96.     trace.mask = MASK_SOLID
    97.  	trace.filter = self.Owner
    98.     local tr = util.TraceLine(trace)
    99. 	if !tr.Entity then return false end
    100.     local ent = tr.Entity
    101.     if ent:IsValid() ~= true then return false end
    102.     if ent:GetClass() == "player" then return false end
    103. 	if ent:GetClass() == "worldspawn" then return false end
    104. 	if ent:GetClass() == "gf_bb_spawner" then return false end
    105. 	if ent:GetClass() == "gf_playerspawn" then return false end
    106. 	if ent:GetClass() == "func_brush" then return false end
    107. 	local name = "Unknown" -- Default
    108. 	local id = ent:UPSGetOwner()
    109. 	if id == OWNERID_MAP then
    110. 		name = "1"
    111. 	elseif id == OWNERID_UPFORGRABS then
    112. 		name = "2"
    113. 	elseif id == OWNERID_DEFER then
    114. 		name = "3"
    115. 	else
    116. 		name = nameFromID( id ) or name -- Using "or name" in case we get nil back
    117. 	end
    118.  	if name == self.Owner:Name() or name == "2" or self.Owner:IsSuperAdmin() then
    119.  	    self.Owner:EmitSound(Sound("ambient/energy/zap"..math.random(1,3)..".wav"))
    120.  		ent:Remove()
    121.  	end
    122.  
    123.  	self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK ) 	-- View model animation 
    124.  	--self.Owner:MuzzleFlash()								-- Crappy muzzle light 
    125.  	self.Owner:SetAnimation( PLAYER_ATTACK2 )				-- 3rd Person Animation
    126. end

    Das Problem ist, sie funktioniert ned =|
    Zitat Zitat von Stargate75
    ich weis das war ich scheise was ich gemacht aber aber das ist das einzige forum wo cool ist und auf deutsch

  2. #2

    Standard AW: Remove | UnOwn - SWEP

    Hey ich habe die Lösung!

    Es liegt am Code!

    Edit:
    Wie wäre es wenn du mal 'n paar mehr Informationen rausrückst?

    Was soll das Teil machen?
    Was funktioniert genau nicht?
    Geändert von Pac_187 (12.11.2008 um 22:16 Uhr)

  3. Folgender Benutzer sagt Danke zu Pac_187 für den nützlichen Beitrag:


  4. #3

    Standard AW: Remove | UnOwn - SWEP

    Hmm, es soll mit PrimaryAttack den Owner des Props loeschen ( Up for grabs ... )
    Falls man Admin ist macht es den OwnerCheck ned

    Mit SecondaryAttack soll es das prop loeschen.

    Es funktioniert nichts - kein Error - die SWEP wird nicht geladen.

    €dit: Ich benutze UPS da ich zurzeit noch nicht ein eigenes Prop-Protect Script habe, daher die functions ...
    Geändert von Stoned (13.11.2008 um 13:11 Uhr)
    Zitat Zitat von Stargate75
    ich weis das war ich scheise was ich gemacht aber aber das ist das einzige forum wo cool ist und auf deutsch

  5. #4

    Standard AW: Remove | UnOwn - SWEP

    Wieso machst du das ganze nicht als STOOL?

    Ich versuche mich mal für dich dran,
    allerdings musst du dann diese PropProtection Zeugs selber reinbauen

  6. #5

    Standard AW: Remove | UnOwn - SWEP

    Zitat Zitat von Pac_187 Beitrag anzeigen
    Wieso machst du das ganze nicht als STOOL?
    Weil es nicht fuer SandBox ist.

    €dit: zuerst war es nur als Remover, also nur PrimaryAttack und da ging das ganze noch,
    jetzt hab ich Secondary geadded und nun ist es kaputt =(
    Zitat Zitat von Stargate75
    ich weis das war ich scheise was ich gemacht aber aber das ist das einzige forum wo cool ist und auf deutsch

  7. #6

    Standard AW: Remove | UnOwn - SWEP

    Also wenn das removen geklappt hat dann kann es ja bloß am ownen liegen.

    ich hab deinen Code mal kopiert und UPS gedownloadet die Waffe is nicht erschienen!

    Ich hab das ding mal mit nem besseren code zum removen versehen und sonst noch umgeändert das removen hat dann geklappt aber UPS lässt das ownen nicht zu,das kannst du mit UPS vergessen , denn ganz oben in der Console hat gestanden das diese ganzen "OWNERID_" sachen nicht existieren.

    Versuchs mal nochmal und guck was passiert

    Mfg,
    RP-01

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •