• I can't get animations to work for my weapon, help!
    2 replies, posted
Hello, I have been doing a recode of regen script, with animations! But I cannot get the animations to work, any ideas? I want to get my player when using the weapon to go in to T-Pose since that is the closest thing to regeneration sound = "sound/ryanm2711/regen.wav" lastregen = male regenerated = true local new_health = 5000 SWEP.PrintName = "Regeneration SWEP" SWEP.Author = "Ryanm2711" SWEP.Instructions = "Press Left Click to Regenerate!" SWEP.Spawnable = true SWEP.AdminOnly = true SWEP.Category = "Doctor Who" SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "none" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.Weight = 0 SWEP.AutoSwitchTo = true SWEP.AutoSwitchFrom = false SWEP.Slot = 1 SWEP.SlotPos = 2 SWEP.DrawAmmo = false SWEP.DrawCrosshair = false male = {} male[1]="models/joshers/badasses/playermodels/barney.mdl" male[2]="models/joshers/badasses/playermodels/breen.mdl" male[3]="models/joshers/badasses/playermodels/eli.mdl" male[4]="models/joshers/badasses/playermodels/grigori.mdl" male[6]="models/joshers/badasses/playermodels/magnusson.mdl" male[7]="models/joshers/badasses/playermodels/kleiner.mdl" function SWEP:Deploy() self.Owner:DrawViewModel(false); end function SWEP:DrawWorldModel() return false; end function SWEP:PrimaryAttack() regenerated = false self.Owner:GodEnable() self.Owner:SetAnimation(507) self.Owner:Freeze(true) self.Weapon:EmitSound( sound ) timer.Simple(3, function() local model = table.Random(male) self.Owner:SetModel( model ) self.Owner:SetModelName( model ) timer.Simple(3, function() self.Owner:Freeze(false) self.Owner:SetAnimation(507) self.Owner:SetHealth(new_health) lastregen = male regenerated = true timer.Simple(5, function() self.Owner:GodDisable() end) end) end) end Here is regen.lua (serverside) function hurt( ply, a, health ) if (health < 11) and (ply:IsAdmin() or ply:IsSuperAdmin()) then regenerated = false ply:SetAnimation(507) ply:Freeze(true) timer.Simple(3, function() local model = table.Random(lastregen) ply:SetModel( model ) ply:SetModelName( model ) timer.Simple(3, function() ply:Freeze(false) ply:SetAnimation(507) ply:SetHealth(5000) ply:ChatPrint( "your player model is now: " .. model ) ply:GodEnable() regenerated = true timer.Simple(30, function() ply:GodDisable() end) end) end) end end hook.Add( "GM:PlayerHurt", "playerhurt", hurt ) function Death(ply) print("a player died") timer.simple(10,function() if (regenerated == false) then ply:SetMaterial( "" ) ply:Freeze( false ) ply:GodDisable() end end) end hook.Add( "GM:PlayerDeath", "death", death )
Don’t put GM in your hook names, let’s start there.
You can bump your old thread. Your code looks like you just put some words here and there, and then just "oh, I can go on facepunch and ask for a spoon" (because you don't understand really basic things, it seems like you can't recode anything, so it won't be your recode) https://www.lua.org/start.html Beginner Tutorial Intro
Sorry, you need to Log In to post a reply to this thread.