Well, I'm making a head crab take over script, and I need to use a wildcard. However, it will not let me use it. Its actually looking for an NPC named npc_headcrab*.
Please help
The console:
[code]
Lua initialized (Lua 5.1)
Registering gamemode 'sandbox' derived from 'base'
ScriptEnforce is disabled
Executing listen server config file
exec: couldn't exec listenserver.cfg
InitFastCopy: only 51% fast props. Bug?
Lua initialized (Lua 5.1)
Registering gamemode 'sandbox' derived from 'base'
Sending 267 'User Info' ConVars to server (cl_spewuserinfoconvars to see)
Redownloading all lightmaps
NPC undone
NPC undone
NPC undone
[/code]The script:
[lua]
function Headcrab(target, inflictor)
if inflictor:GetClass() == "npc_headcrab*" and target:IsPlayer() then
local a = {}
a["npc_headcrab"] = "npc_zombie"
a["npc_headcrab_fast"] = "npc_fastzombie"
a["npc_headcrab_black"] = "npc_poisonzombie"
local zombie = ents.Create(a[inflictor:GetClass()])
zombie:SetPos(target:GetPos())
zombie:SetHealth(200)
zombie:Spawn()
zombie:SetAngles(target:GetAngles())
target:Spectate(OBS_MODE_CHASE)
target:SpectateEntity(zombie)
target:KillSilent()
end
end
hook.Add("EntityTakeDamage", "23924812", Headcrab)
[/lua]
Also setangles doesn't work
Use [b][url=http://wiki.garrysmod.com/?title=String.find]String.find [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] on inflictor:GetClass().
On the server,
[code]if inflictor:IsNPC( ) and inflictor:Classify( ) == CLASS_HEADCRAB then[/code]
[b][url=http://wiki.garrysmod.com/?title=NPC.Classify]NPC.Classify [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Sorry, you need to Log In to post a reply to this thread.