I downloaded player factions from gmod.org and it doesn't seem to work. iv done everything i could think of trying to fix it. i know its a pretty simple lua code but .... im pretty simple when it comes working with lua.
Any help would be great
here is the lua code that i have
This is the original code before my tampering
[lua]
function DoRespawn(ply)
ply:SetVar("faction",nil)
end
hook.Add("PlayerSpawn","nhmSpawnHook",DoRespawn)
function DoMove(ply,move)
if ply:GetVar("faction") == nil then
mdl = string.sub(ply:GetModel(),15,-5)
local fact = ""
if mdl=="police" || mdl == "combine_soldier" || mdl == "combine_soldier_prisonguard" || mdl == "combine_super_soldier" || mdl == "breen" then
fact = "f_combine"
elseif mdl == "alyx" || mdl == "barney" || mdl == "eli" || mdl == "female_04" || mdl == "female_06" || mdl == "female_07" || mdl == "gman_high" || mdl == "Kleiner" || mdl == "male_02" || mdl == "male_03" || mdl == "male_08" || mdl == "monk" || mdl == "mossman" || mdl == "odessa" then
fact = "f_human"
elseif mdl == "corpse1" || mdl == "charple01" || mdl == "classic" then
fact = "f_zombie"
end
ply:SetVar("faction",fact)
ply:SetName(fact)
end
end
hook.Add("SetupMove","nhmMoveHook",DoMove)
function SpawnedNPC(ply,npc)
cl = npc:GetClass()
if cl == "npc_metropolice" || cl == "npc_mortarsynth" || cl == "npc_turret_ceiling" || cl == "npc_stalker" || cl == "npc_combine_camera" || cl == "monster_apc" || cl == "npc_sniper" || cl == "npc_combinedropship" || cl == "combine_mine" || cl == "npc_combine_s" || cl == "npc_manhack" || cl == "npc_helicopter" || cl == "npc_scanner" || cl == "combine_mine" || cl == "npc_combinegunship" || cl == "npc_combinedropship" || cl == "npc_strider" || cl == "npc_rollermine" || cl == "npc_cscanner" || cl == "npc_turret_floor" || cl == "npc_hunter" then
npc:Fire("setrelationship","f_human d_ht 99",0)
npc:Fire("setrelationship","f_zombie d_ht 98",0)
npc:Fire("setrelationship","f_combine d_li 97",0)
elseif cl == "npc_alyx" || cl == "npc_kleiner" || cl == "npc_eli" || cl == "npc_barney" || cl == "npc_citizen" || cl == "npc_mossman" || cl == "npc_monk" || cl == "npc_vortiguant" || cl == "npc_dog" then
npc:Fire("setrelationship","f_combine d_ht 99",0)
npc:Fire("setrelationship","f_zombie d_ht 98",0)
npc:Fire("setrelationship","f_human d_li 97",0)
elseif cl == "npc_zombie" || cl == "npc_fastzombie" || cl == "npc_poisonzombie" || cl == "npc_zombie_torso" || cl == "npc_fastzombie_torso" || cl == "npc_headcrab" || cl == "npc_headcrab_fast" || cl == "npc_headcrab_black" then
npc:Fire("setrelationship","f_combine d_ht 99",0)
npc:Fire("setrelationship","f_human d_ht 98",0)
npc:Fire("setrelationship","f_zombie d_ht 97",0)
end
end
hook.Add("PlayerSpawnedNPC","nhmNPCHook",SpawnedNPC)
[/lua]
honestly all i want out of it is the zombie faction. i tried cutting the code back some and and changing a few ?functions? (not really sure what the proper name is) but to no avail. i think i looked up every function in this lua code and made sure it was correct.
What do you mean by "zombie faction"? Also, use Lua Tags.
[QUOTE=Swat player;28355820]What do you mean by "zombie faction"? Also, use Lua Tags.[/QUOTE]
the lua file basically makes factions based on player models. combine wont shoot combine models, zombies wont attack zombie models, rebels wont attack rebel models
all i want is the zombie part of that. i wont be using other npcs so the rest of that code is useless to me
and how do i use lua tags?
[lua]function DoRespawn(ply)
ply:SetVar("faction",nil)
end
hook.Add("PlayerSpawn","nhmSpawnHook",DoRespawn)
function DoMove(ply,move)
if ply:GetVar("faction") == nil then
mdl = string.sub(ply:GetModel(),15,-5)
local fact = ""
if mdl=="police" || mdl == "combine_soldier" || mdl == "combine_soldier_prisonguard" || mdl == "combine_super_soldier" || mdl == "breen" then
fact = "f_combine"
elseif mdl == "alyx" || mdl == "barney" || mdl == "eli" || mdl == "female_04" || mdl == "female_06" || mdl == "female_07" || mdl == "gman_high" || mdl == "Kleiner" || mdl == "male_02" || mdl == "male_03" || mdl == "male_08" || mdl == "monk" || mdl == "mossman" || mdl == "odessa" then
fact = "f_human"
elseif mdl == "corpse1" || mdl == "charple01" || mdl == "classic" then
fact = "f_zombie"
end
ply:SetVar("faction",fact)
ply:SetName(fact)
end
end
hook.Add("SetupMove","nhmMoveHook",DoMove)
function SpawnedNPC(ply,npc)
cl = npc:GetClass()
if cl == "npc_zombie" || cl == "npc_fastzombie" || cl == "npc_poisonzombie" || cl == "npc_zombie_torso" || cl == "npc_fastzombie_torso" || cl == "npc_headcrab" || cl == "npc_headcrab_fast" || cl == "npc_headcrab_black" then
npc:Fire("setrelationship","f_combine d_ht 99",0)
npc:Fire("setrelationship","f_human d_ht 98",0)
npc:Fire("setrelationship","f_zombie d_ht 97",0)
end
end
hook.Add("PlayerSpawnedNPC","nhmNPCHook",SpawnedNPC)[/lua]
Is this what you want?
[QUOTE=jeff223;28356565][lua]function SpawnedNPC(ply,npc)
cl = npc:GetClass()
if cl == "npc_zombie" || cl == "npc_fastzombie" || cl == "npc_poisonzombie" || cl == "npc_zombie_torso" || cl == "npc_fastzombie_torso" || cl == "npc_headcrab" || cl == "npc_headcrab_fast" || cl == "npc_headcrab_black" then
npc:Fire("setrelationship","f_combine d_ht 99",0)
npc:Fire("setrelationship","f_human d_ht 98",0)
npc:Fire("setrelationship","f_zombie d_ht 97",0)
end
end
hook.Add("PlayerSpawnedNPC","nhmNPCHook",SpawnedNPC)[/lua] Is this what you want?[/QUOTE]
yes but it has to be able to get the player factions based on the player models
Edited my previous post.
[QUOTE=jeff223;28356735]Edited my previous post.[/QUOTE]
thats exactly how mine looked when i got finished with it. only problem is. it appears to do nothing
[editline]1st March 2011[/editline]
elseif mdl == "corpse1" || mdl == "charple01" || mdl == "classic" then
fact = "f_zombie"
i think thats the problem XD while im in game. it looks like im not even using those models ....
ok so here is what i want. (gmod wont start up for me atm..... cant wait till i get my new vid card..(frickin back order)) i own a dark rp zombie server. i want to make it so that there is a "zombie" job. it will have only a zombie pill as a weapon. would the pill make the player automatically friendly to the npcs? or would i need a faction script?
Sorry, you need to Log In to post a reply to this thread.