Skip to content

Commit

Permalink
Merge pull request #1 from Conkley/main
Browse files Browse the repository at this point in the history
Code Rewrite - mafk.gsc
  • Loading branch information
garryspins authored Jun 18, 2023
2 parents 78bd437 + 12be081 commit e0edbfc
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions mafk.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
mafk_max_end [bool = 0] - End the game if everyone is either down or afk?
mafk_cooldown [float = 15] - How many minutes should you have to wait before using afk again.
Conkley has edited this to replace createServerFontString with client sided font string instead.
*/

#include maps\mp\_utility;
Expand Down Expand Up @@ -307,6 +309,7 @@ hook_chat(text, mode) {
switch (split[1]) {
case "off":
self tell(level.mafk_name + " You're back!");
say(level.mafk_name + " " + self.name + " has returned from being AFK!");
self set_afk(false);
self notify("afkcancel");
break;
Expand Down Expand Up @@ -344,6 +347,7 @@ hook_chat(text, mode) {
switch (split[1]) {
case "off":
self tell(level.mafk_name + " You're back!");
say(level.mafk_name + " " + self.name + " has returned from being AFK!");
self set_afk(false);
self notify("afkcancel");
break;
Expand All @@ -369,11 +373,12 @@ hook_chat(text, mode) {

// runs on the player to check if he should still be afk or not
check_afk_player(endtime) {
// These 3 endon's were moved here for better coding practices
self endon("disconnect");
self endon("afkcancel");
level endon("end_game");

for (;;) {
self endon("disconnect");
self endon("afkcancel");
level endon("game_ended");

time = getTime();

if (time >= endtime) {
Expand All @@ -395,12 +400,12 @@ afk_player_hud(endtime, time) {
return;
}

level endon("game_ended");
level endon("end_game");
self endon("disconnect");

self.mafk_hud = createServerFontString("objective", 2);
self.mafk_hud = createFontString("objective", 2);
self.mafk_hud setPoint("CENTER", "TOP", 0, 0);
self.mafk_hud setText("You are currently afk");
self.mafk_hud setText("You are currently afk!");

self.mafk_hud.hideWhenInMenu = 1;

Expand All @@ -415,4 +420,4 @@ afk_player_hud(endtime, time) {

wait 0.50;
}
}
}

0 comments on commit e0edbfc

Please sign in to comment.