• NPC Use help
    4 replies, posted
I need help getting use on NPCs to work, and yes I'm aware the tool spams, I'm going to fix that. But here's the code, and yes I've added the hook. [code] function checkSiding( ply, entity ) if(entity:GetNWString(master)!=ply and entity:GetNWString(master)==nil) then newMaster=ply entity:SetNWString(master, newMaster) end if(entity:GetNWString(master)==ply) then Msg("Check") end if(entity:GetNWString(master)!=nil) then Msg("No go") end end function checkZom( ply, entity ) if(entity:GetClass()=="npc_zombie" or entity:GetClass()=="npc_fastzombie") then if(entity:GetNWString(master)!=ply and entity:GetNWString(master)==nil) then newCom=ply entity:SetNWString(master, newCom) end if(entity:GetClass()!="npc_zombie" or entity:GetClass()!="npc_fastzombie") then Msg("Not a zombie...") end end end function armSurvivor( ply, entity ) armWeapon = ply:GetWeapon() ply:RemoveWeapon(armWeapon) entity:Give(armWeapon) end function interact( ply, entity ) if(entity:GetClass()=="npc_citizen" and ply:Team()!=2) then Msg("Failure") return true end if(entity:GetClass()=="npc_citizen" and ply:Team()==2) then checkSiding() armSurvivor() return true end if(entity:GetClass()!="npc_citizen" and ply:Team()==1) then checkZom() return true end end [/code]
I dont get what you are trying to do man. Why do you remove the players weapon, just to give it back? Those arent valid functions. Are you making an entity or a SNPC? [editline]05:12PM[/editline] [quote]yes I've added the hook. [/quote] What hook?
Hmmm... I'm trying to make it so that on PlayerUse gamemode hook, the player's weapon is taken away and the NPC gets it, and they are armed with it.
Nobody know the problem? Or not telling me? >_>
Was I missing a hook or do I need to put the vars in quotation marks? >_>
Sorry, you need to Log In to post a reply to this thread.