Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SM = {}
- function SM.CreateNPCs()
- local AmmoGuy = SM.CreateNPC('npc_combine_s', Vector(3422.0801, 10958.4746, -432.1877), Angle(0, -0.665, 0), (function(ply)
- local t = ply:Team()
- if t == TEAM_POLICE or t == TEAM_CHIEF or t == TEAM_MAGUARD then
- ply:GiveAmmo(30,'SMG1')
- ply:GiveAmmo(30,'Buckshot')
- ply:GiveAmmo(30,'Pistol')
- ply:ChatPrint("Chief Ben: Here is your ammo go patrol now!")
- else
- ply:ChatPrint("Chief Ben: You must be from the goverment to get ammo!")
- end
- return
- end), 'models/combine_soldier_prisonguard.mdl'); //
- local HelloGuy = SM.CreateNPC('npc_combine', Vector(3775.6563, 10634.0566, -429.9688), Angle(0, -90, 0), (function(ply)
- local t = ply:Team()
- if t == TEAM_POLICE or t == TEAM_CHIEF or t == TEAM_MAGUARD then
- ply:ChatPrint("Cop Bob: Shouldent you go patrol the city ?")
- else
- ply:ChatPrint("Cop Bob: Hello welcome to the city, enjoy your stay!")
- end
- return
- end), 'models/combine_soldier.mdl'); //
- end
- //////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////
- function SM.CreateNPC(class,pos,ang,msg,model)
- local NewNPC = ents.Create(class)
- NewNPC:SetModel(model)
- NewNPC:SetHullType( HULL_HUMAN )
- NewNPC:SetNPCState( NPC_STATE_SCRIPT )
- NewNPC.Umsg = msg
- NewNPC:SetPos(pos)
- NewNPC:SetAngles(ang)
- NewNPC:CapabilitiesAdd( CAP_ANIMATEDFACE | CAP_TURN_HEAD )
- NewNPC:SetSolid( SOLID_BBOX )
- NewNPC:Spawn()
- NewNPC:Activate()
- NewNPC:SetHealth(999999999)
- local bubble = ents.Create("prop_physics")
- bubble:SetModel("models/extras/info_speech.mdl")
- bubble:SetPos(pos + Vector(0,0,90))
- bubble:SetAngles(ang)
- bubble:Spawn()
- bubble:Activate()
- bubble:SetParent(NewNPC)
- bubble:SetCollisionGroup( COLLISION_GROUP_WORLD )
- end
- function SM.DoMapSetup ( )
- --RunConsoleCommand('ai_disabled 1')
- for k, v in pairs(ents.FindByClass('item_healthcharger')) do v:Remove(); end
- SM.CreateNPCs()
- end
- timer.Simple(5, SM.DoMapSetup);
- //////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////
- function PlayerUseNPC(ply,key)
- if !ply:IsValid() then return end
- if key != IN_USE then return end
- local ent = ply:GetEyeTrace().Entity
- if !ent.Umsg then return end
- if ent:GetPos():Distance(ply:GetPos()) > 80 then return end
- if type(ent.Umsg) == "function" then
- ent.Umsg(ply)
- return
- end
- umsg.Start(tostring(ent.Umsg),ply)
- umsg.End()
- end
- hook.Add( "KeyPress", "PlayerUseNPC", PlayerUseNPC )
- function ScaleDamage( npc, hitgroup, dmginfo )
- dmginfo:ScaleDamage( 0 )
- end
- hook.Add("ScaleNPCDamage","ScaleDamage",ScaleDamage)
- resource.AddFile("models/keycard/keycard.mdl")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement