-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed tactical delete after spawn, try spawn fix
- Loading branch information
Joost de Niet
committed
May 16, 2023
1 parent
631806b
commit e1a279d
Showing
7 changed files
with
82 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,72 @@ | ||
-- [[ PLAYER CONNECTED ONCE ]] -- | ||
function PlayerConnectedOnce(player) | ||
-- Insert player to player lists | ||
-- INSERT player to player lists | ||
table.insert(players, player) | ||
player.use_of_booster = 0 | ||
player.use_of_zipline = 0 | ||
player.spawned = 0 | ||
player.money = 0 | ||
|
||
-- If the game has started, set the type of player to zombie | ||
if config.started == true then | ||
table.insert(zombies, player) | ||
player.type = "zombie" | ||
player.money = 50 | ||
end | ||
-- MENU | ||
HandleMenu(player) | ||
|
||
-- First time player message | ||
-- FIRST time spawn logic | ||
player:onnotify("spawned_player", function() | ||
player:PlayerMessage("^4Welcome to ^1RooieRonnie's ^6Zombieland!") | ||
player:PlayerMessage("^5Creaded by ^2Joost de Niet!") | ||
end) | ||
end | ||
if player.spawned == 0 then | ||
-- ONE time message | ||
player:PlayerMessage("^4Welcome to ^1RooieRonnie's ^6Zombieland!") | ||
player:PlayerMessage("^5Creaded by ^2Joost de Niet!") | ||
|
||
-- If the game has started, set the type of player to zombie | ||
game:ontimeout(function() | ||
if config.started == true then | ||
table.insert(zombies, player) | ||
player:CreateTopMessage("You are now a zombie!", vector:new(1, 0, 0)) | ||
ZombieSpawnLogic(player) | ||
player:ChangeTeam("axis") | ||
else | ||
|
||
function has_value (tab, val) | ||
for index, value in ipairs(tab) do | ||
if value == val then | ||
return true | ||
table.insert(survivors, player) | ||
player:CreateTopMessage("Welcome to RooieRonnie's ZombieLand", vector:new(0, 1, 0)) | ||
SurvivorSpawnLogic(player) | ||
|
||
game:ontimeout(function() | ||
player:CreateTopMessage("Survive as long as possible to win!", vector:new(0, 0, 1)) | ||
game:ontimeout(function() | ||
player:CreateTopMessage("Press [{+actionslot 2}] to open the shop!", vector:new(0.86, 0.81, 0.34)) | ||
end, 9000) | ||
end, 10000) | ||
end | ||
end, 500) | ||
|
||
-- Set spawned player to YES | ||
player.spawned = 1 | ||
end | ||
end | ||
return false | ||
end) | ||
end | ||
|
||
|
||
-- [[ PLAYER CONNECTED ]] -- | ||
function PlayerConnected(player) | ||
-- Default money if there is a error. | ||
player.money = 50 | ||
|
||
HandleMenu(player) | ||
|
||
-- Check if the game can start | ||
if config.started == false and config.enough_people == false then | ||
start_zombieland() | ||
config.enough_people = true | ||
end | ||
|
||
-- Handle spawn player | ||
-- HANDLE spawn after DEAD | ||
player:onnotify("spawned_player", function() | ||
if player.type == "zombie" then | ||
player:CreateTopMessage("You are now a zombie!", vector:new(1, 0, 0)) | ||
player:GiveZombieClass() | ||
ZombieSpawnLogic(player) | ||
if player.savedPosistion ~= nil then | ||
player:setplayerangles(player.savedAngle) | ||
player:setorigin(player.savedPosistion) | ||
player:iprintlnbold("^2You spawned at your tactical insertion") | ||
player.savedAngle = nil | ||
player.savedPosistion = nil | ||
player.tactical:delete() | ||
end | ||
return | ||
elseif player.type == nil then | ||
table.insert(survivors, player) | ||
player:CreateTopMessage("Welcome to RooieRonnie's ZombieLand", vector:new(0, 1, 0)) | ||
player.type = "survivor" | ||
player.money = 500 | ||
|
||
-- Survivor spawn message | ||
game:ontimeout(function() | ||
player:CreateTopMessage("Survive as long as possible to win!", vector:new(0, 0, 1)) | ||
game:ontimeout(function() | ||
player:CreateTopMessage("Press [{+actionslot 2}] to open the shop!", vector:new(0.86, 0.81, 0.34)) | ||
end, 9000) | ||
end, 10000) | ||
SurvivorSpawnLogic(player) | ||
end | ||
|
||
-- standard surivivor script | ||
player:freezecontrols(false) | ||
player:GivePlayerClass() | ||
|
||
-- Temporary fix for tables | ||
if player.team == "allies" then | ||
player:RemovePlayerFromTable(zombies) | ||
table.insert(survivors, player) | ||
else | ||
player:RemovePlayerFromTable(survivors) | ||
table.insert(zombies, player) | ||
end | ||
end) | ||
end | ||
|
||
-- [[ HANDLE MENU ]] -- | ||
function HandleMenu(player) | ||
if config.started then | ||
player:scriptcall("maps/mp/gametypes/_menus", "setteam", "axis") | ||
else | ||
player:scriptcall("maps/mp/gametypes/_menus", "setteam", "allies") | ||
end | ||
end | ||
|
||
-- [[ PLAYER DISCONNECT ]] -- | ||
function PlyerDisconnected(player) | ||
player:onnotifyonce("disconnect", function () | ||
CheckForPlayers() | ||
player:RemovePlayerFromTable(players) | ||
player:RemovePlayerFromTable(survivors) | ||
player:RemovePlayerFromTable(zombies) | ||
end) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- [[ PLAYER DISCONNECT ]] -- | ||
function PlyerDisconnected(player) | ||
player:onnotifyonce("disconnect", function () | ||
CheckForPlayers() | ||
player:RemovePlayerFromTable(players) | ||
player:RemovePlayerFromTable(survivors) | ||
player:RemovePlayerFromTable(zombies) | ||
end) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
-- [[ Convert seconds to ms ]] -- | ||
function ms(secs) | ||
return math.floor(secs * 1000) | ||
end | ||
|
||
-- [[ HANDLE MENU ]] -- | ||
function HandleMenu(player) | ||
if config.started == true then | ||
player:scriptcall("maps/mp/gametypes/_menus", "setteam", "axis") | ||
else | ||
player:scriptcall("maps/mp/gametypes/_menus", "setteam", "allies") | ||
end | ||
end |