AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   round rr (https://forums.alliedmods.net/showthread.php?t=206102)

GhostMan 01-18-2013 11:07

round rr
 
I have a problem with Deathrun manager http://forums.alliedmods.net/showthread.php?p=692544

I'm using team join manager by exolent http://forums.alliedmods.net/showthread.php?p=610161 so that all connected players would be in CT team.

Lets say i have connected to the server and now we are two in it (me and deathrun bot). If i stay there for a while and after some time (2 or 3 mins) in to server connects 3rd guy. So now that DeathRun mod would start round must be restarted.

Deathrun manager doesn't do that so i wrote little code but still have problems.

Code:

#include <amxmodx>

new g_Restartas = 0
new g_SVRestart
new g_HudSync

public plugin_init()
{
    new const VERSION[ ] = "1.0"

    register_plugin("DeathRun RoundRR", VERSION, "me")

    g_SVRestart    =    get_cvar_pointer( "sv_restart" );
    g_HudSync = CreateHudSyncObj();

    set_task(8.0, "Check", _, _, _, "b")
}

public Check()
{
    if(g_Restartas == 0)
    {
        set_hudmessage(0, 85, 255, -1.0, 0.35, 0, 6.0, 8.0);
        ShowSyncHudMsg(0, g_HudSync, "At least 3 players required to start a game!");
       
        if(get_playersnum() >= 3)
        {
            client_print(0, print_chat, "* Restarting the game!")
            set_pcvar_num(g_SVRestart, 1);
            g_Restartas = 1
        }
    }
}

public client_disconnect()
{
    if(get_playersnum() <= 2)
    {
        g_Restartas = 0
    }
}

This code becomes inactive after 1st restart.

If i'm in server + bot (2) and then connects 3rd guy this code gives restart. Now if that guy reconnects there is no restart anymore.


All times are GMT -4. The time now is 13:38.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.