Raised This Month: $51 Target: $400
 12% 

[CS 1.6] Score Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Telekinetic
Junior Member
Join Date: Apr 2020
Old 04-15-2020 , 14:51   [CS 1.6] Score Plugin
Reply With Quote #1

Hello, I have created a ClanWar server where everything is manually operated by an admin via commands. I am looking for a plugin related to score. I will try to explain what the plugin is supposed to do, so maybe someone can help. Once again, nothing should be automated which, I believe, should make things a lot easier.

amx_trackscore 1/0 (Enabled/Disabled) - Once this command is set to 1, the server will start tracking the score and treat it as a match, so any rounds won will add one to (Terrorists) X - Y (Counter-Terrorists)
amx_swapscores - Will just flip the X -Y above and display (Terrorists) Y - X (Counter-Terrorists) and it will continue adding as it was. I don't need to swap teams, because I'm planning to use this plugin in conjunction with others I have, and all commands will be executed via a macro through cfg anyway, so no need to automate anything.

say .score - Should display the score of the match, which should be the sum of scores tracked in both halves. (This can be used by all players) (This command should not work if amx_trackscore is set to 0.) Also, if possible, could it print the score at the beginning of every round?

To sum up, this is how I am going to make it work without any of it being automated - during a match, I will exec the match start.cfg, which will enable to command amx_trackscore 1, and the game will kick off, at half-time, when 15 rounds are played, an admin will execute a .half command, and a cfg will automatically input amx_swapscores through a macro, and score tracking will carry on, but for opposing sides now - A restart should not reset the tracked score, only setting the command to 0 should.

I really hope I am not asking for too much, I have tried, but I can't script at all, I can barely modify anything to suit my needs. Thank you in advance!

Edit: Forgot to mention, this doesn't even have to be for TAB, just chat. That's all.

Edit: Delete my old thread, I have posted in the wrong section. Sorry.
Telekinetic is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 04-15-2020 , 19:05   Re: [CS 1.6] Score Plugin
Reply With Quote #2

To much work. But i can help you with mix plugin. Totaly manual. Only admin can start match etc.
4ever16 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-15-2020 , 19:41   Re: [CS 1.6] Score Plugin
Reply With Quote #3

untested

PHP Code:
/* Sublime AMXX Editor v2.2 */

#include <amxmodx>
#include <amxmisc>

#pragma semicolon 1

new const szVersion[] = "1.0";

new 
iTerWins;
new 
iCtWins;

new 
bool:bEnabled;

public 
plugin_init()
{
    
register_plugin("TrackScore"szVersion"NapoleoN#");

    
register_concmd("amx_trackscore""CheckSettings"ADMIN_KICK);
    
register_concmd("amx_swapscores""SwapScores"ADMIN_KICK);
    
register_clcmd("say /score""ShowScore");

    
register_logevent("RoundStart"2"1=Round_Start");

    
register_message(get_user_msgid("TextMsg"), "CheckWinningTeam");
}

public 
CheckSettings(idlevelcid)
{
    if(
cmd_access(idlevelcid2)) {
        new 
szArg[2];
        
read_argv(1szArgcharsmax(szArg));

        if(!
bEnabled && equali(szArg"1")) {
            
bEnabled true;
        }

        else {
            
bEnabled false;
            
iCtWins 0;
            
iTerWins 0;
        }
    }
}

public 
SwapScores(idlevelcid) {
    if(
bEnabled && cmd_access(idlevelcid2)) {
        new 
iScoreBuffer;

        
iScoreBuffer iTerWins;
        
iTerWins iCtWins;
        
iCtWins iScoreBuffer;
    }
}

public 
CheckWinningTeam(MsgIdMsgDestMsgEntity) {
    if(
bEnabled) {
        static 
szMessage[20];

        
get_msg_arg_string(2szMessagecharsmax(szMessage));

        if(
equal(szMessage"#Terrorists_Win")) {
            
iTerWins++;
        }

        else if(
equal(szMessage"#CTs_Win")) {
            
iCtWins++;
        }
    }
}

public 
RoundStart() {
    if(
bEnabled) {
        new 
iPlayers[32], iNum;
        
get_players(iPlayersiNum);

        for(new 
iiNumi++) {
            
ShowScore(iPlayers[i]);
        }
    }
}

