Fix Player Limit Settings and Hide Server Only Chat Commands (#114)
This commit is contained in:
parent
f5e245590f
commit
df57dddbea
|
@ -408,11 +408,6 @@ function on_update()
|
|||
end
|
||||
|
||||
function on_gamemode_command(msg)
|
||||
if not network_is_server() then
|
||||
djui_chat_message_create('Only the server can change this setting!')
|
||||
return true
|
||||
end
|
||||
|
||||
local setMode = nil
|
||||
|
||||
for i, gm in ipairs(gGameModes) do
|
||||
|
@ -455,4 +450,6 @@ for i, gm in ipairs(gGameModes) do
|
|||
sGameModeShortTimes = sGameModeShortTimes .. gm.shortName
|
||||
end
|
||||
|
||||
hook_chat_command('arena-gamemode', string.format("[%s|random] sets gamemode", sGameModeShortTimes), on_gamemode_command)
|
||||
if network_is_server() then
|
||||
hook_chat_command('arena-gamemode', string.format("[%s|random] sets gamemode", sGameModeShortTimes), on_gamemode_command)
|
||||
end
|
||||
|
|
|
@ -1153,10 +1153,6 @@ function on_hud_render()
|
|||
end
|
||||
|
||||
function on_football_reset_command(msg)
|
||||
if not network_is_server() then
|
||||
djui_chat_message_create('Only the server can change this setting!')
|
||||
return true
|
||||
end
|
||||
if msg == 'ball' then
|
||||
djui_chat_message_create('Resetting the ball.')
|
||||
sSoccerBall = spawn_or_move_ball(sBallSpawnPos.x, sBallSpawnPos.y, sBallSpawnPos.z)
|
||||
|
@ -1311,7 +1307,9 @@ hook_event(HOOK_UPDATE, update)
|
|||
hook_event(HOOK_ON_HUD_RENDER, on_hud_render)
|
||||
hook_event(HOOK_ON_PLAYER_CONNECTED, on_player_connected)
|
||||
hook_event(HOOK_ALLOW_PVP_ATTACK, allow_pvp_attack)
|
||||
hook_chat_command('football-reset', "[game|ball] resets the game or ball", on_football_reset_command)
|
||||
if network_is_server() then
|
||||
hook_chat_command('football-reset', "[game|ball] resets the game or ball", on_football_reset_command)
|
||||
end
|
||||
|
||||
for i=0,(MAX_PLAYERS-1) do
|
||||
local s = gPlayerSyncTable[i]
|
||||
|
|
|
@ -428,10 +428,6 @@ function on_hud_render()
|
|||
end
|
||||
|
||||
function on_hide_and_seek_command(msg)
|
||||
if not network_is_server() then
|
||||
djui_chat_message_create('Only the server can change this setting!')
|
||||
return true
|
||||
end
|
||||
if msg == 'on' then
|
||||
djui_chat_message_create('Hide-and-seek mod: enabled')
|
||||
gGlobalSyncTable.hideAndSeek = true
|
||||
|
@ -452,10 +448,6 @@ function on_hide_and_seek_command(msg)
|
|||
end
|
||||
|
||||
function on_anti_camp_command(msg)
|
||||
if not network_is_server() then
|
||||
djui_chat_message_create('Only the server can change this setting!')
|
||||
return true
|
||||
end
|
||||
if msg == 'on' then
|
||||
djui_chat_message_create('Anti-camping timer: enabled')
|
||||
gGlobalSyncTable.campingTimer = true
|
||||
|
@ -469,10 +461,6 @@ function on_anti_camp_command(msg)
|
|||
end
|
||||
|
||||
function on_touch_tag_command(msg)
|
||||
if not network_is_server() then
|
||||
djui_chat_message_create('Only the server can change this setting!')
|
||||
return true
|
||||
end
|
||||
if msg == 'on' then
|
||||
djui_chat_message_create('Touch tag: enabled')
|
||||
gGlobalSyncTable.touchTag = true
|
||||
|
@ -486,10 +474,6 @@ function on_touch_tag_command(msg)
|
|||
end
|
||||
|
||||
function on_koopa_shell_command(msg)
|
||||
if not network_is_server() then
|
||||
djui_chat_message_create('Only the server can change this setting!')
|
||||
return true
|
||||
end
|
||||
if msg == 'on' then
|
||||
djui_chat_message_create('Koopa Shell: enabled')
|
||||
gGlobalSyncTable.banKoopaShell = false
|
||||
|
@ -503,10 +487,6 @@ function on_koopa_shell_command(msg)
|
|||
end
|
||||
|
||||
function on_hider_cap_command(msg)
|
||||
if not network_is_server() then
|
||||
djui_chat_message_create('Only the server can change this setting!')
|
||||
return true
|
||||
end
|
||||
if msg == 'on' then
|
||||
djui_chat_message_create('Hider Caps: enabled')
|
||||
gGlobalSyncTable.hiderCaps = false
|
||||
|
@ -520,10 +500,6 @@ function on_hider_cap_command(msg)
|
|||
end
|
||||
|
||||
function on_seeker_cap_command(msg)
|
||||
if not network_is_server() then
|
||||
djui_chat_message_create('Only the server can change this setting!')
|
||||
return true
|
||||
end
|
||||
if msg == 'on' then
|
||||
djui_chat_message_create('Seeker Caps: enabled')
|
||||
gGlobalSyncTable.seekerCaps = false
|
||||
|
@ -649,12 +625,14 @@ hook_event(HOOK_ALLOW_PVP_ATTACK, allow_pvp_attack)
|
|||
hook_event(HOOK_ON_INTERACT, on_interact)
|
||||
hook_event(HOOK_ALLOW_INTERACT, allow_interact)
|
||||
|
||||
hook_chat_command('hide-and-seek', "[on|off] turn hide-and-seek on or off", on_hide_and_seek_command)
|
||||
hook_chat_command('touch-to-tag', "[on|off] turn touch tag on or off", on_touch_tag_command)
|
||||
hook_chat_command('hiders-caps', "[on|off] turn caps for hiders on or off", on_hider_cap_command)
|
||||
hook_chat_command('seekers-caps', "[on|off] turn caps for seekers on or off", on_seeker_cap_command)
|
||||
hook_chat_command('anti-camp', "[on|off] turn the anti-camp timer on or off", on_anti_camp_command)
|
||||
hook_chat_command('koopa-shell', "[on|off] Turn the koopa shell on or off", on_koopa_shell_command)
|
||||
if network_is_server() then
|
||||
hook_chat_command('hide-and-seek', "[on|off] turn hide-and-seek on or off", on_hide_and_seek_command)
|
||||
hook_chat_command('touch-to-tag', "[on|off] turn touch tag on or off", on_touch_tag_command)
|
||||
hook_chat_command('hiders-caps', "[on|off] turn caps for hiders on or off", on_hider_cap_command)
|
||||
hook_chat_command('seekers-caps', "[on|off] turn caps for seekers on or off", on_seeker_cap_command)
|
||||
hook_chat_command('anti-camp', "[on|off] turn the anti-camp timer on or off", on_anti_camp_command)
|
||||
hook_chat_command('koopa-shell', "[on|off] Turn the koopa shell on or off", on_koopa_shell_command)
|
||||
end
|
||||
|
||||
-- call functions when certain sync table values change
|
||||
hook_on_sync_table_change(gGlobalSyncTable, 'roundState', 0, on_round_state_changed)
|
||||
|
|
|
@ -87,10 +87,6 @@ function mario_update_local(m)
|
|||
end
|
||||
|
||||
function on_speed_command(msg)
|
||||
if not network_is_server() then
|
||||
djui_chat_message_create('Only the server can change this setting!')
|
||||
return true
|
||||
end
|
||||
if tonumber(msg) > 0 then
|
||||
gGlobalSyncTable.speed = tonumber(msg)
|
||||
return true
|
||||
|
@ -138,4 +134,6 @@ hook_event(HOOK_UPDATE, on_update)
|
|||
hook_event(HOOK_MARIO_UPDATE, mario_update)
|
||||
hook_event(HOOK_ALLOW_PVP_ATTACK, allow_pvp_attack)
|
||||
hook_event(HOOK_ON_PAUSE_EXIT, on_pause_exit)
|
||||
hook_chat_command('speed', "[decimal number, default: 0.8]", on_speed_command)
|
||||
if network_is_server() then
|
||||
hook_chat_command('speed', "[decimal number, default: 0.8]", on_speed_command)
|
||||
end
|
||||
|
|
|
@ -227,6 +227,8 @@ function on_game_state_changed(tag, oldVal, newVal)
|
|||
end
|
||||
end
|
||||
|
||||
hook_chat_command('race', "[CG|SL|BOB]", on_race_command)
|
||||
hook_chat_command('laps', "[number]", on_laps_command)
|
||||
if network_is_server() then
|
||||
hook_chat_command('race', "[CG|SL|BOB]", on_race_command)
|
||||
hook_chat_command('laps', "[number]", on_laps_command)
|
||||
end
|
||||
hook_on_sync_table_change(gGlobalSyncTable, 'gameState', i, on_game_state_changed)
|
||||
|
|
|
@ -51,7 +51,7 @@ static void djui_panel_host_do_host(struct DjuiBase* caller) {
|
|||
}
|
||||
|
||||
// Doesn't let you host if the player limit is not good
|
||||
if (configAmountofPlayers < 2 || configAmountofPlayers > 16) {
|
||||
if (configAmountofPlayers < 2 || configAmountofPlayers > MAX_PLAYERS) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ static bool djui_panel_host_limit_valid(void) {
|
|||
limit += (*buffer - '0');
|
||||
buffer++;
|
||||
}
|
||||
return limit >= 2 && limit <= 16;
|
||||
return limit >= 2 && limit <= MAX_PLAYERS;
|
||||
}
|
||||
|
||||
static void djui_panel_host_player_text_change(struct DjuiBase* caller) {
|
||||
|
|
Loading…
Reference in New Issue