Author Topic: Accuracy Script for Knife Only v1.3  (Read 10707 times)

0 Members and 1 Guest are viewing this topic.

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Accuracy Script for Knife Only v1.3
« on: June 18, 2010, 12:33:27 pm »
Name: Accuracy Script for Knife Only

Author: Mighty
Script version: 1.3
Server version: 2.6.5
Release Date: 18th of June 2010
Last Update: 6th of July 2010
Compile Test: Passed
Description:
Script for Knife Only Servers made by Mighty.
Script counts Hits made by knives (both stabbs and throws) and Knife Throws.
Basing on these, returns Accuracy after typing !stats
Also in the end of map it shows best and worst accuracy.
Commands:
    *  !stats   - shows players accuracy
    *  !stats x - shows accuracy of player x (ID)
    *  !stats abc - shows accuracy of player whos name contains abc (min 3 characters)
Requirements:
    *  All weapons except knives disabled
    *  Damage dealt by fist must not be modified

Version 1.3 Changelog:
    *  All bugs fixed
    *  Script executes when map changes any way (vote/scorelimit/timelimit)

Version 1.2 Changelog:
    *  Bug with worst accuracy not showing -> fixed
    *  Added showing accuracy to every player (when the map ends)

Version 1.1 Changelog:
    * changed maxplayers to 32
    * added procedures instead of writing all in defaults
    * added some comments
    * made it look a bit clearer i guess
    * deleted inttofloat
    * specs can now see accuracy also
    * Added procedure that allows to check any players accuracy. Check Commands.

---

Download attached!
---
Code: {snippets}
Code: [Select]
(...)
procedure OnPlayerSpeak(ID: byte; Text: string);
begin

if (Copy(Text,1,6)='!stats') then
begin

if (Text='!stats') then
begin
NeededID := ID;
FoundID := TRUE;
end
else FindID(Copy(Text,8,Length(Text)));

IF (FoundID = TRUE) AND (GetPlayerStat(NeededID,'name') <> '')  then
begin
// if player hasnt made throws yet, write it
if (AccThrows[NeededID] = 0) then WriteConsole(0,IDToName(NeededID)+' hasn`t made any throws yet',Color)
else
// else get his accuracy and return it
begin
Acc[NeededID] := RoundTo((AccHits[NeededID])/(AccThrows[NeededID]),4) * 100;
WriteConsole(0,IDToName(NeededID)+'`s Accuracy is ' + floattostr(Acc[NeededID]) + '%   ('+inttostr(AccHits[NeededID])+'/'+inttostr(AccThrows[NeededID])+')',Color);
end;
end
else WriteConsole(0,'Match Not Found.',Color);

end;

end;
(...)

Questions? Bugs? Report please --> macekmil@gmail.com
« Last Edit: July 06, 2010, 03:19:11 pm by Mighty »
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
Re: Accuracy Script for Knife Only
« Reply #1 on: June 19, 2010, 02:26:44 am »
Your integer<>float conversations aren't nice at all. Why didn't you set max players to 32? Also why can't spectators can see their stats (maybe they were playing before switching to spec)? Also it's a common bad practice to write all the code inside standard event procedures. It would be much better if you wrote properly named procedures with all your code and then called them from event procedures. Otherwise it's very hard to get what does every nameless cycle do and you'll forget it all in a week...
« Last Edit: June 19, 2010, 02:35:28 am by VirtualTT »

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Re: Accuracy Script for Knife Only
« Reply #2 on: June 19, 2010, 02:40:32 am »
Thanks for advices, that's my 1st release, still need to learn alot :)

Quote
Why didn't you set max players to 32?
Hell good question :P
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Accuracy Script for Knife Only
« Reply #3 on: June 19, 2010, 03:22:44 am »
Yeah, just make it an array of 0..32
Second thing, you don't need IntToFloat anywhere, just use integers, it doesn't matter.
At least, use types when you already got that much vars, it makes the script look nicer ;p
And try to find your indenting style, you're sometimes putting spaces, another time TAB's and then none.

Gj tho, go on with such stuff  ;)

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Re: Accuracy Script for Knife Only v1.1
« Reply #4 on: June 19, 2010, 04:29:24 am »

UPDATE TO 1.1
 
  • changed maxplayers to 32
  • added procedures instead of writing all in defaults
  • added some comments
  • made it look a bit clearer i guess
  • deleted inttofloat
  • specs can now see accuracy also
  • Added procedure that allows to check any players accuracy. Check Commands.
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

Offline Irlandec

  • Soldier
  • **
  • Posts: 176
Re: Accuracy Script for Knife Only v1.1
« Reply #5 on: June 19, 2010, 06:12:11 am »
Nice script , hope it will become the best for knife only servers! :)

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Re: Accuracy Script for Knife Only v1.1
« Reply #6 on: July 03, 2010, 05:25:44 pm »
Update!

Attached new version and changelog to the 1st post

[1.42 pm 4th July] Edit: Fixed some minor bugs also
« Last Edit: July 04, 2010, 01:42:49 pm by Mighty »
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Re: Accuracy Script for Knife Only v1.3
« Reply #7 on: July 06, 2010, 12:16:53 pm »
Update to 1.3

Download
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

Offline Beowulf Agate

  • Major
  • *
  • Posts: 73
Re: Accuracy Script for Knife Only v1.3
« Reply #8 on: September 29, 2010, 02:42:10 pm »
How about adding average length of the player's throws to the script? Spawnkillers will be marked then.

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Re: Accuracy Script for Knife Only v1.3
« Reply #9 on: September 30, 2010, 03:46:35 am »
Not a big deal, I'll do that when i have some free time.
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

Offline Beowulf Agate

  • Major
  • *
  • Posts: 73
Re: Accuracy Script for Knife Only v1.3
« Reply #10 on: January 05, 2015, 03:02:23 pm »
Yo Mighty  8) U still scriptin' ? It would be awesome to have this script fixed and working with current version.

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Re: Accuracy Script for Knife Only v1.3
« Reply #11 on: January 07, 2015, 04:04:07 am »
Hey Beo! :>
I plan to rewrite most of the utility scripts I've made so they work with most recent versions, however, I'm currently pretty busy working so it may take some time :) That's going to be the first one though, if you need it.
Glad to see you still hosting, too. (I assume, why would you need KO scripts otherwise)
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID