File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed
Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ using CommandSystem ;
2+ using Exiled . API . Features ;
3+ using SillySCP . API . Features ;
4+
5+ namespace SillySCP . Commands
6+ {
7+ [ CommandHandler ( typeof ( ClientCommandHandler ) ) ]
8+ public class Damage : ICommand
9+ {
10+ public string Command { get ; } = "damage" ;
11+ public string [ ] Aliases { get ; } = new [ ] { "d" , "dmg" } ;
12+ public string Description { get ; } = "Get the amount of damage you've dealt." ;
13+
14+ public bool Execute (
15+ ArraySegment < string > arguments ,
16+ ICommandSender sender ,
17+ out string response
18+ )
19+ {
20+ Player . TryGet ( sender , out Player player ) ;
21+
22+ if ( player == null )
23+ {
24+ response = "Only players can use this command!" ;
25+ return false ;
26+ }
27+
28+ if ( player . DoNotTrack )
29+ {
30+ response =
31+ "You have do not track enabled, disable it so we can start tracking your damage!" ;
32+ return false ;
33+ }
34+
35+ if ( player . IsAlive )
36+ {
37+ response = "You must be dead to run this command!" ;
38+ return false ;
39+ }
40+
41+ PlayerStat playerStat = Plugin . Instance . PlayerStats . Find ( ( p ) => p . Player == player ) ;
42+ if ( playerStat == null )
43+ {
44+ response = "You have dealt 0 damage!" ;
45+ return true ;
46+ }
47+
48+ response = "You have dealt " + Math . Floor ( playerStat . Damage ?? 0 ) + " damage!" ;
49+ return true ;
50+ }
51+ }
52+ }
You can’t perform that action at this time.
0 commit comments