Skip to content

Commit 96406ea

Browse files
author
Motive
committed
- Fixed a bug where the host would change whenever a non-admin player left.
1 parent 5832cc2 commit 96406ea

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Events/PlayerLeaves.galaxy

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ bool libcrtx_event_playerleaves(bool runConditions, bool runActions)
3131
}
3232
i += 1;
3333
}
34-
}
3534

36-
PlayerGroupRemove(actives, libcrtx_setting_getint(libcrtx_setting_int_smarthostile));
35+
PlayerGroupRemove(actives, libcrtx_setting_getint(libcrtx_setting_int_smarthostile));
3736

38-
// If we have no one left, exit now.
39-
if( PlayerGroupCount(actives) == 0 )
40-
{
37+
// If we have no one left, exit now.
38+
if( PlayerGroupCount(actives) == 0 )
39+
{
40+
return true;
41+
}
42+
43+
// Otherwise, just appoint someone randomly.
44+
i = PlayerGroupPlayer(actives, RandomInt(1, PlayerGroupCount(actives)));
45+
libcrtx_admin_setpermission(i, libcrtx_admin_permissionlevel_admin);
46+
libcrtx_write_text(PlayerGroupAll(), libcrtx_colored_player_name(i) + StringToText(" has been promoted to admin by ") + libcrtx_colored_player_name(EventPlayer()));
4147
return true;
4248
}
43-
44-
// Otherwise, just appoint someone randomly.
45-
i = PlayerGroupPlayer(actives, RandomInt(1, PlayerGroupCount(actives)));
46-
libcrtx_admin_setpermission(i, libcrtx_admin_permissionlevel_admin);
47-
libcrtx_write_text(PlayerGroupAll(), libcrtx_colored_player_name(i) + StringToText(" has been promoted to admin by ") + libcrtx_colored_player_name(EventPlayer()));
48-
return true;
4949
}

0 commit comments

Comments
 (0)