• Simple kill an NPC and get points issue :V
    3 replies, posted
Hey guys I am trying to make it so when you kill an npc you get 10 pointshop points using the latest version of pointshop. However, I cannot find the right 'thing' to use to actually add the points.. Also I get an error saying it cannot add points when an npc kills a player, so I also need help defining the actual player. Sorry for dumbness still learning A LOT EVERY DAY :3 [CODE] hook.Add("PlayerDeath", "PointShopPoints", function(ply, wep, killer) if ply != killer and ply:IsPlayer() then killer:PS_SetPoints( 5 ) killer:PS_Notify("+10 pointshop points") end end) [/CODE]
Pretty sure the thing you're looking for is Player:PS_GivePoints(points) so i.e. ply:PS_GivePoints(10) and also PlayerDeath only runs for players, I believe you're looking for [URL="http://wiki.garrysmod.com/page/GM/OnNPCKilled"]OnNPCKilled[/URL] [DEL]Hold up nvm I misunderstood. You should read up on this [url]http://wiki.garrysmod.com/page/GM/PlayerDeath[/url][/DEL] I take my original strikethrough back, I was so fucking confused.
Wait, you want an NPC to kill a player and get points? but how does an npc get points? NPCs can't buy stuff out of the pointshop lol
You could just use [url]http://wiki.garrysmod.com/page/GM/OnNPCKilled[/url] Then check if second argument is a player, if it is then give them points with: Player:PS_GivePoints(10)
Sorry, you need to Log In to post a reply to this thread.