-- Ninja stuff by Gmod4ever-- We need SAYAPP!_OpenScript("library/sayapp.lua")Ninja = {}for i=1,_MaxPlayers() do Ninja[i] = {} Ninja[i].runs = 0; Ninja[i].RNI = 0; -- Run Next Interval Ninja[i].running = false; Ninja[i].wowing = false; Ninja[i].wowi = 0; Ninja[i].tbd = 0; Ninja[i].lastpos = nil; Ninja[i].lasthp = 0; Ninja[i].lastar = 0; Ninja[i].detection = 0; Ninja[i].box = nil; Ninja[i].br = nil; Ninja[i].hiding = false; Ninja[i].hide = 0; Ninja[i].realmass = 0; Ninja[i].jdDelay = 0; Ninja[i].bDelay = 0;end-- Debug functions by Gmod4everDEBUG = {}function DEBUG:TraceEffect(to,from,ent) _EffectInit(); _EffectSetEnt(ent); _EffectSetOrigin( from ); _EffectSetStart( to ); _EffectSetScale( 10 ); _EffectSetMagnitude( 10); _EffectDispatch( "FadingLine" );end-- Wall running by Gmod4everNinjaWR = true;NinjaWR_Value = 200; -- How much higher it "pushes" you a runNinjaWR_Dismount = NinjaWR_ValueNinjaWR_Runs = 10; -- How many times can you run before it pushes you off?NinjaWR_Key = IN_SPEED; -- key to initate wall run.NinjaWR_Interval = 0.2 -- Interval for each run.function Ninja.RunUpWall(i) if NinjaWR then if _PlayerIsKeyDown(i,NinjaWR_Key) then --_PrintMessage(1,2,"holding key") _TraceLine(_PlayerGetShootPos(i),_PlayerGetShootAng(i),40,i) if _TraceHitWorld() then --_PrintMessage(1,2,"trace hit") if Ninja[i].runs <= 10 then --_PrintMessage(1,2,"less than 10 runs") --_PrintMessage(1,2,_CurTime()) --_PrintMessage(1,2,Ninja[i].RNI) if _CurTime() >= Ninja[i].RNI then _EntSetVelocity(i,vector3(0,0,NinjaWR_Value)) Ninja[i].runs = Ninja[i].runs+1; Ninja[i].RNI = _CurTime()+NinjaWR_Interval; Ninja[i].running = true; end else Ninja.DismountWall(i) end end else if Ninja[i].running then Ninja[i].running = false; Ninja.DismountWall(i) end end endendfunction Ninja.DismountWall(i) if NinjaWR then Ninja[i].RNI = _CurTime()+5; -- So we can't run, drop, and run again. local ang = _PlayerGetShootAng(i) local ang = vecMul(ang,vector3(-1,-1,-1)) local force = vector3(NinjaWR_Dismount,NinjaWR_Dismount,NinjaWR_Dismount) local vel = vecMul(ang,force) --_phys.ApplyForceCenter(i,vel) _EntSetVelocity(i,vel) Ninja[i].runs = 0; endendfunction Ninja.RUWThink() if NinjaWR then for i=1,_MaxPlayers() do if IsPlayerOnline(i) then Ninja.RunUpWall(i) end end endendif NinjaRWT ~= nil then UnHookEvent(NinjaRWT)endNinjaRWT = AddThinkFunction(Ninja.RUWThink)-- Wall jumping by Gmod4everNinjaJW = trueNinjaJW_Value = 150;NinjaJW_Key = IN_JUMP;function Ninja.JumpWall(i) if NinjaJW then if _PlayerIsKeyDown(i,NinjaJW_Key) then _TraceLine(_PlayerGetShootPos(i),_PlayerGetShootAng(i),40,i) if _TraceHitWorld() then Ninja.DismountWall(i) end end endendfunction Ninja.WJThink() if NinjaJW then for i=1,_MaxPlayers() do if IsPlayerOnline(i) then Ninja.JumpWall(i) end end endendif NinjaWJT ~= nil then UnHookEvent(NinjaWJT)endNinjaWJT = AddThinkFunction(Ninja.WJThink)-- Walking on water by Gmod4everNinjaWOW = true;NinjaWOW_Value = 300;NinjaWOW_PushZone = 1; -- 1/4 under water pushNinjaWOW_Interval = 0.05;NinjaWOW_Mask = 16432; -- 16432 is a trace mask so it only hits water.NinjaWOW_Key = IN_SPEED;function Ninja.WalkOnWater(i) if NinjaWOW then if _PlayerIsKeyDown(i,NinjaWOW_Key) then _TraceSetMask(NinjaWOW_Mask) _TraceLine(_PlayerGetShootPos(i),vector3(0,0,-1),40,i) -- Trace straight down 40 units. --DEBUG:TraceEffect(_TraceEndPos(),_EntGetPos(i),i) if _TraceHit() then local up = vector3(1,1,NinjaWOW_Value) _EntSetVelocity(i,up) local forz = vector3(NinjaWOW_Value,NinjaWOW_Value,NinjaWOW_Value) local forz = vecMul(forz,_EntGetAng(i)) _EntSetVelocity(i,forz) Ninja[i].wowi = _CurTime()+NinjaWOW_Interval; end end endendfunction Ninja.WOWThink() for i=1,_MaxPlayers() do Ninja.WalkOnWater(i) endendif NinjaWOWT ~= nil then UnHookEvent(NinjaWOWT)endNinjaWOWT = AddThinkFunction(Ninja.WOWThink)-- Hide in a box; idea by Mitchell, script by Gmod4everNinjaHIB = trueNinjaHIB_Range = 300;NinjaHIB_MoveSpeed = 200;NinjaHIB_Time = 60;NinjaHIB_MakeAware = 100; -- Detection before the enemy knows you're there. :ONinjaHIB_Keys = {IN_USE,IN_RELOAD}NinjaHIB_Boxes = {"models/props_junk/wood_crate001a.mdl","models/props_junk/wood_crate002a.mdl","models/props_c17/oildrum001.mdl","models/props_borealis/bluebarrel001.mdl","models/props_wasteland/controlroom_filecabinet002a.mdl"}function holdingKeys(i,tbl) all = true; for k,v in tbl do -- If any of the keys in the table is false, this will return false. Will return true if ALL keys are being held. if not _PlayerIsKeyDown(i,v) then all = false; end end return all;endfunction Ninja.HIB(i) if NinjaHIB then local tbl = NinjaHIB_Keys if holdingKeys(i,tbl) then if not Ninja[i].hiding then _TraceLine(_PlayerGetShootPos(i),_PlayerGetShootAng(i),NinjaHIB_Range,i) if _TraceHitNonWorld() then ent = _TraceGetEnt() for k,v in NinjaHIB_Boxes do if _EntGetModel(ent) == v then Ninja[i].lastpos = _EntGetPos(i) Ninja[i].lasthp = _PlayerInfo(i,"health") Ninja[i].lastar = _PlayerInfo(i,"armor") _PlayerSpectatorStart(i,4) _PlayerSpectatorTarget(i,ent) Ninja[i].box = ent; Ninja[i].br = _CurTime()+NinjaHIB_Time; Ninja[i].hiding = true; Ninja[i].realmass = _phys.GetMass(ent) _phys.SetMass(ent,30) _PlayerRemoveAllWeapons(i) end end end end end endendfunction Ninja.BoxMovements(i) found = false; if Ninja[i].hiding then if _EntExists(Ninja[i].box) then for k,v in NinjaHIB_Boxes do found = true; if _EntGetModel(Ninja[i].box) == v then -- If our box's ID number is still a box. if _PlayerIsKeyDown(i,IN_FORWARD) then local ang = _PlayerGetShootAng(i) local force = vector3(NinjaHIB_MoveSpeed,NinjaHIB_MoveSpeed,NinjaHIB_MoveSpeed) local vel = vecMul(ang,force) _phys.ApplyForceCenter(Ninja[i].box,vel) end end end if not found then _EntSpawn(i) Ninja[i].box = nil; Ninja[i].hiding = false; end else _EntSpawn(i) Ninja[i].box = nil; Ninja[i].hiding = false; end endendfunction Ninja.BoxCommands(i,s) if string.find(s,"!release") then Ninja.RFB(i) return false; end return true;endSAY.Insert(Ninja.BoxCommands)function Ninja.RFB(i) if Ninja[i].hiding then if _EntExists(Ninja[i].box) then _PlayerSpectatorEnd(i) _EntSpawn(i) local box = Ninja[i].box _phys.SetMass(box,Ninja[i].realmass) local pos = vecAdd(_EntGetPos(box),vector3(0,0,40)) _EntSetPos(i,pos) _PlayerSetHealth(i,Ninja[i].lasthp) _PlayerSetArmor(i,Ninja[i].lastar) Ninja[i].hiding = false; Ninja[i].box = nil; else _EntSpawn(i) end endendfunction Ninja.HIBThink() for i=1,_MaxPlayers() do if IsPlayerOnline(i) then Ninja.HIB(i) Ninja.BoxMovements(i) if Ninja[i].hiding and _CurTime() >= Ninja[i].br then Ninja.RFB(i) end end endendif NinjaHIBT ~= nil then UnHookEvent(NinjaHIBT)endNinjaHIBT = AddThinkFunction(Ninja.HIBThink)--Dodge and Jump, By DaemonNinjaDJ = trueNinjaDJ_MoveSpeed = 800NinjaDJ_JumpSpeed = 600NinjaDJ_DKey = {IN_JUMP,IN_SPEED}NinjaDJ_JKey = {IN_JUMP,IN_DUCK}NinjaDJ_Delay = 5;function Ninja.Dodge(i) if holdingKeys(i,NinjaDJ_DKey) then if _CurTime() >= Ninja[i].jdDelay then local ang = _PlayerGetShootAng(i) local force = vector3(NinjaDJ_MoveSpeed,NinjaDJ_MoveSpeed,NinjaDJ_MoveSpeed) local vel = vecMul(ang,force) _EntSetVelocity(i,vel) Ninja[i].jdDelay = _CurTime()+NinjaDJ_Delay end endendfunction Ninja.Jump(i) if holdingKeys(i,NinjaDJ_JKey) then if _CurTime() >= Ninja[i].jdDelay then local force = vector3(0,0,NinjaDJ_JumpSpeed) _EntSetVelocity(i,force) Ninja[i].jdDelay = _CurTime()+NinjaDJ_Delay; end endendfunction Ninja.DJThink() for i=1,_MaxPlayers() do if IsPlayerOnline(i) then Ninja.Dodge(i) Ninja.Jump(i) end endendif NinjaDJT ~= nil then UnHookEvent(NinjaDJT)endNinjaDJT = AddThinkFunction(Ninja.DJThink)