AlliedModders

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

Randomize 06-01-2013 04:06

Round Help
 
I'm trying to make a plugin which makes the CS exit after one team reach the win limit, but it didn't work.
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>

#define PLUGIN "Round End"
#define VERSION "1.0"
#define AUTHOR "DavidJr"

new g_iTScoreg_iCTScore

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("TeamScore""Event_TeamScore""a")    
}
public 
Event_TeamScore(id)
{
    new 
szTeam[2]
    
read_data(1szTeamcharsmax(szTeam))
    switch( 
szTeam[0] )
    {
        case 
1:
        {
            
g_iCTScore read_data(2)
        }
        case 
2:
        {
            
g_iTScore read_data(2)
            
CheckScore(id)
        }
    }
}
CheckScore(id)
{
    new 
winlimit get_cvar_num("mp_winlimit")
    if( 
g_iTScore || g_iCTScore == winlimit )
    {
        
console_cmd(id"exit")
    }



Blizzard_87 06-01-2013 04:53

Re: Round Help
 
Try quit

Randomize 06-01-2013 05:22

Re: Round Help
 
Still don't work.

hornet 06-01-2013 05:56

Re: Round Help
 
Something like this shouldn't be supported. It seems quite pointless and I doubt people want a plugin to close their game.

YamiKaitou 06-01-2013 09:22

Re: Round Help
 
server_cmd("quit");

TheDS1337 06-01-2013 13:39

Re: Round Help
 
Quote:

Originally Posted by YamiKaitou (Post 1962353)
server_cmd("quit");

hahah xD, this is a good command for quit the server :P

MPD 06-01-2013 13:48

Re: Round Help
 
I have one question - why to exit their cs? Some of them may want to play in other server after match or what ever it will be.

shouldn't this
PHP Code:

if( g_iTScore || g_iCTScore == winlimit 

be
PHP Code:

if( (g_iTScore || g_iCTScore) == winlimit 

or
PHP Code:

if( g_iTScore == winlimit || g_iCTScore == winlimit 

because it checks if g_iTScore is not 0 or g_iCTScore equals to winlimit. (not sure for first variant)

Also I think that
PHP Code:

        case 1:
        {
            
g_iCTScore read_data(2)
        } 

should be
PHP Code:

        case 1:
        {
            
g_iCTScore read_data(2)
            
CheckScore(id)
        } 

Because (in my opinion, I don't really know) if CT gets all the score nothing will happen, because checking won't be called.
I suggest to change "exit" to "disconnect".

Backstabnoob 06-01-2013 18:35

Re: Round Help
 
Quote:

Code:
if( (g_iTScore || g_iCTScore) == winlimit )

This wouldn't work, as ( g_iTScore || g_iCTSCore ) returns a boolean. That code would only compare whether 1 == winlimit or 0 == winlimit.

Quote:

Code:
if( g_iTScore == winlimit || g_iCTScore == winlimit )

This is correct.

^SmileY 06-02-2013 11:55

Re: Round Help
 
Win Limit automatically change the map :)

Randomize 06-05-2013 00:01

Re: Round Help
 
Hornet, no, this is just for my own consumption.
MPD, no, I just want to close it.
Backstabnoob, still don't work.

I've change the code to:
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>

#define PLUGIN "Round End"
#define VERSION "1.0"
#define AUTHOR "DavidJr"

new g_iTScoreg_iCTScore

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("TeamScore""Event_TeamScore""a")    
}
public 
Event_TeamScore(id)
{
    new 
szTeam[2]
    
read_data(1szTeamcharsmax(szTeam))
    switch( 
szTeam[0] )
    {
        case 
1:
        {
            
g_iCTScore read_data(2)
        }
        case 
2:
        {
            
g_iTScore read_data(2)
            
CheckScore()
        }
    }
}
CheckScore()
{
    new 
winlimit get_cvar_num("mp_winlimit")
    if( 
g_iTScore == winlimit || g_iCTScore == winlimit )
    {
        
server_cmd("quit");

    }


And I tried it use CT teams but nothing happens after I reached the win limit. Just a scoreboard only is showed.


All times are GMT -4. The time now is 16:17.

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