Hello i know you guys hate perp but i really want to launch it for my own use and to learn from it...
Heres the error i get :
[IMG]http://up402.siz.co.il/up3/4nyt3gmzwy2u.png[/IMG]
Heres the code of sv_npc_control:
[CODE]function GM.CreateNPC (Location, Angles, OnUse, Model )
for k, v in pairs(ents.FindInSphere(Location, 64)) do
if v:GetModel() == Model then
return false;
end
end
local NewNPC = ents.Create("npc_vendor");
NewNPC:SetPos(Location);
NewNPC:SetAngles(Angles);
NewNPC:Spawn();
NewNPC:GetTable().OnUse = OnUse;
NewNPC:SetModel(Model);
NewNPC:SetHealth(999999999)
NewNPC:MakeChatBubble()
if OnUse == "police_hire" then
local sequence = NewNPC:LookupSequence("idle_subtle")
NewNPC:InitializeAnimation(sequence);
else
NewNPC:InitializeAnimation(8);
end
return NewNPC;
end
function GM:KeyPress ( Player, Key )
if Key == IN_USE then
local TTable = {}
TTable.start = Player:GetShootPos();
TTable.endpos = TTable.start + Player:GetAimVector() * 100;
TTable.filter = Player;
TTable.mask = MASK_OPAQUE_AND_NPCS;
local Tr = util.TraceLine(TTable);
if Tr.Entity and Tr.Entity:IsValid() and Tr.Entity:GetClass() == "npc_vendor" and Tr.Entity.OnUse then
umsg.Start('perp_talk', Player);
umsg.String(Tr.Entity.OnUse);
umsg.End();
end
end
end
function GM:ScaleNPCDamage ( NPC, HitGroup, DmgInfo )
DmgInfo:ScaleDamage(0);
return;
end
function GM.RemoveZombies ( )
for k, v in pairs(ents.FindByClass('npc_*')) do
if v and v:IsValid() and v:IsNPC() then
if v:GetClass() != 'npc_vendor' and v:GetClass() != 'npc_kleiner' then
v:Remove();
else
for l, prop in pairs(ents.FindInSphere(v:GetPos(), 64)) do
if prop and prop:IsValid() and !prop:IsNPC() and !prop:IsPlayer() and prop:GetClass() == 'ent_item_prop' then
if prop:GetTable().ItemSpawner and prop:GetTable().ItemSpawner:IsValid() and prop:GetTable().ItemSpawner:IsPlayer() then
prop:GetTable().ItemSpawner:Notify('Do not try to kill the NPCs.');
end
prop:GetTable().ItemSpawner:GetTable().NumProps = prop:GetTable().ItemSpawner:GetTable().NumProps - 1
prop:Remove();
end
end
end
end
end
end
//hook.Add('Think', 'GM.RemoveZombies', GM.RemoveZombies);
function GM:OnNPCKilled ( NPC, Player, Weapon )
if NPC:GetPos() == Vector(-5356, -10252, 135) then
end
if !RestartGoing then
RestartGoing = true;
PrintMessageAll('Map restart in 20 minutes.');
timer.Simple(60 * 5, function() PrintMessageAll('Map restart in 15 minutes.') end);
timer.Simple(60 * 10, function() PrintMessageAll('Map restart in 10 minutes.') end);
timer.Simple(60 * 15, function() PrintMessageAll('Map restart in 5 minutes.') end);
timer.Simple(60 * 16, function() PrintMessageAll('Map restart in 4 minutes.') end);
timer.Simple(60 * 17, function() PrintMessageAll('Map restart in 3 minutes.') end);
timer.Simple(60 * 18, function() PrintMessageAll('Map restart in 2 minutes.') end);
timer.Simple(60 * 19, function() PrintMessageAll('Map restart in 1 minute.') end);
timer.Simple(60 * 19 + 30, function() PrintMessageAll('Map restart in 30 seconds.') end);
timer.Simple(60 * 19 + 45, function() PrintMessageAll('Map restart in 15 seconds.') end);
timer.Simple(60 * 19 + 50, function() PrintMessageAll('Map restart in 10 seconds.') end);
for i = 1, 8 do
timer.Simple(60 * 19 + 50 + i, function() PrintMessageAll('Map restart in ' .. 10 - i .. ' seconds.') end);
end
timer.Simple(60 * 19 + 59, function() PrintMessageAll('Map restart in 1 second.') end);
timer.Simple(60 * 20, function() RunConsoleCommand('changelevel', game.GetMap()) end);
end
if !Player or !Player:IsValid() or !Player:IsPlayer() then
if Weapon:GetTable().Owner and Weapon:GetTable().Owner:IsValid() and Weapon:GetTable().Owner:IsPlayer() then
sourcebans.BanPlayer(Weapon:GetTable().Owner, 60*60, "Killing NPCs");
elseif Weapon:GetTable().ItemSpawner and Weapon:GetTable().ItemSpawner:IsValid() and Weapon:GetTable().ItemSpawner:IsPlayer() then
sourcebans.BanPlayer(Weapon:GetTable().ItemSpawner, 60*60, "Killing NPCs")
end
return false;
end
sourcebans.BanPlayer(Player, 60*60, "Killing NPCs")
end [/CODE]
Thank you very much for helpers !
Either the entity doesn't exists or the entity is making errors on spawn and therefore won't be a valid entity.
ents.Create("npc_vendor");
Looks like npc_vendor doesn't exist.
so what should i do to fix it ? to add the command you gave me ?
no, add the npc that's missing
Bump +
What are you bumping for? You have been given the answer already - Make sure npc_vendor entity exists.
Sorry, you need to Log In to post a reply to this thread.