1. Post #1
    I'm living in the Best Korea. 사랑해요 김치맨!
    rebel1324's Avatar
    December 2008
    1,887 Posts
    -- This addon is made by Black Tea a.k.a rebel1324 in FP.
    
    MAX_ROUNDS = 3
    
    local CurRound = 0;
    
    function ROUND_REACHED()
        -- Add some event when Current Round Reach the Max Rounds.
        -- If you have map vote thing, add it.
        -- If you need to change specific map, just add here.
        ROUND_MESSEGE( "Max Round reached. Calling Round End Event." )
    end
    
    function ROUND_MULTIPLAYER() 
        if (#player.GetAll() == 2) then
            ROUND_MESSEGE( "Starting New Round in few seconds." )
            
            timer.Simple(8, function()
                ROUND_RESTART();
            end);
        end;
    end
    --hook.Add("PlayerInitialSpawn", "ROUND_MP", ROUND_MULTIPLAYER)
    
    function ROUND_END()
        ROUND_MESSEGE( "New round starting. Prepare." )
        timer.Simple(5, function()
            ROUND_RESTART();
        end);
    end
    
    function ROUND_RESTART()
        game.CleanUpMap(); -- Reset all map entities. if you don't want it, just delete this line.
        -- Add some event when new round start.
        
        for k, v in ipairs(player.GetAll()) do
           v:Spawn()
        end;
        
        if (MAX_ROUNDS == CurRound) then
            ROUND_REACHED()
        end;
        
        CurRound  = CurRound + 1;
    end
    
    function ROUND_MESSEGE( say )
        for k, v in ipairs(player.GetAll()) do
           v:PrintMessage(HUD_PRINTTALK, tostring(say));
        end;
    end
    
    Simple round script for gamemode.
    It will be help for lazy ppl.

    Edited:

    Oops I missed one.

    function ROUND_MULTIPLAYER() 
        if (#player.GetAll() == 2) then
            ROUND_MESSEGE( "Starting New Round in few seconds." )
             
            timer.Simple(8, function()
                ROUND_RESTART();
            end);
        end;
    end
    --hook.Add("PlayerInitialSpawn", "ROUND_MP", ROUND_MULTIPLAYER)
    

    is for team based gamemode or TTT like games.
    Reply With Quote Edit / Delete Reply Korea, Republic of Show Events Friendly Friendly x 5Useful Useful x 2 (list)

  2. Post #2
    Gold Member
    sniperlover's Avatar
    February 2007
    1,262 Posts
    It'll only work with 2 players.
        if (#player.GetAll() == 2) then
    
    
    Reply With Quote Edit / Delete Reply Sweden Show Events Dumb Dumb x 10Agree Agree x 1 (list)

  3. Post #3
    Dizla's Avatar
    November 2010
    73 Posts
    It'll only work with 2 players.
        if (#player.GetAll() == 2) then
    
    
    No, that's to check when a new player has joined the game so a new round can be started - for team based games.
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Agree Agree x 2Disagree Disagree x 1 (list)

  4. Post #4
    I'm living in the Best Korea. 사랑해요 김치맨!
    rebel1324's Avatar
    December 2008
    1,887 Posts
    - snip -
    my stupid brain.

  5. Post #5
    Gold Member
    ralle105's Avatar
    October 2005
    4,648 Posts
    Nice and simple.

    This bugs me though
    timer.Simple(5, function()
        ROUND_RESTART();
    end);
    
    Just do
    timer.Simple(5,ROUND_RESTART)
    
    Reply With Quote Edit / Delete Reply Sweden Show Events Agree Agree x 9Informative Informative x 1 (list)

  6. Post #6
    Pimpin' Member
    Stebbzor's Avatar
    September 2008
    631 Posts
    Thanks.

  7. Post #7
    I'm living in the Best Korea. 사랑해요 김치맨!
    rebel1324's Avatar
    December 2008
    1,887 Posts
    Not really. anyone can make it in an hour.
    that is really easy for all of us.

    This script is just for lazy ppl who are really lazy to make it. (liek me.)
    Reply With Quote Edit / Delete Reply Korea, Republic of Show Events Friendly Friendly x 3 (list)

  8. Post #8
    Zoey Artyom's Avatar
    January 2011
    572 Posts
    Im pretty sure you spell Message like that, not Messege :3:

    But it looks good to go.

  9. Post #9
    I'm living in the Best Korea. 사랑해요 김치맨!
    rebel1324's Avatar
    December 2008
    1,887 Posts
    Im pretty sure you spell Message like that, not Messege :3:

    But it looks good to go.
    Dang it.
    another typo... like 'assult'
    Reply With Quote Edit / Delete Reply Korea, Republic of Show Events Zing Zing x 1Funny Funny x 1 (list)