• DeathRun Points for killing the death.
    11 replies, posted
[B]​[/B]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. [CODE]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.. " !\n ") end end hook.add( "PlayerDeath", "playerDeathTest", PlayerKill)[/CODE] 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]
[QUOTE=arcaneex;43095708]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][/QUOTE] 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 [CODE]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 )[/CODE] 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
[QUOTE=Rumblemore;43113022]I use this for my surf server, should work in deathrun aswel [CODE]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 )[/CODE] 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[/QUOTE] I hope this works, is there a way to make it team specific?
[QUOTE=Namdalaz;43104240]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?[/QUOTE] That's a problem with your pointshop then.
[QUOTE=code_gs;43117035]That's a problem with your pointshop then.[/QUOTE] Do you know how to fix it?
ps_givepoints is not a command. edit: Where did you put my script at? Any errors?
[QUOTE=arcaneex;43167354]ps_givepoints is not a command. edit: Where did you put my script at? Any errors?[/QUOTE] 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.
[QUOTE=Flavoured;43095213]This should go in the garrysmod/lua/autorun/server directory[/QUOTE] Oh I completely missed this post. I'll try that.
Sorry, you need to Log In to post a reply to this thread.