So basically i need a way for players to get points per kill, now i know that there is already a few of those out there but they are for Deathrun or TTT.
I'm looking for one that is for the base gamemode. for I run a surf server with just new gamemode based on base with surf name.
This is the deathrun one, I was wondering if anyone could help me turn this into normal points?
[CODE]local amount = 10;hook.Add( "PlayerDeath", "KillPoints", function( victim, weapon, killer)
if( IsValid( killer ) and IsValid( victim ) ) then
if( killer:IsPlayer() and victim:IsPlayer() ) then
if ( killer:Team() == TEAM_RUNNER and victim:Team() == TEAM_DEATH ) then
killer:PS_GivePoints( amount );
killer:PS_Notify("You've been given "..amount.." points for killing a death!");
elseif ( killer:Team() == TEAM_DEATH and victim:Team() == TEAM_RUNNER ) then
killer:PS_GivePoints( amount );
killer:PS_Notify("You've been given "..amount.." points for killing a runner!");
end;
end;
end;
end )[/CODE]
Change TEAM_RUNNER and TEAM_DEATH to the two teams that will be defined in your surf gamemode.
Yes, that would be an option if i could set teams, which ulx has somehow disabled.
-EDIT- It is free for all, meaning that there are no teams
Then set it so if they die by a player, the killer is credited with the points.
So it would look like this?
[CODE]local amount = 10;hook.Add( "PlayerDeath", "KillPoints", function( victim, weapon, killer)
if( IsValid( killer ) and IsValid( victim ) ) then
if( killer:IsPlayer() and victim:IsPlayer() ) then
killer:PS_GivePoints( amount );
killer:PS_Notify("Nice, you got a kill. + "..amount.." points");
end;
end;
end )[/CODE]
So that seems to work, but when a player uses the kill command in console and dies they get points aswel, help please?
[LUA]and victim ~= killer[/LUA]
Sorry, that did not work, do i paste it like this?
[CODE]local amount = 15;hook.Add( "PlayerDeath", "KillPoints", function( victim, weapon, killer)
if( IsValid( killer ) and IsValid( victim ) ) then
if( killer:IsPlayer() and victim ~= killer() ) then
killer:PS_GivePoints( amount );
killer:PS_Notify("Nice, you got a kill. + "..amount.." Rumps");
end;
end;
end )
[/CODE]
That gives me this error:
[ERROR] lua/sv_pointshop.lua:280: attempt to call local 'killer' (a userdata value)
You're calling killer as a function. It should just be killer, no ().
[QUOTE=Internet1001;42871395]You're calling killer as a function. It should just be killer, no ().[/QUOTE]
That did the job :D
Do you guys also happen to know how to make it so a certain ulx group gets more points per kill?
[LUA]
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.." Rumps");
end;
end;
end )
[/LUA]
should do
Thank you all, really helped me :D
Sorry, you need to Log In to post a reply to this thread.