• Simple Round System
    0 replies, posted
I have tried for a couple of weeks to code a round system. I realize this would probably be easier, were I a more experienced coder, so please don't be like: "TROLLOLOL YOU CANT MAKE A SIMPLE ROUND SYSTEM!!" I have some code that I will show, in case I am making a simple error. [lua] ----------Adding Client Side Lua Files AddCSLuaFile("cl_init.lua") --The client downloads "cl_init.lua" AddCSLuaFile("shared.lua") --The client downloads "shared.lua" ----------Including---------- include('shared.lua') --The server loads "shared.lua" function GM:Initialize() RoundStart() end function RoundStart() SayToAll("The round has started!") end function SayToAll(arg) for _, v in pairs(player.GetAll()) do --Get all players and v:ChatPrint(""..arg.."") --Print whatever the string is in their chat boxes end end function GM:DoPlayerDeath() if IsEveryoneDead() == true then RoundStart() SpawnAll() end end function PlayerDeathThink(pl) --Every frame during death end hook.Add( "PlayerDeathThink", "removeplayerdeaththink", function() return false end) --Some hook stuff to remove spawning on click function IsEveryoneDead() for _, pl in ipairs( player.GetAll() ) do if pl:Alive() then return false end end return true end function SpawnAll() for _, ply in ipairs( player.GetAll() ) do ply:Spawn() end end [/lua] Please tell me what I am doing wrong, or post some code I can put into my gamemode that makes the round end when everyone is dead. Thanks. [editline]25th March 2011[/editline] And I also need to make it so it ends the gamemode when one team is dead.
Sorry, you need to Log In to post a reply to this thread.