public 
ShowScore(id) {
    if(
bEnabled) {
        
client_print(idprint_chat"Score: Terrorist: %i - CTs: %i"iTerWinsiCtWins);
    }

__________________

Last edited by Napoleon_be; 04-16-2020 at 13:41.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Telekinetic
Junior Member
Join Date: Apr 2020
Old 04-15-2020 , 21:12   Re: [CS 1.6] Score Plugin
Reply With Quote #4

Quote:
Originally Posted by Napoleon_be View Post
untested

PHP Code:
/* Sublime AMXX Editor v2.2 */

#include <amxmodx>

#pragma semicolon 1

new const szVersion[] = "1.0";

new 
iTerWins;
new 
iCtWins;

new 
bool:bEnabled;

public 
plugin_init()
{
    
register_plugin("TrackScore"szVersion"NapoleoN#");

    
register_clcmd("amx_trackscore""CheckSettings");
    
register_clcmd("amx_swapscores""SwapScores");
    
register_clcmd("say .score""ShowScore");

    
register_logevent("RoundStart"2"1=Round_Start");

    
register_message(get_user_msgid("TextMsg"), "CheckWinningTeam");
}

public 
CheckSettings(id) {
    if(
get_user_flags(id) & ADMIN_KICK) {
        new 
szArg[2];
        
read_argv(1szArgcharsmax(szArg));

        if(!
bEnabled && equali(szArg"1")) {
            
bEnabled true;
        }

        else {
            
bEnabled false;
            
iCtWins 0;
            
iTerWins 0;
        }
    }
}

public 
SwapScores(id) {
    if(
bEnabled && get_user_flags(id) & ADMIN_KICK) {
        new 
iScoreBuffer;

        
iScoreBuffer iTerWins;
        
iTerWins iCtWins;
        
iCtWins iScoreBuffer;
    }
}

public 
CheckWinningTeam(MsgIdMsgDestMsgEntity) {
    if(
bEnabled) {
        static 
szMessage[20];

        
get_msg_arg_string(2szMessagecharsmax(szMessage));

        if(
equal(szMessage"#Terrorists_Win")) {
            
iTerWins++;
        }

        else if(
equal(szMessage"#CTs_Win")) {
            
iCtWins++;
        }
    }
}

public 
RoundStart() {
    if(
bEnabled) {
        new 
iPlayers[32], iNum;
        
get_players(iPlayersiNum);

        for(new 
iiNumi++) {
            
ShowScore(iPlayers[i]);
        }
    }
}

public 
ShowScore(id) {
    if(
bEnabled) {
        
client_print(idprint_chat"Score: Terrorist: %i - CTs: %i"iTerWinsiCtWins);
    }

Hey, thanks for responding so quickly! I did test the plugin, it complied without errors or warnings, but none of the commands worked in game - they went as unrecognized by both console and rcon, and .score didn't work either.
Thanks a lot again!
Telekinetic is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-16-2020 , 06:23   Re: [CS 1.6] Score Plugin
Reply With Quote #5

Quote:
Originally Posted by Telekinetic View Post
Hey, thanks for responding so quickly! I did test the plugin, it complied without errors or warnings, but none of the commands worked in game - they went as unrecognized by both console and rcon, and .score didn't work either.
Thanks a lot again!
I'll lookt into this when i get back home from work, probably gotta use register_concmd().
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Telekinetic
Junior Member
Join Date: Apr 2020
Old 04-16-2020 , 06:49   Re: [CS 1.6] Score Plugin
Reply With Quote #6

Quote:
Originally Posted by Napoleon_be View Post
I'll lookt into this when i get back home from work, probably gotta use register_concmd().
Thank you a lot!!!
Telekinetic is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-16-2020 , 13:39   Re: [CS 1.6] Score Plugin
Reply With Quote #7

Updated my code, please make sure debug is enabled, check if the plugin is running and if you have error logs located in your logs folder. Been years since i used register_concmd so not sure if this is gonna work.

Also, i changed .score to /score, as this is the most common way of registering say commands.
__________________

Last edited by Napoleon_be; 04-16-2020 at 13:41.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Telekinetic
Junior Member
Join Date: Apr 2020
Old 04-16-2020 , 15:32   Re: [CS 1.6] Score Plugin
Reply With Quote #8

Quote:
Originally Posted by Napoleon_be View Post
Updated my code, please make sure debug is enabled, check if the plugin is running and if you have error logs located in your logs folder. Been years since i used register_concmd so not sure if this is gonna work.

Also, i changed .score to /score, as this is the most common way of registering say commands.
I'm an idiot, made a mistake when pasting - checking now.

Tested, it compiled well without any errors, but the command comes back as unrecognized both as a standalone command and a CVAR.

I also enabled debugging, but the error log had nothing related to the plugin.

Last edited by Telekinetic; 04-16-2020 at 15:41.
Telekinetic is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-16-2020 , 15:51   Re: [CS 1.6] Score Plugin
Reply With Quote #9

Quote:
Originally Posted by Telekinetic View Post
I'm an idiot, made a mistake when pasting - checking now.

Tested, it compiled well without any errors, but the command comes back as unrecognized both as a standalone command and a CVAR.

I also enabled debugging, but the error log had nothing related to the plugin.
Does this happen with both codes or only the most recent one?

EDIT: You're obviously doing something wrong:
Code:
] rcon amx_trackscore 1

mTc | NapoleoN# :  .score

Score: Terrorist: 0 - CTs: 0
__________________

Last edited by Napoleon_be; 04-16-2020 at 15:57.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Telekinetic
Junior Member
Join Date: Apr 2020
Old 04-16-2020 , 18:34   Re: [CS 1.6] Score Plugin
Reply With Quote #10

Quote:
Originally Posted by Napoleon_be View Post
Does this happen with both codes or only the most recent one?

EDIT: You're obviously doing something wrong:
Code:
] rcon amx_trackscore 1

mTc | NapoleoN# :  .score

Score: Terrorist: 0 - CTs: 0
I've tested it. Works flawlessly. Sorry for being an idiot. Thank you very very very much. (Your original code works without hiccups too as soon as I stop being a complete dumbell!) Thanks a lot! The only thing I want to ask, what code do I have to modify so that .score outputs it for everyone, rather than for the client only? My best guess is to modify "id" to "0" in
client_print(id, print_chat, "Score: Terrorist: %i - CTs: %i", iTerWins, iCtWins);

Last edited by Telekinetic; 04-16-2020 at 18:42.
Telekinetic 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 11:21.


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