DeathRun Points for killing the death.

I have been trying to make some code for points every time you kill the death for my DeathRun server. I am using Pointshop by _Undefined and I know this can be done because I have seen it before. I am not any kind of lua expert but this is what I came up with.


function PlayerKill(victim, weapon, killer)
    if killer:Team() == Runner then
        killer:PS_GivePoints(10)
        killer:PS_Notify(" You have gained 10 points for killing " ..victim:GetName.. " !
 ")
    end
end
hook.add( "PlayerDeath", "playerDeathTest", PlayerKill)

I am putting this in my autorun folder for Pointshop. Please tell me if I am completely retarded and I don’t know what I’m doing because I really don’t.

This should go in the garrysmod/lua/autorun/server directory

killer:Team() doesn’t return a string ( Runner/Death ).

[lua]

local deathteamnumber = 1

local runnerteamnumber = 2

local function PlayerReward( victim, weapon, killer )

if victim:Team() == deathteamnumber and killer:Team() == runnerteamnumber then

     killer:SendLua( Notification.AddLegacy ( \"You have gained 10 points for killing \" .. victim:Nick() .. \"!\", NOTIFY_GENERIC, 4 ) )
     
     killer:PS_GivePoints( 10 )

end

end

hook.Add( “PlayerDeath”, “playerdeathtest”, PlayerReward )
[/lua]

That didn’t work. When I do ps_givepoints in console on the server it says that it isn’t a command. Can someone help me solve this?

I use this for my surf server, should work in deathrun aswel


local ulxGroupPoints = {}
ulxGroupPoints["admin"] = 20
ulxGroupPoints["donator"] = 25

hook.Add( "PlayerDeath", "KillPoints", function( victim, weapon, killer)
if IsValid( killer ) and IsValid( victim ) then
if killer:IsPlayer() and victim ~= killer then
local amount = ulxGroupPoints[ killer:GetNWString( "usergroup" ) ] or 15
killer:PS_GivePoints( amount );
killer:PS_Notify("Nice, you got a kill. + "..amount.." poins");
end;
end;
end )

You can edit the ulxgroups (if you have them) if they arent in the ulx group they will get 15 points per kill, editable

Put this in sv_pointshop.lua

I hope this works, is there a way to make it team specific?

That’s a problem with your pointshop then.

Do you know how to fix it?

ps_givepoints is not a command.

edit: Where did you put my script at? Any errors?

I put the script at, garrysmod/pointshop-master/lua/autorun. I don’t think there were any errors, just didn’t do anything when you kill someone.

PS_GivePoints is a command, however.

Oh I completely missed this post. I’ll try that.