0 Members and 1 Guest are viewing this topic.
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;
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.
Quote from: iDante on August 24, 2008, 10:54:17 pmSometimes 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)
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?)
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 carrierprocedure 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;
My new password is secure as shit Mate, I am not sure Shit is even secured nowadays.