Seite 2 von 2 ErsteErste 12
Ergebnis 11 bis 19 von 19

Thema: anzeigen in der console von lua waffen

  1. #11

    Standard AW: anzeigen in der console von lua waffen

    entities:
    cl_init:
    Lua Code:
    1. include('shared.lua')
    2.  
    3. /*---------------------------------------------------------
    4.    Name: Draw
    5.    Desc: Draw it!
    6. ---------------------------------------------------------*/
    7. function ENT:Draw()
    8. 	self.Entity:DrawModel()
    9. end
    10.  
    11.  
    12. /*---------------------------------------------------------
    13.    Name: IsTranslucent
    14.    Desc: Return whether object is translucent or opaque
    15. ---------------------------------------------------------*/
    16. function ENT:IsTranslucent()
    17. 	return true
    18. end

    init:
    Lua Code:
    1. AddCSLuaFile( "cl_init.lua" )
    2. AddCSLuaFile( "shared.lua" )
    3.  
    4. include('shared.lua')
    5.  
    6. function ENT:Initialize()
    7.  
    8. 	self.Entity:SetModel("models/weapons/w_eq_fraggrenade.mdl")
    9. 	self.Entity:PhysicsInit( SOLID_VPHYSICS )
    10. 	self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
    11. 	self.Entity:SetSolid( SOLID_VPHYSICS )
    12. 	self.Entity:DrawShadow( false )
    13.  
    14. 	// Don't collide with the player
    15. 	self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
    16.  
    17. 	local phys = self.Entity:GetPhysicsObject()
    18.  
    19. 	if (phys:IsValid()) then
    20. 		phys:Wake()
    21. 	end
    22.  
    23. 	self.timer = CurTime() + 4
    24. end
    25.  
    26. function ENT:Think()
    27. 	if self.timer < CurTime() then
    28. 		local range = 512
    29. 		local damage = 0
    30. 		local pos = self.Entity:GetPos()
    31.  
    32. 		//self.Entity:EmitSound(Sound("sounds/weapons/exp2.wav"..math.random(3,5)..".wav"))
    33. 		self.Entity:Remove()
    34.  
    35. 		for i,pl in pairs(player.GetAll()) do
    36. 			local plp = pl:GetShootPos()
    37.  
    38. 			if (plp - pos):Length() <= range then
    39. 				local trace = {}
    40. 					trace.start = plp
    41. 					trace.endpos = pos
    42. 					trace.filter = pl
    43. 					trace.mask = COLLISION_GROUP_PLAYER
    44. 				trace = util.TraceLine(trace)
    45.  
    46. 				if trace.Fraction == 1 then
    47. 					pl:TakeDamage(trace.Fraction * damage)
    48. 				end
    49. 			end
    50. 		end
    51. 		local exp = ents.Create("2000")
    52. 			exp:SetKeyValue("spawnflags",128)
    53. 			exp:SetPos(pos)
    54. 		exp:Spawn()
    55. 		exp:Fire("explode","",0)
    56. 		local exp = ents.Create("2000")
    57. 			exp:SetKeyValue("magnitude",150)
    58. 			exp:SetPos(pos)
    59. 		exp:Spawn()
    60. 		exp:Fire("explode","",0)
    61. 	end
    62. end
    63.  
    64. /*---------------------------------------------------------
    65.    Name: OnTakeDamage
    66.    Desc: Entity takes damage
    67. ---------------------------------------------------------*/
    68. function ENT:OnTakeDamage( dmginfo )
    69.  
    70. /*
    71. 	Msg( tostring(dmginfo) .. "\n" )
    72. 	Msg( "Inflictor:\t" .. tostring(dmginfo:GetInflictor()) .. "\n" )
    73. 	Msg( "Attacker:\t" .. tostring(dmginfo:GetAttacker()) .. "\n" )
    74. 	Msg( "Damage:\t" .. tostring(dmginfo:GetDamage()) .. "\n" )
    75. 	Msg( "Base Damage:\t" .. tostring(dmginfo:GetBaseDamage()) .. "\n" )
    76. 	Msg( "Force:\t" .. tostring(dmginfo:GetDamageForce()) .. "\n" )
    77. 	Msg( "Position:\t" .. tostring(dmginfo:GetDamagePosition()) .. "\n" )
    78. 	Msg( "Reported Pos:\t" .. tostring(dmginfo:GetReportedPosition()) .. "\n" )	// ?
    79. */
    80.  
    81. end
    82.  
    83.  
    84. /*---------------------------------------------------------
    85.    Name: Use
    86. ---------------------------------------------------------*/
    87. function ENT:Use( activator, caller, type, value )
    88. end
    89.  
    90.  
    91. /*---------------------------------------------------------
    92.    Name: StartTouch
    93. ---------------------------------------------------------*/
    94. function ENT:StartTouch( entity )
    95. end
    96.  
    97.  
    98. /*---------------------------------------------------------
    99.    Name: EndTouch
    100. ---------------------------------------------------------*/
    101. function ENT:EndTouch( entity )
    102. end
    103.  
    104.  
    105. /*---------------------------------------------------------
    106.    Name: Touch
    107. ---------------------------------------------------------*/
    108. function ENT:Touch( entity )
    109. end

    shared:
    Lua Code:
    1. //ENT.Base = "base_entity"
    2. ENT.Type = "anim"
    3.  
    4. ENT.PrintName		= "FusionGrenade"
    5. ENT.Author		= "[JEM]TheReignOfTheDesserted"
    6. ENT.Contact		= "[email protected]"
    7. ENT.Purpose		= "I will the world may cry"
    8. ENT.Instructions	= "Left klick to throw"
    9.  
    10.  
    11. /*---------------------------------------------------------
    12.    Name: OnRemove
    13.    Desc: Called just before entity is deleted
    14. ---------------------------------------------------------*/
    15. function ENT:OnRemove()
    16. end
    17.  
    18. function ENT:PhysicsUpdate()
    19. end
    20.  
    21. function ENT:PhysicsCollide(data,phys)
    22. 	if data.Speed > 50 then
    23. 		self.Entity:EmitSound(Sound("HEGrenade.Bounce"))
    24. 	end
    25.  
    26. 	local impulse = -data.Speed * data.HitNormal * .4 + (data.OurOldVelocity * -.6)
    27. 	phys:ApplyForceCenter(impulse)
    28. end

    oder stimmt da was nicht?
    Doppelpost:
    danke
    Geändert von RP-01 (22.06.2008 um 20:16 Uhr) Grund: Doppelposts zusammengefügt

  2. #12

    Standard AW: anzeigen in der console von lua waffen

    ich hab bei der waffe noch neh Meldung: ...shared.lua:126:tried to acces a NULL Entity
    Geändert von RP-01 (27.06.2008 um 16:56 Uhr) Grund: v

  3. #13

    Standard AW: anzeigen in der console von lua waffen

    Zitat Zitat von janeric95 Beitrag anzeigen
    ich hab bei der waffe noch neh Meldung: ...shared.lua:126:tried to acces a NULL Entity
    Wie wärs, wenn du shared.lua posten würdest?
    Klick here -> Bløg :D

  4. #14

    Standard AW: anzeigen in der console von lua waffen

    der aktuelle file ist auf der ersten seite

  5. #15
    Avatar von Scarecrow
    Registriert seit
    15.12.2005
    Ort
    Nordrhein-Westfalen

    Standard AW: anzeigen in der console von lua waffen

    Wie wärs mal wenn du English lernen würdest?
    Welches ist die Höchstgeschwindigkeit einer unbeladenen Schwalbe?

  6. #16

    Standard AW: anzeigen in der console von lua waffen

    kann ich ja ich habs übersetzt weiß aber nicht was ich da ändern soll

  7. #17
    Avatar von Scarecrow
    Registriert seit
    15.12.2005
    Ort
    Nordrhein-Westfalen

    Standard AW: anzeigen in der console von lua waffen

    Das war jetzt nicht direkt darauf bezogen, eher für alles insgesamt, aber da du es ja kannst, ist es gut

    Jedenfalls sehe ich da viel zu viele "end" am Ende des Scripts
    Welches ist die Höchstgeschwindigkeit einer unbeladenen Schwalbe?

  8. #18

    Standard AW: anzeigen in der console von lua waffen

    ja das stimmt aber da musste ich schon 2 weg machen!aber ich weiß nicht was der versucht, um auf eine ungültige Entität zuzugreifen!
    ich hab die fusionnuke von meinem anderen thread fertig, sie klappt auch! da war das gleiche problem dann hab ich iergendwo en space hingemacht und dann gings
    Doppelpost:
    also wenn ich jetzt mein entity "grenade" nenne muss ich dann in zeile 126(weswegen die obige meldung kommt) statt end ein izo hinschreiben?
    Geändert von RP-01 (27.06.2008 um 18:03 Uhr) Grund: Doppelposts zusammengefügt

  9. #19

    Standard AW: anzeigen in der console von lua waffen

    Lua Code:
    1. if (SERVER) then
    2. 	AddCSLuaFile( "shared.lua" )
    3. 	SWEP.Weight				= 5
    4. 	SWEP.AutoSwitchTo		= true
    5. 	SWEP.AutoSwitchFrom		= true
    6. end
    7.  
    8. if (CLIENT) then
    9. 	SWEP.DrawAmmo			= true
    10. 	SWEP.DrawCrosshair		= false
    11. 	SWEP.ViewModelFOV		= 82
    12. 	SWEP.ViewModelFlip		= true
    13. 	SWEP.CSMuzzleFlashes	= true
    14.  
    15. 	SWEP.ViewModelFlip		= false
    16.  
    17. end
    18.  
    19. if ( CLIENT ) then
    20. 	SWEP.Author			= "[JEM]TheReignOfTheDesserted"
    21. 	SWEP.Contact			= "[email protected]"
    22. 	SWEP.Purpose			= "I will the world mayy cry!"
    23. 	SWEP.Instructions		= "Left klick to Throw"
    24. 	SWEP.PrintName			= "FusionFrenade"
    25. 	SWEP.Slot			= 3
    26. 	SWEP.SlotPos			= 2
    27. 	SWEP.IconLetter			= "O"
    28.  
    29. 	SWEP.ViewModelFlip		= false
    30.  
    31. end
    32.  
    33. SWEP.Spawnable			= true
    34. SWEP.AdminSpawnable		= true
    35.  
    36. SWEP.ViewModel			= "models/weapons/v_gravball.mdl"
    37. SWEP.WorldModel			= "models/weapons/w_gravball.mdl"
    38. SWEP.HoldType			= "grenade"
    39.  
    40. SWEP.Primary.Sound		= Sound("Default.PullPin_Grenade")
    41. SWEP.Primary.Recoil		= 0
    42. SWEP.Primary.Unrecoil		= 0
    43. SWEP.Primary.Damage		= 50000
    44. SWEP.Primary.NumShots		= 1
    45. SWEP.Primary.Cone		= 0
    46. SWEP.Primary.Delay		= 1
    47.  
    48. SWEP.Primary.ClipSize		= 10
    49. SWEP.Primary.DefaultClip	= 10000
    50. SWEP.Primary.Automatic		= false
    51. SWEP.Primary.Ammo		= "grenade"
    52.  
    53. SWEP.Secondary.ClipSize		= -1
    54. SWEP.Secondary.DefaultClip	= -1
    55. SWEP.Secondary.Automatic	= false
    56. SWEP.Secondary.Ammo		= "none"
    57.  
    58. SWEP.Next = CurTime()
    59. SWEP.Primed = 0
    60.  
    61. function SWEP:Reload()
    62. 	return false
    63. end
    64.  
    65. function SWEP:Deploy()
    66. 	return true
    67. end
    68.  
    69. function SWEP:Holster()
    70. 	self.Next = CurTime()
    71. 	self.Primed = 0
    72. 	return true
    73. end
    74.  
    75. function SWEP:ShootEffects()
    76. 	self.Weapon:SendWeaponAnim( ACT_VM_THROW ) 		// View model animation
    77. 	//self.Owner:MuzzleFlash()								// Crappy muzzle light
    78. 	self.Owner:SetAnimation( PLAYER_ATTACK1 )				// 3rd Person Animation
    79. end
    80.  
    81.  
    82. function SWEP:PrimaryAttack()
    83.  
    84. 	if self.Next < CurTime() then
    85. 		if self.Primed == 1 and not self.Owner:KeyDown(IN_ATTACK) then
    86. 			self.Weapon:SendWeaponAnim(ACT_VM_THROW)
    87. 			self.Primed = 2
    88. 			self.Next = CurTime() + .3
    89. 		elseif self.Primed == 2 then
    90. 			self.Primed = 0
    91. 			self.Next = CurTime() + self.Primary.Delay
    92.  
    93. 			if SERVER then
    94. 				local ent = ents.Create("grenade")
    95.  
    96. 				ent:SetPos(self.Owner:GetShootPos())
    97. 				ent:SetAngles(Vector(1,0,0))
    98. 				ent:Spawn()
    99.  
    100. 				local phys = ent:GetPhysicsObject()
    101. 				phys:SetVelocity(self.Owner:GetAimVector() * 1000)
    102. 				phys:AddAngleVelocity(Vector(math.random(-1000,1000),math.random(-1000,1000),math.random(-1000,1000)))
    103.  
    104. 				self.Owner:RemoveAmmo(1,self.Primary.Ammo)
    105.  
    106. 				if self.Owner:GetAmmoCount(self.Primary.Ammo) > 0 then
    107. 					self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
    108. 				end
    109. 			end
    110. 		end
    111. 	end
    112.  
    113. if ( !self:CanPrimaryAttack() ) then return end
    114.  
    115. 			self:TakePrimaryAmmo( 1 )
    116.  
    117. 			self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
    118.  
    119. 			self.Owner:SetAnimation( PLAYER_ATTACK1 )
    120.  
    121. 			self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
    122.  
    123. 			self.Weapon:EmitSound( self.Primary.Sound, 100, 100 )
    124.  
    125. 		self.Owner:ViewPunch(Vector(math.Rand(-1,1),math.Rand(-1,1),math.Rand(-9,-4))) --soft viewpunch
    126.  
    127. 				if (!CLIENT) then
    128.  
    129. 					local Ang = self.Owner:EyeAngles()
    130.  
    131. 					Ang.pitch = Ang.pitch - 5
    132.  
    133. 					self.Owner:SetEyeAngles( Ang ) --rough viewpunch
    134.  
    135. 				end
    136.  
    137. 		local trace={}
    138. 		trace.start=self.Owner:GetShootPos()
    139. 		trace.endpos=self.Owner:GetShootPos()+self.Owner:GetForward()*2000000000
    140. 		trace.filter=self.Owner
    141. 		local tracer = util.TraceLine( trace )
    142.  
    143. 		if tracer.Hit then
    144. 			local effect = EffectData()
    145. 			effect:SetEntity( self.Owner )
    146. 			effect:SetStart( self.Owner:GetShootPos() + self.Owner:GetRight())
    147. 			effect:SetAttachment( 1 )
    148. 			effect:SetOrigin( tracer.HitPos )
    149. 			effect:SetScale( 1.0 )
    150. 			effect:SetMagnitude( 3000 )
    151. 			util.Effect( "FBG-Beam", effect )
    152.          end                                                                                                                                                                
    153.  
    154.      end        local damage = ents.Create("point_hurt")
    155. 		damage:SetKeyValue("DamageRadius", 3000)
    156. 		damage:SetKeyValue("Damage" , 1000)
    157. 		damage:SetKeyValue("DamageDelay", 3)
    158. 		damage:SetKeyValue("DamageType" ,"67108864")
    159. 		damage:SetPos(tracer.HitPos)
    160. 		damage:Fire("TurnOn" , "", 0)
    161. 		damage:Fire("TurnOff" , "", 2)
    162. 		damage:Fire("kill","", 2)
    163.  
    164. 		local fx = EffectData()
    165. 		fx:SetOrigin(tracer.HitPos)
    166. 		fx:SetScale(0.5)
    167. 		util.Effect( "HelicopterMegaBomb", fx )
    168. 		local fx2 = EffectData()
    169. 		fx2:SetOrigin(tracer.HitPos)
    170. 		fx2:SetScale(0.1)
    171. 		util.Effect( "FBG-Explosion", fx2 )
    172.  
    173. 		util.BlastDamage(self.Owner,self.Owner,tracer.HitPos,128,self.Primary.Damage)
    174. 		local trace2={}
    175. 		trace2.start=tracer.HitPos + self.Owner:GetAimVector()*32
    176. 		trace2.endpos=tracer.HitPos + self.Owner:GetAimVector()*2000000000
    177. 		trace2.filter=trace.Entity
    178. 		local tracer2 = util.TraceLine( trace2 )
    179. 		util.BlastDamage(self.Owner,self.Owner,tracer2.HitPos,64,self.Primary.Damage)
    180. 		if tracer2.Hit then
    181. 		local fx3 = EffectData()
    182. 		fx3:SetOrigin(tracer2.HitPos)
    183. 		fx3:SetScale(0.5)
    184. 		util.Effect( "HelicopterMegaBomb", fx3 )
    185. 		local fx4 = EffectData()
    186. 		fx4:SetOrigin(tracer2.HitPos)
    187. 		fx4:SetScale(0.1)
    188. 		util.Effect( "FBG-Explosion", fx4 )
    189.  
    190. 		local trace3={}
    191. 		trace3.start=tracer2.HitPos + self.Owner:GetAimVector()*32
    192. 		trace3.endpos=tracer2.HitPos + self.Owner:GetAimVector()*2000000000
    193. 		trace3.filter=tracer2.Entity
    194. 		local tracer3 = util.TraceLine( trace3 )
    195. 		util.BlastDamage(self.Owner,self.Owner,tracer3.HitPos,64,self.Primary.Damage)
    196. 		if tracer3.Hit then
    197. 		local fx6 = EffectData()
    198. 		fx6:SetOrigin(tracer3.HitPos)
    199. 		fx6:SetScale(0.5)
    200. 		util.Effect( "HelicopterMegaBomb", fx6 )
    201. 		local fx7 = EffectData()
    202. 		fx7:SetOrigin(tracer3.HitPos)
    203. 		fx7:SetScale(0.1)
    204. 		util.Effect( "FBG-Explosion", fx7 )
    205.  
    206. 		local trace4={}
    207. 		trace4.start=tracer3.HitPos + self.Owner:GetAimVector()*32
    208. 		trace4.endpos=tracer3.HitPos + self.Owner:GetAimVector()*2000000000
    209. 		trace4.filter=tracer3.Entity
    210. 		local tracer4 = util.TraceLine( trace4 )
    211. 		if tracer4.Hit then
    212. 		util.BlastDamage(self.Owner,self.Owner,tracer4.HitPos,64,self.Primary.Damage)
    213.  
    214. 		local fx8 = EffectData()
    215. 		fx8:SetOrigin(tracer4.HitPos)
    216. 		fx8:SetScale(0.5)
    217. 		util.Effect( "HelicopterMegaBomb", fx8 )
    218. 		local fx9 = EffectData()
    219. 		fx9:SetOrigin(tracer4.HitPos)
    220. 		fx9:SetScale(0.1)
    221. 		util.Effect( "FBG-Explosion", fx9 )
    222.  
    223. 		local trace5={}
    224. 		trace5.start=tracer4.HitPos + self.Owner:GetAimVector()*32
    225. 		trace5.endpos=tracer4.HitPos + self.Owner:GetAimVector()*2000000000
    226. 		trace5.filter=tracer4.Entity
    227. 		local tracer5 = util.TraceLine( trace5 )
    228. 		if tracer5.Hit then
    229. 		util.BlastDamage(self.Owner,self.Owner,tracer5.HitPos,64,self.Primary.Damage)
    230.  
    231. 		local fx10 = EffectData()
    232. 		fx10:SetOrigin(tracer5.HitPos)
    233. 		fx10:SetScale(0.5)
    234. 		util.Effect( "HelicopterMegaBomb", fx10 )
    235. 		local fx11 = EffectData()
    236. 		fx11:SetOrigin(tracer5.HitPos)
    237. 		fx11:SetScale(0.1)
    238. 		util.Effect( "FBG-Explosion", fx11 )
    239.  
    240. 					end
    241. 				end
    242. 			end
    243. 		end
    244.  
    245. function SWEP:Think()
    246.  
    247. end
    Geändert von RP-01 (28.07.2008 um 17:34 Uhr)

Berechtigungen

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