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

[CS 1.6] Score Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-16-2020 , 21:29   Re: [CS 1.6] Score Plugin
Reply With Quote #11

Quote:
Originally Posted by Telekinetic View Post
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);
Yes indeed
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 04-16-2020 , 21:33   Re: [CS 1.6] Score Plugin
Reply With Quote #12

If you set id to 0, you should stop the loop here.

PHP Code:
        for(new iiNumi++) {
            
ShowScore(iPlayers[i]);
        } 
__________________
GitHub
SteamWishlist

六四天安門事件
+ARUKARI- is offline
Telekinetic
Junior Member
Join Date: Apr 2020
Old 04-17-2020 , 08:06   Re: [CS 1.6] Score Plugin
Reply With Quote #13

I tried setting it to 0 - .score does indeed output it for all players, but at the beginning of the round, it outputs it twice (or at least the amount of times of the players online, I just had one with me when testing) - How do I fix that?

@+ARUKARI
Do I just remove the line you've highlighted?

Last edited by Telekinetic; 04-17-2020 at 08:08.
Telekinetic is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 04-17-2020 , 08:38   Re: [CS 1.6] Score Plugin
Reply With Quote #14

Change this and Add function.
PHP Code:
// Change this.
register_clcmd("say .score""ShowScoreAll");

