• Ragdolls and vehicles: JumpOut
    7 replies, posted
[lua] local RagdollDamage = 0 -------------MALE SOUNDS local Die1 = Sound("vo/npc/male01/startle01.wav") local Die2 = Sound("vo/npc/male01/startle02.wav") local Pain1 = Sound("vo/npc/male01/imhurt01.wav") local Pain2 = Sound("vo/npc/male01/imhurt02.wav") local Pain3 = Sound("vo/npc/male01/pain01.wav") local Pain4 = Sound("vo/npc/male01/pain02.wav") local Pain5 = Sound("vo/npc/male01/pain03.wav") local Pain6 = Sound("vo/npc/male01/pain04.wav") local Pain7 = Sound("vo/npc/male01/pain05.wav") local Pain8 = Sound("vo/npc/male01/pain06.wav") local Pain9 = Sound("vo/npc/male01/pain07.wav") local Pain10 = Sound("vo/npc/male01/pain08.wav") local Pain11 = Sound("vo/npc/male01/pain09.wav") local Freefall1 = Sound("vo/npc/male01/no02.wav") local Freefall2 = Sound("vo/npc/male01/no01.wav") local Freefall3 = Sound("vo/npc/male01/help01.wav") local Freefall4 = Sound("vo/npc/male01/watchout.wav") local Freefall5 = Sound("vo/npc/male01/uhoh.wav") ----------------------------------FEMALE SOUNDS local FDie1 = Sound("vo/npc/female01/startle01.wav") local FDie2 = Sound("vo/npc/female01/startle02.wav") local FPain1 = Sound("vo/npc/female01/imhurt01.wav") local FPain2 = Sound("vo/npc/female01/imhurt02.wav") local FPain3 = Sound("vo/npc/female01/pain01.wav") local FPain4 = Sound("vo/npc/female01/pain02.wav") local Aaah = Sound("Bail/aaah.mp3") local FPain5 = Sound("vo/npc/female01/pain03.wav") local FPain6 = Sound("vo/npc/female01/pain04.wav") local FPain7 = Sound("vo/npc/female01/pain05.wav") local FPain8 = Sound("vo/npc/female01/pain06.wav") local FPain9 = Sound("vo/npc/female01/pain07.wav") local FPain10 = Sound("vo/npc/female01/pain08.wav") local FPain11 = Sound("vo/npc/female01/pain09.wav") local FFreefall1 = Sound("vo/npc/female01/no02.wav") local FFreefall2 = Sound("vo/npc/female01/no01.wav") local FFreefall3 = Sound("vo/npc/female01/help01.wav") local FFreefall4 = Sound("vo/npc/female01/watchout.wav") local FFreefall5 = Sound("vo/npc/female01/uhoh.wav") ---ConsoleCommand ---Disable Ragdoll Damage if(SERVER)then function ARRDisableRagdollDamage(player,command,args) if player:IsPlayer() then if player:IsAdmin() or player:IsSuperAdmin( ) then RagdollDamage = RagdollDamage + 1 if RagdollDamage > 1 then RagdollDamage = 0 end if RagdollDamage == 0 then Msg("Ragdoll Damage Enabled \n") end if RagdollDamage == 1 then Msg("Ragdoll Damage Disabled \n") end end end if not(player:IsPlayer()) then Msg("!!!Something that wasn't a player executed the WindShieldCannon command!!! \n") Msg("|||It could be CONSOLE or if you are unlucky a player hacking the server||| \n") RagdollDamage = RagdollDamage + 1 if RagdollDamage > 1 then RagdollDamage = 0 end if RagdollDamage == 0 then Msg("Ragdoll Damage Enabled \n") end if RagdollDamage == 1 then Msg("Ragdoll Damage Disabled \n") end end end concommand.Add("RagdollDamage",ARRDisableRagdollDamage) end ------------------------------------- local function RanSound(ply, SNDtype) local Male = true if string.find(ply:GetModel(), "alyx.mdl") or string.find(ply:GetModel(), "mossman.mdl") or string.find(ply:GetModel(), "female_01.mdl") or string.find(ply:GetModel(), "female_02.mdl") or string.find(ply:GetModel(), "female_03.mdl") or string.find(ply:GetModel(), "female_04.mdl") or string.find(ply:GetModel(), "female_05.mdl") or string.find(ply:GetModel(), "female_06.mdl") or string.find(ply:GetModel(), "female_07.mdl") then Male = false end if (SERVER) then if Male == true then if SNDtype == 1 then local RanSound = math.random(3,11) if RanSound == 1 then ply:EmitSound(Pain1) end if RanSound == 2 then ply:EmitSound(Pain2) end if RanSound == 3 then ply:EmitSound(Pain3) end if RanSound == 4 then ply:EmitSound(Pain4) end if RanSound == 5 then ply:EmitSound(Pain5) end if RanSound == 6 then ply:EmitSound(Pain6) end if RanSound == 7 then ply:EmitSound(Pain7) end if RanSound == 8 then ply:EmitSound(Pain8) end if RanSound == 9 then ply:EmitSound(Pain9) end if RanSound == 6 then ply:EmitSound(Pain10) end if RanSound == 6 then ply:EmitSound(Pain11) end end if SNDtype == 2 then local RanSound = math.random(1,5) if RanSound == 1 then ply:EmitSound(Freefall1) end if RanSound == 2 then ply:EmitSound(Freefall2) end if RanSound == 3 then ply:EmitSound(Freefall3) end if RanSound == 4 then ply:EmitSound(Freefall4) end if RanSound == 5 then ply:EmitSound(Freefall3) end end if SNDtype == 3 then local RanSound = math.random(1,2) if RanSound == 1 then ply:EmitSound(Die1) end if RanSound == 2 then ply:EmitSound(Die2) end end end if Male == false then if SNDtype == 1 then local RanSound = math.random(3,11) if RanSound == 1 then ply:EmitSound(FPain1) end if RanSound == 2 then ply:EmitSound(FPain2) end if RanSound == 3 then ply:EmitSound(FPain3) end if RanSound == 4 then ply:EmitSound(FPain4) end if RanSound == 5 then ply:EmitSound(FPain5) end if RanSound == 6 then ply:EmitSound(FPain6) end if RanSound == 7 then ply:EmitSound(FPain7) end if RanSound == 8 then ply:EmitSound(FPain8) end if RanSound == 9 then ply:EmitSound(FPain9) end if RanSound == 6 then ply:EmitSound(FPain10) end if RanSound == 6 then ply:EmitSound(FPain11) end end if SNDtype == 2 then local RanSound = math.random(1,5) if RanSound == 1 then ply:EmitSound(FFreefall1) end if RanSound == 2 then ply:EmitSound(FFreefall2) end if RanSound == 3 then ply:EmitSound(FFreefall3) end if RanSound == 4 then ply:EmitSound(FFreefall4) end if RanSound == 5 then ply:EmitSound(FFreefall3) end end if SNDtype == 3 then local RanSound = math.random(1,2) if RanSound == 1 then ply:EmitSound(FDie1) end if RanSound == 2 then ply:EmitSound(FDie2) end end end end end --------------------------------Main Code hook.Add("PlayerLeaveVehicle","ARRThrowOut", function(ply,ent) local Dont = ent:GetNetworkedBool( "ARRDontThrowOut" ) local WinRag = ent:GetNetworkedBool( "ARRWinThrowOut") if Dont == true then ent:SetNetworkedBool( "ARRDontThrowOut", false ) --Creating a ragdoll local ragdoll = ents.Create( "prop_ragdoll" ) if WinRag ~= true then ragdoll:SetPos( ply:GetPos() + Vector(0,0,50) ) ragdoll:SetModel( ply:GetModel() ) ragdoll:SetAngles(Angle((ply:GetAngles().p+90), (ply:GetAngles().y-90), ply:GetAngles().r+90)) ragdoll:Spawn() end local Speed = 0 local Veh = ply.ARRveh if WinRag == true then ent:SetNetworkedBool( "ARRWinThrowOut", false) local VehPos = (((Veh:GetForward()) * 30) + ((Veh:GetUp()) * 60)) + Veh:GetPos() Speed = ent:GetNetworkedInt("ARRLaunchSpeed") Speed = Speed * (Veh:GetForward()) ragdoll:SetPos( VehPos ) ragdoll:SetModel( ply:GetModel() ) ragdoll:SetAngles(Angle((ply:GetAngles().p+90), (ply:GetAngles().y-90), ply:GetAngles().r+90)) ragdoll:Spawn() end --Moving some bones so it won't look like a mingebag local bones =
You should try ask the maker himself. his name is Sakarias. He should help you better than any one else.
Wow, that is some really bad coding, the lack of tables saddens me.
Yeah, you could've really shortened it down with tables.
Yeah I totally could becaue I'm so good with lua... :v:
Let's do something like this for example: (This is only possible because you named it so nicely :p) Your code: [lua] if SNDtype == 1 then local RanSound = math.random(3,11) if RanSound == 1 then ply:EmitSound(Pain1) end if RanSound == 2 then ply:EmitSound(Pain2) end if RanSound == 3 then ply:EmitSound(Pain3) end if RanSound == 4 then ply:EmitSound(Pain4) end if RanSound == 5 then ply:EmitSound(Pain5) end if RanSound == 6 then ply:EmitSound(Pain6) end if RanSound == 7 then ply:EmitSound(Pain7) end if RanSound == 8 then ply:EmitSound(Pain8) end if RanSound == 9 then ply:EmitSound(Pain9) end if RanSound == 6 then ply:EmitSound(Pain10) end if RanSound == 6 then ply:EmitSound(Pain11) end end [/lua] My help: (:D) [lua] if SNDType == 1 then ply:EmitSound(Pain..math.random(3,11)) end [/lua] I win :D Do that for all the other stuff and see how much nicer that looks, as for your actual problem, I have no idea. :O, so for that I apologize.
I have no idea what the heck you did, I'm not familiar with lua and it is not my code.
ah, nevermind then. I made it shorter though... Basically it creates a random number and put's it like this: ply:EmitSound(Pain#)
Sorry, you need to Log In to post a reply to this thread.