• pointshop 2 npc kill script support
    4 replies, posted
Hello, let me start by saying I am very new to lua. I really just want to get this working for my server so I hope someone out there can help me. Thanks in advance for any and all inputs / help. I am running the gamemode nZombies which is based off of sandbox. I want to have my players gain 1 point anytime they kill 1 zombie. zombie npc's class is nz_zombie_walker and pointshop 2 uses this to give points: PLAYER:PS2_AddStandardPoints(1, Zombie Kill) I've been messing with this (messed up because I'm new) script trying to get this all to work: [CODE]function GM:OnNPCKilled( victim, PLAYER, weapon ) if ( victim:GetClass() == "nz_zombie_walker" ) then PLAYER:PS2_AddStandardPoints(1, Zombie Kill) else end end hook.Add("OnNPCKilled", "GivePoints", OnNPCKilled)[/CODE] Thanks again for any help :) PS: I dont care if the script effects the npc class stated or all NPCs. If anyone has a more simple code to give points for any npc kills that would be awesome!
PLAYER:PS2_AddStandardPoints(1, Zombie Kill) to PLAYER:PS2_AddStandardPoints(1, "Zombie Kill") also, you dont need that else.
Thanks! It still does not work but that helps a lot. I think the problem is that the NPC class is specific. How can I make it so just killing any npc will trigger the command to pay out a point? Updated code: [CODE]function GM:OnNPCKilled( victim, PLAYER, weapon ) if ( victim:GetClass() == "nz_zombie_walker" ) then PLAYER:PS2_AddStandardPoints(1, "Zombie Kill") end hook.Add("OnNPCKilled", "GivePoints", OnNPCKilled) [/CODE]
You need to end the function.
Thanks, I did end the function but I still need to make it effect all NPCs because it wont work. [editline]8th April 2017[/editline] Does anyone have any code that will allow a player to get points for kill ANY npc?
Sorry, you need to Log In to post a reply to this thread.