Raised This Month: $ Target: $400
 0% 

Round Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 06-01-2013 , 04:06   Round Help
Reply With Quote #1

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")
    }

Randomize is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 06-01-2013 , 04:53   Re: Round Help
Reply With Quote #2

Try quit
__________________
Blizzard_87 is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 06-01-2013 , 05:22   Re: Round Help
Reply With Quote #3

Still don't work.
Randomize is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-01-2013 , 05:56   Re: Round Help
Reply With Quote #4

Something like this shouldn't be supported. It seems quite pointless and I doubt people want a plugin to close their game.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-01-2013 , 09:22   Re: Round Help
Reply With Quote #5

server_cmd("quit");
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-01-2013 , 13:39   Re: Round Help
Reply With Quote #6

Quote:
Originally Posted by YamiKaitou View Post
server_cmd("quit");
hahah xD, this is a good command for quit the server
TheDS1337 is offline
MPD
Member
Join Date: May 2013
Location: Lithuania
Old 06-01-2013 , 13:48   Re: Round Help
Reply With Quote #7

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".

Last edited by MPD; 06-01-2013 at 13:54.
MPD is offline
Send a message via Skype™ to MPD
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-01-2013 , 18:35   Re: Round Help
Reply With Quote #8

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.
Backstabnoob is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-02-2013 , 11:55   Re: Round Help
Reply With Quote #9

Win Limit automatically change the map
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 06-05-2013 , 00:01   Re: Round Help
Reply With Quote #10

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.

Last edited by Randomize; 06-05-2013 at 00:02.
Randomize is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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