mirror of
https://github.com/a-bad-dev/simple-shooter-game.git
synced 2026-06-09 20:36:15 +00:00
Small update
This commit is contained in:
parent
1a3bd02bad
commit
33b2ecff14
1 changed files with 27 additions and 2 deletions
|
|
@ -124,8 +124,6 @@ function set_player_mode(player, mode)
|
||||||
listring[current_player;main]
|
listring[current_player;main]
|
||||||
]])
|
]])
|
||||||
|
|
||||||
give_player_items(player)
|
|
||||||
|
|
||||||
player:hud_set_flags({
|
player:hud_set_flags({
|
||||||
hotbar = true,
|
hotbar = true,
|
||||||
healthbar = false,
|
healthbar = false,
|
||||||
|
|
@ -149,6 +147,7 @@ function start_match()
|
||||||
|
|
||||||
for _, player in pairs(core.get_connected_players()) do
|
for _, player in pairs(core.get_connected_players()) do
|
||||||
set_player_mode(player, "pre_match")
|
set_player_mode(player, "pre_match")
|
||||||
|
give_player_items(player)
|
||||||
|
|
||||||
player:set_pos({x = map_data.spawn_x, y = map_data.spawn_y, z = map_data.spawn_z})
|
player:set_pos({x = map_data.spawn_x, y = map_data.spawn_y, z = map_data.spawn_z})
|
||||||
|
|
||||||
|
|
@ -188,6 +187,10 @@ function start_match()
|
||||||
end
|
end
|
||||||
|
|
||||||
function end_match()
|
function end_match()
|
||||||
|
if match_state == "pre_match" or match_state == "not_started" or match_state == "post_match" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
set_match_state("not_started")
|
set_match_state("not_started")
|
||||||
|
|
||||||
for _, player in pairs(core.get_connected_players()) do
|
for _, player in pairs(core.get_connected_players()) do
|
||||||
|
|
@ -206,6 +209,8 @@ function end_match()
|
||||||
|
|
||||||
set_player_mode(player, "normal")
|
set_player_mode(player, "normal")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function set_match_state(state)
|
function set_match_state(state)
|
||||||
|
|
@ -285,6 +290,10 @@ core.register_on_joinplayer(function(player)
|
||||||
]])
|
]])
|
||||||
player:set_properties({pointable = false})
|
player:set_properties({pointable = false})
|
||||||
|
|
||||||
|
if player:get_meta():get_string("class") == "" then
|
||||||
|
player:get_meta():set_string("class", "assault")
|
||||||
|
end
|
||||||
|
|
||||||
set_player_mode(player, "normal")
|
set_player_mode(player, "normal")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
@ -373,4 +382,20 @@ core.register_chatcommand("start", {
|
||||||
start_match()
|
start_match()
|
||||||
return true, "-!- Match started!"
|
return true, "-!- Match started!"
|
||||||
end
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_chatcommand("reset", {
|
||||||
|
params = "",
|
||||||
|
privs = {match_manager = true},
|
||||||
|
description = "Terminate the match",
|
||||||
|
func = function()
|
||||||
|
local success = end_match()
|
||||||
|
if success then
|
||||||
|
core.chat_send_all(core.colorize("red", "Match Terminated"))
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
return false, "Match Cannot be terminated at the moment"
|
||||||
|
end
|
||||||
})
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue