Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: KoloS on July 02, 2014, 03:55:29 am

Title: Weapons Stats
Post by: KoloS on July 02, 2014, 03:55:29 am
Script Name: Weapons Stats
Script Description:
Commands: !wepstats or !wepstats <ID>
Config: open script and edit:
Code: [Select]
const
savetype    = 2;    //1 = HWID, 2 = Name
PublicDis   = 2;    //1 = Public Display Stats 2 = Private Display Stats
(http://i62.tinypic.com/2z7kher.gif)
Original Author(s): KoloS
Core Version: 2.7.7
Code:
Code: [Select]
function OnPlayerDamageEx(Victim,Killer: Byte; Damage: Integer; Weapon: Byte): Integer;
begin
if (GetPlayerStat(killer, 'Active') = true) and not (killer = Victim) and not (GetPlayerStat(killer,'team') = GetPlayerStat(Victim,'team')) then begin
case (Weapon) of
0: PlayerStats[killer].pistolH := inttostr(strtoint(PlayerStats[killer].pistolH) + 1);
1: PlayerStats[killer].deagleHit := inttostr(strtoint(PlayerStats[killer].deagleHit) + 1);
2: PlayerStats[killer].hkH := inttostr(strtoint(PlayerStats[killer].hkH) + 1);
3: PlayerStats[killer].akH := inttostr(strtoint(PlayerStats[killer].akH) + 1);
4: PlayerStats[killer].augH := inttostr(strtoint(PlayerStats[killer].augH) + 1);
5: PlayerStats[killer].spasH := inttostr(strtoint(PlayerStats[killer].spasH) + 1);
6: PlayerStats[killer].rugerH := inttostr(strtoint(PlayerStats[killer].rugerH) + 1);
8: PlayerStats[killer].barrettH := inttostr(strtoint(PlayerStats[killer].barrettH) + 1);
9: PlayerStats[killer].minimiH := inttostr(strtoint(PlayerStats[killer].minimiH) + 1);
10: PlayerStats[killer].minigunH := inttostr(strtoint(PlayerStats[killer].minigunH) + 1);
14: PlayerStats[killer].knifeH := inttostr(strtoint(PlayerStats[killer].knifeH) + 1);
15: PlayerStats[killer].sawH := inttostr(strtoint(PlayerStats[killer].sawH) + 1);
end;
if (Weapon = 16) and (Damage >= 25) then PlayerStats[killer].lawH := inttostr(strtoint(PlayerStats[killer].lawH) + 1);
if (Weapon = 7) and (Damage >= 40) then PlayerStats[killer].m79H := inttostr(strtoint(PlayerStats[killer].m79H) + 1);
end;
Result:=damage;
end;
Changes in  1.0.1:
- Change: OnPlayerDamageEx vice OnPlayerDamage
- Change: Use case () of
- Improved: Accuracy for m79 and law
Download:
Code: [Select]
   ||
   ||
  \||/
   \/
Title: Re: Weapons Stats
Post by: kicikici on July 02, 2014, 07:52:55 am
very very very "useful" script, nice dominik!

EDIT:
did you ever hear about case-of statement?
Title: Re: Weapons Stats
Post by: KoloS on July 04, 2014, 11:37:55 am
Small update(1.0.1) at suggestion kicikici.
Title: Re: Weapons Stats
Post by: DarkCrusade on July 04, 2014, 12:15:47 pm
Or you create an array for the weapons (0 to 16) and get rid of that wall of code........
Title: Re: Weapons Stats
Post by: kicikici on July 04, 2014, 12:20:47 pm
Ye, he did this in his second script, I dont know why he changed his mind here.
Title: Re: Weapons Stats
Post by: DarkCrusade on July 04, 2014, 12:51:16 pm
My first guess is that it depends on where he copies the code from. :P
Title: Re: Weapons Stats
Post by: darDar on July 04, 2014, 01:52:41 pm
Accuracy stats are quite pointless since 30% of all shots are either spray shots or blind shots or for other purposes ( boosting, boosting the flag or kits)