AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   NELAN 2004 LAN Tournament, needs your scripting help!! (https://forums.alliedmods.net/showthread.php?t=1257)

hellraser 09-10-2004 17:44

Very good code, how could i kinda make a command to restart the match and would 'unready' everyone so everybody would have to type "ready" once again?

twistedeuphoria 09-10-2004 19:48

It looks like it already does that.

hellraser 09-11-2004 03:24

No cause,if u like type a retry in the moddle of the match the server will always consider you as " ready", it doesn't clear up the buffer...

hellraser 09-12-2004 13:43

nobody knows how to make a 'unready' cmd? Its just to do a counter -1 but i dunno how.....:'(

Da Bishop 09-12-2004 15:17

Code:

#include <amxmodx>

new bool:gReady[33] = false
new bool:gReStart = false
new gReadyNum

public plugin_init()
{
    register_plugin("Ready?","5.0","AssKicR")
    register_clcmd("say","HandleSay")
    register_cvar("sv_minplayers","9")
}

public HandleSay(id)
{
    new gText[192]
    read_args(gText, 192)
    remove_quotes(gText)

    if(containi(gText,"ready")!=-1) {
        if(!gReady[id]) {
            if(get_playersnum()>=get_cvar_num("sv_minplayers")) {
                gReady[id] = true
                gReadyNum += 1
                client_print(0,print_chat,"[AMXX] %i/%i are Ready...",gReadyNum,get_playersnum())
            }else{
                client_print(id,print_chat,"[AMXX] Need more players to go live.")
            }
        }else{
            client_print(id,print_chat,"[AMXX] You are already Ready.")
        }
    }
   
    if(containi(gText,"clearlive") !=-1) {
            if(get_user_flags(id) & ADMIN_KICK) {
                    gReady[0] = false
                    gReadyNum = 0
                    client_print(0,print_chat,"[AMXX] Match is not live, Players are not Ready.")
          }else{
                  client_print(id,print_chat,"[AMXX] You are not an admin.")
          }
        }
                 

    if (gReadyNum==get_playersnum() && !gReStart) {
        gReStart = true
        client_print(0,print_chat,"[AMXX] GOING LIVE ON THREE RESTARTS")
        //client_cmd(0,"spk ambience/siren.wav") //UNCOMMENT THIS LINE FOR A NICE SOUND EFFECT
        set_task( 5.0, "RestartRound1" ) //first restart
        set_task( 9.0, "RestartRound2" ) //second restart
        set_task( 11.0,"RestartRound3" ) //final restart
        set_task( 17.0,"goLIVE") //go live
    } 
   
}

public RestartRound1() {
    server_cmd( "sv_restartround 1")
}

public RestartRound2() {
    server_cmd( "sv_restartround 1")
}

public RestartRound3() {
    server_cmd( "sv_restartround 5")
}

public goLIVE() {
    client_print(0,print_chat,"[AMXX] MATCH IS NOW LIVE!")
    client_print(0,print_center,"MATCH IS NOW LIVE!")
    gReStart = false
    for( new id=0 ; id>33 ; id++ )
        gReady[id]=false
}

try this think that should work... just wrote a quick little segmet

SAY: clearlive to erase the ready... can't use notready since it looks for teh work ready :wink:

hellraser 09-12-2004 16:07

Thx for your time dude, what i want is when a normal player has typed 'ready' he could type like 'stop' and the ready players counter would go -1! ??

Da Bishop 09-12-2004 16:26

so if he were to say stop... just he isn't ready no more and count is -1 got it

Code:

#include <amxmodx>

new bool:gReady[33] = false
new bool:gReStart = false
new gReadyNum

public plugin_init()
{
    register_plugin("Ready?","5.0","AssKicR")
    register_clcmd("say","HandleSay")
    register_cvar("sv_minplayers","9")
}

public HandleSay(id)
{
    new gText[192]
    read_args(gText, 192)
    remove_quotes(gText)

    if(containi(gText,"ready")!=-1) {
        if(!gReady[id]) {
            if(get_playersnum()>=get_cvar_num("sv_minplayers")) {
                gReady[id] = true
                gReadyNum += 1
                client_print(0,print_chat,"[AMXX] %i/%i are Ready...",gReadyNum,get_playersnum())
            }else{
                client_print(id,print_chat,"[AMXX] Need more players to go live.")
            }
        }else{
            client_print(id,print_chat,"[AMXX] You are already Ready.")
        }
    }
   
    if(containi(gText,"stop") !=-1) {
      if(gReady[id]) {
              gReady[id] = false
              gReadyNum -= 1
              client_print(id,print_chat,"[AMXX] You are now not ready.")
              client_print(0,print_chat,"[AMXX] %i/%i are Ready now...",gReadyNum,get_playersnum())
                }else{
                        client_print(id,print_chat,"[AMXX] You have not said Ready yet...")
                }
        }         

    if (gReadyNum==get_playersnum() && !gReStart) {
        gReStart = true
        client_print(0,print_chat,"[AMXX] GOING LIVE ON THREE RESTARTS")
        //client_cmd(0,"spk ambience/siren.wav") //UNCOMMENT THIS LINE FOR A NICE SOUND EFFECT
        set_task( 5.0, "RestartRound1" ) //first restart
        set_task( 9.0, "RestartRound2" ) //second restart
        set_task( 11.0,"RestartRound3" ) //final restart
        set_task( 17.0,"goLIVE") //go live
    }   
   
}

public RestartRound1() {
    server_cmd( "sv_restartround 1")
}

public RestartRound2() {
    server_cmd( "sv_restartround 1")
}

public RestartRound3() {
    server_cmd( "sv_restartround 5")
}

public goLIVE() {
    client_print(0,print_chat,"[AMXX] MATCH IS NOW LIVE!")
    client_print(0,print_center,"MATCH IS NOW LIVE!")
    gReStart = false
    for( new id=0 ; id>33 ; id++ )
        gReady[id]=false
}


hellraser 09-12-2004 17:25

Perfect m8,u're da man :d Thx

hellraser 09-13-2004 15:49

There's like a bug or not really cause nothing is coded to stop it.
But if like sv_minplayers = 1 then if a player types stop it will do : gReadyNum -1...And there is no limit for gReadyNum so it can be < 0...
How could i do so
gReadyNum always >= 0 ??

Thx

[SNPR]Sega 09-16-2004 03:09

Cool plugin. I'm a fan. Thanks guys.


All times are GMT -4. The time now is 07:03.

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