// Create this.
public ShowScoreAll(id) {
    if(
bEnabled) {
        
client_print(0print_chat"Score: Terrorist: %i - CTs: %i"iTerWinsiCtWins);
    }

__________________
GitHub
SteamWishlist

六四天安門事件
+ARUKARI- is offline
Telekinetic
Junior Member
Join Date: Apr 2020
Old 04-17-2020 , 10:15   Re: [CS 1.6] Score Plugin
Reply With Quote #15

I found a bug in this plugin - it doesn't register a CT victory if they win by time, I noticed it during a match. Is there a fix to this, please? Either that, or the score does not go above 7. Because as we speak, Ts are winning 9-4, but the .score shows it as 7-4

Last edited by Telekinetic; 04-17-2020 at 10:17.
Telekinetic is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 04-17-2020 , 12:34   Re: [CS 1.6] Score Plugin
Reply With Quote #16

There seems to be such a method.
https://forums.alliedmods.net/showthread.php?t=286591


I used this method.
PHP Code:
    register_logevent("Event_CTWin"6"3=CTs_Win""3=VIP_Escaped""3=Bomb_Defused""3=All_Hostages_Rescued""3=CTs_PreventEscape""3=Escaping_Terrorists_Neutralized");
    
register_logevent("Event_TRWin"6"3=Terrorists_Win""3=VIP_Assassinated","3=Target_Bombed","3=Hostages_Not_Rescued""3=Terrorists_Escaped");

public 
Event_TRWin()
{
        
iTerWins++;
    return 
PLUGIN_CONTINUE;
}

public 
Event_CTWin()
{
        
iTerWins++;
    return 
PLUGIN_CONTINUE;

__________________
GitHub
SteamWishlist

六四天安門事件
+ARUKARI- is offline
Telekinetic
Junior Member
Join Date: Apr 2020
Old 04-17-2020 , 15:03   Re: [CS 1.6] Score Plugin
Reply With Quote #17

Quote:
Originally Posted by +ARUKARI- View Post
There seems to be such a method.
https://forums.alliedmods.net/showthread.php?t=286591


I used this method.
PHP Code:
    register_logevent("Event_CTWin"6"3=CTs_Win""3=VIP_Escaped""3=Bomb_Defused""3=All_Hostages_Rescued""3=CTs_PreventEscape""3=Escaping_Terrorists_Neutralized");
    
register_logevent("Event_TRWin"6"3=Terrorists_Win""3=VIP_Assassinated","3=Target_Bombed","3=Hostages_Not_Rescued""3=Terrorists_Escaped");

public 
Event_TRWin()
{
        
iTerWins++;
    return 
PLUGIN_CONTINUE;
}

public 
Event_CTWin()
{
        
iTerWins++;
    return 
PLUGIN_CONTINUE;

I do not know how to implement that into the code I already have at hand, could you please help? The code previously provided worked, and did count rounds, but at some point it just stops, haven't figured out. Maybe it just discounts defuses/explosions and clock victories - I would be very happy! Thanks in advance.
Telekinetic is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 04-17-2020 , 15:51   Re: [CS 1.6] Score Plugin
Reply With Quote #18

I think this will work.

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

#include <amxmodx>

#pragma semicolon 1

new const szVersion[] = "1.1";

new 
iTerWins;
new 
iCtWins;

new 
bool:bEnabled;

public 
plugin_init()
{
    
register_plugin("TrackScore"szVersion"NapoleoN#,+ARUKAR-");

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

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

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

    
register_logevent("Event_CTWin"6"3=CTs_Win""3=VIP_Escaped""3=Bomb_Defused""3=All_Hostages_Rescued""3=CTs_PreventEscape""3=Escaping_Terrorists_Neutralized");
    
register_logevent("Event_TRWin"6"3=Terrorists_Win""3=VIP_Assassinated","3=Target_Bombed","3=Hostages_Not_Rescued""3=Terrorists_Escaped");

}

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(MsgId, MsgDest, MsgEntity) {
    if(bEnabled) {
        static szMessage[20];

        get_msg_arg_string(2, szMessage, charsmax(szMessage));

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

        else if(equal(szMessage, "#CTs_Win")) {
            iCtWins++;
        }
    }
}
*/
public Event_TRWin()
{
    
iTerWins++;
    return 
PLUGIN_CONTINUE;
}

public 
Event_CTWin()
{
    
iCtWins++;
    return 
PLUGIN_CONTINUE;


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


public 
ShowScoreForAll(id
{
    if(
bEnabled
    {
        
client_print(0print_chat"Score: Terrorist: %i - CTs: %i"iTerWinsiCtWins);
    }

__________________
GitHub
SteamWishlist

六四天安門事件
+ARUKARI- is offline
Telekinetic
Junior Member
Join Date: Apr 2020
Old 04-17-2020 , 16:41   Re: [CS 1.6] Score Plugin
Reply With Quote #19

@ARUKAI, I checked your code - it compiled without errors or warnings but the commands are unresponsive and .score shows no output. Thanks!

Edit: It started working after I replaced clcmd with concmd. I tested the plugin and winning with a defuse or by time does not add to the score. Explosions do now, however.

Last edited by Telekinetic; 04-17-2020 at 18:52.
Telekinetic is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 04-18-2020 , 02:39   Re: [CS 1.6] Score Plugin
Reply With Quote #20

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

#include <amxmodx>

#pragma semicolon 1

new const szVersion[] = "1.2";

new 
iTerWins;
new 
iCtWins;

new 
gEnabled;

public 
plugin_init()
{
    
register_plugin        ("TrackScore"szVersion"NapoleoN#, +ARUKAR-");

    
register_concmd    ("amx_swapscores",    "SwapScores");
    
register_clcmd        ("say",                 "SayCmd");

    
gEnabled register_cvar("amx_trackscore""1");

    
register_logevent    ("Round_Start",    2,    "1=Round_Start");
    
register_logevent    ("Event_CTWin"6,    "3=CTs_Win""3=Target_Saved""3=VIP_Escaped""3=Bomb_Defused""3=All_Hostages_Rescued""3=CTs_PreventEscape""3=Escaping_Terrorists_Neutralized");
    
register_logevent    ("Event_TRWin"6,    "3=Terrorists_Win""3=VIP_Assassinated","3=Target_Bombed","3=Hostages_Not_Rescued""3=Terrorists_Escaped");
    
register_logevent    ("Round_Reset"2,    "1=Game_Commencing");


    
iCtWins        0;
    
iTerWins    0;
}

public 
SayCmd(id)
{
    if (!
get_pcvar_num(gEnabled))
        return 
PLUGIN_CONTINUE;

    new 
said[32];
    
read_argv(1saidcharsmax(said));

    if (
equali(said,".score"))
    {
        
ShowScore(id);
    }
    return 
PLUGIN_CONTINUE;
}
    


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

        
iScoreBuffer iTerWins;
        
iTerWins iCtWins;
        
iCtWins iScoreBuffer;
    }
}

public 
Event_TRWin()
{
    if(
get_pcvar_num(gEnabled)) 
        
iTerWins++;
    
    return 
PLUGIN_CONTINUE;
}

public 
Event_CTWin()
{
    if(
get_pcvar_num(gEnabled)) 
        
iCtWins++;
    
    return 
PLUGIN_CONTINUE;


public 
Round_Start() 
{
    if(
get_pcvar_num(gEnabled)) 
    {
        
ShowScore(0);
    } else {
        
iCtWins    0;
        
iTerWins    0;
    }
}

public 
Round_Reset()
{
    
iCtWins    0;
    
iTerWins    0;
}

public 
ShowScore(id
{
    if(
get_pcvar_num(gEnabled)) 
    {
        
client_print(0print_chat"Score: Terrorist: %i - CTs: %i"iTerWinsiCtWins);
    }

Edited: Count CTs Timeup win.
__________________
GitHub
SteamWishlist

六四天安門事件

Last edited by +ARUKARI-; 04-18-2020 at 22:08.
+ARUKARI- 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 19:40.


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