Skip to content

Commit af21c2d

Browse files
Update CoinThrow.cs
1 parent dae144a commit af21c2d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

CoinThrow.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private void AddOrUpdateCoinThrowInDatabase(string playerSteamID, string playerN
108108
});
109109
}
110110
}
111-
[ConsoleCommand("css_hodmincou", "Throw a coin with the result being heads or tails")]
111+
[ConsoleCommand("css_cointhrow", "Throw a coin with the result being heads or tails")]
112112
public void OnCoinThrowCommand(CCSPlayerController? player, CommandInfo command)
113113
{
114114
if (player != null && player.PlayerPawn.Value != null)
@@ -118,13 +118,16 @@ public void OnCoinThrowCommand(CCSPlayerController? player, CommandInfo command)
118118
player.PrintToChat($"You can throw the coin only once every {ChatColors.DarkRed}10 {ChatColors.Default}seconds!");
119119
return;
120120
}
121-
121+
122122
Random random = new Random();
123123
bool coinResult = random.Next(2) == 0;
124+
124125
string resultString = coinResult ? "Heads" : "Tails";
125-
Server.PrintToChatAll($"The player {ChatColors.Green}{player.PlayerName}{ChatColors.Default} threw the coin and the result is {ChatColors.Green}{resultString}{ChatColors.Default}.");
126-
UpdateLastCoinThrowTime(player.SteamID.ToString());
126+
Server.PrintToChatAll($"Player {ChatColors.Green}{player.PlayerName}{ChatColors.Default} threw the coin and the result is {ChatColors.Green}{resultString}{ChatColors.Default}.");
127127
AddOrUpdateCoinThrowInDatabase(player.SteamID.ToString(), player.PlayerName);
128+
int totalThrows = GetPlayerThrows(player.SteamID.ToString());
129+
Server.PrintToChatAll($"His total number of throws is {ChatColors.Green}{totalThrows}x{ChatColors.Default}.");
130+
UpdateLastCoinThrowTime(player.SteamID.ToString());
128131
}
129132
}
130133
}

0 commit comments

Comments
 (0)