Author Topic: Kill Fairness  (Read 2375 times)

0 Members and 1 Guest are viewing this topic.

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5037
Kill Fairness
« on: August 22, 2008, 02:30:08 pm »
Script Name: Kill Fairness
Script Description: Whenever a flag carrier suicides, dock their points. If a flag carrier kills the other flag carrier, boost his/her points. If a non-flagger kills a flagger, increase his/her points.
Original Author(s): jrgp
Core Version: v2.2
Code:
Code: [Select]
const
DeathPoints = 3; //points to deduct if a flag carrier suicides
NormalKillPoints = 3; //points to give if a random dude kills flag carrier
UberKillPoints = 5; //points to give if a flag carrier kills another flag carrier

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
var current, KillerCurrent, DyerCurrent: integer;
begin
//if neither killer or victim have flag, exit
if not GetPlayerStat(Victim, 'Flagger') and not GetPlayerStat(Killer, 'Flagger') then
exit;

//their current points
KillerCurrent := GetPlayerStat(Killer, 'Kills');
DyerCurrent := GetPlayerStat(Victim, 'Kills');

//if flag carrier suicides, dock their points for messing up
if Killer = Victim and GetPlayerStat(Killer, 'Flagger') then
begin
SetScore(Killer, KillerCurrent - DeathPoints);
exit;
end;

//if flag carrier kills flag carrier, boost their points
if GetPlayerStat(Victim, 'Flagger') and GetPlayerStat(Killer, 'Flagger') then
begin
SetScore(Killer, KillerCurrent + UberKillPoints);
exit;
end;

//random dude kills flag carrier, increase their points
SetScore(Killer, KillerCurrent + NormalKillPoints);
end;
There are other worlds than these

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Kill Fairness
« Reply #1 on: August 24, 2008, 10:54:17 pm »
Sometimes when I know that there is noone near my base and I have flag and am weak and with no hp kits, I suicide on my spawn and grab the flag when I respawn... It would suck to lose points to that.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Kill Fairness
« Reply #2 on: August 25, 2008, 01:34:56 pm »
Sometimes when I know that there is noone near my base and I have flag and am weak and with no hp kits, I suicide on my spawn and grab the flag when I respawn... It would suck to lose points to that.
drop the flag b4 u die (throw it)

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Kill Fairness
« Reply #3 on: August 25, 2008, 02:21:11 pm »
Sometimes when I know that there is noone near my base and I have flag and am weak and with no hp kits, I suicide on my spawn and grab the flag when I respawn... It would suck to lose points to that.
drop the flag b4 u die (throw it)
Good point.

I dunno about performance or anything, but I think its a lot easier to read the program if you use if/else's instead of exits, though your commenting makes it pretty easy.

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5037
Re: Kill Fairness
« Reply #4 on: August 25, 2008, 04:55:00 pm »
I dunno about performance or anything, but I think its a lot easier to read the program if you use if/else's instead of exits, though your commenting makes it pretty easy.

Yeah..my opinion on having a bunch of nested if-then,else's is that it makes the code messy and annoying to read. I use this same coding style my php scripts. But you know that already, don't you? I think it was you I gave/showed the TMS' source code to (Or was it IQ-U?)
There are other worlds than these

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Kill Fairness
« Reply #5 on: August 25, 2008, 05:25:12 pm »
Yeah..my opinion on having a bunch of nested if-then,else's is that it makes the code messy and annoying to read. I use this same coding style my php scripts. But you know that already, don't you? I think it was you I gave/showed the TMS' source code to (Or was it IQ-U?)
You offered to show me it but... I wasn't too interested (as long as it works, which it does). IQ saw it I think...

I'll show you how much nicer it can be with some nice if/else's, give me a minute.
Edit Here j00 goes:
Code: [Select]
const
DeathPoints = 3; //points to deduct if a flag carrier suicides
NormalKillPoints = 3; //points to give if a flag carrier kills another flag carrier
UberKillPoints = 5; //points to give if a random dude kills flag carrier

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
if GetPlayerStat(Killer, 'Flagger') then begin
//if flag carrier suicides, dock their points for messing up
if Killer = Victim then begin
SetScore(Killer, GetPlayerStat(Killer,'kills') - DeathPoints);

//if flag carrier kills flag carrier, boost their points
end else if GetPlayerStat(Victim, 'Flagger') then
SetScore(Killer, GetPlayerStat(Killer,'kills') + UberKillPoints);

end else if GetPlayerStat(Victim, 'flagger') then
//random dude kills flag carrier, increase their points
SetScore(Killer, GetPlayerStat(Killer,'kills') + NormalKillPoints);
end;
« Last Edit: August 25, 2008, 05:50:06 pm by iDante »

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
Re: Kill Fairness
« Reply #6 on: August 27, 2008, 09:29:10 pm »
Btw that was me jrgp that you showed the source to. I still have it on my laptop.

Offline miketh2005

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 668
  • What's the URL for www.microsoft.com?
Re: Kill Fairness
« Reply #7 on: September 13, 2008, 11:55:19 am »
Suggestion: If the flag gets returned withen 10 secs you get an extra 3 points, if you killed the flagger also.
Quote from: 'Ando.' pid='12999178' dateline='1309046898'
My new password is secure as shit :)
Mate, I am not sure Shit is even secured nowadays.

Offline Horve

  • Flagrunner
  • ****
  • Posts: 692
  • Vig
Re: Kill Fairness
« Reply #8 on: September 14, 2008, 11:47:17 am »
make points based on hp, killing a flagger who has low health would give less points than a fully healed etc.
(or based on inflicted damage)