AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved Message to appear only after first round not after warmup (https://forums.alliedmods.net/showthread.php?t=330215)

Razvann. 01-24-2021 15:21

Message to appear only after first round not after warmup
 
Hello! How can I edit this plugin to show both messages from him to appear only after first round played not after warmup?

Code:

#include <sourcemod>
#include <cstrike>
#include <zephstocks>

#pragma semicolon 1

#define PLUGIN_VERSION "1.0.1"

public Plugin:myinfo =
{
        name = "alliedmods",
        author = "alliedmods",
        description = "alliedmods",
        version = PLUGIN_VERSION,
        url = "http://www.alliedmods.net"
};

public OnPluginStart()
{
        IdentifyGame();

        // Supress warnings about unused variables.....
        if(g_bL4D || g_bL4D2 || g_bND) {}

        CreateConVar("sm_showleader_csgo_version", PLUGIN_VERSION, "Plugin version", FCVAR_CHEAT|FCVAR_DONTRECORD|FCVAR_NOTIFY|0|FCVAR_SPONLY);
        HookEvent("round_start", OnRoundStart);
}

public OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
        CreateTimer(3.0, LeaderAnnounceTimer);
}

public Action:LeaderAnnounceTimer(Handle:timer, any:data)
{
        new String:m_szMessage[256];

        new Leader = FindLeader();
        if(Leader == 0)
                return Plugin_Handled;
        new Frags = GetClientFrags(Leader);
        new Deaths = GetClientDeaths(Leader);

        if(g_bCSGO)
        {
                new Assists = CS_GetClientAssists(Leader);
                new Score = CS_GetClientContributionScore(Leader);
                Format(STRING(m_szMessage), "• {teamcolor}%N [Scor: %d] {default}este cel mai mare {green}alcoolist {default}cu {lightred}%d/%d/%i", Leader, Score, Frags, Assists, Deaths);
        }
        else
        {
                Format(STRING(m_szMessage), "• {teamcolor}%N [Scor: %d] {default}este cel mai mare {green}alcoolist {default}cu {lightred}%d/%i", Leader, Frags, Frags, Deaths);
        }

        ReplaceColors(STRING(m_szMessage), Leader);
        PrintToChatAll(m_szMessage);
       
        return Plugin_Handled;
}

FindLeader()
{
        new Leader = 0;
        new Score = -1;
        for(new i = 1; i <= MaxClients; i++)
        {
                if(IsClientInGame(i) && ((g_bCSGO && CS_GetClientContributionScore(i) > Score) || (!g_bCSGO && GetClientFrags(i) > Score)))
                {
                        if(g_bCSGO)
                                Score = CS_GetClientContributionScore(i);
                        else
                                Score = GetClientFrags(i);
                        Leader = i;
                }
        }
        return Leader;
}

Thanks!

Ilusion9 01-24-2021 15:29

Re: Message to appear only after first round not after warmup
 
PHP Code:



public OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
GameRules_GetProp("m_bWarmupPeriod")) return;

    
CreateTimer(3.0LeaderAnnounceTimer);



Razvann. 01-24-2021 15:34

Re: Message to appear only after first round not after warmup
 
Thanks!

Razvann. 01-28-2021 16:28

Re: Message to appear only after first round not after warmup
 
I tested and still is showed after warmup
Ps; I use weapon_restrict for Warmup and your plugin for skip 1v1 warmup

Imi apare mesajul fix in prima runda, in loc de a 2-a runda, am modificat corect sau?

Code:

public OnPluginStart()
{
        IdentifyGame();

        // Supress warnings about unused variables.....
        if(g_bL4D || g_bL4D2 || g_bND) {}

        CreateConVar("sm_showleader_csgo_version", PLUGIN_VERSION, "Plugin version", FCVAR_CHEAT|FCVAR_DONTRECORD|FCVAR_NOTIFY|0|FCVAR_SPONLY);
        HookEvent("round_start", OnRoundStart);
}

public OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (GameRules_GetProp("m_bWarmupPeriod")) return;

    CreateTimer(3.0, LeaderAnnounceTimer);
}

public Action:LeaderAnnounceTimer(Handle:timer, any:data)
{
        new String:m_szMessage[256];

        new Leader = FindLeader();
        if(Leader == 0)
                return Plugin_Handled;
        new Frags = GetClientFrags(Leader);
        new Deaths = GetClientDeaths(Leader);

        if(g_bCSGO)
        {
                new Assists = CS_GetClientAssists(Leader);
                new Score = CS_GetClientContributionScore(Leader);
                Format(STRING(m_szMessage), "• {teamcolor}%N [Scor: %d] {default}este cel mai mare {green}alcoolist {default}cu {lightred}%d/%d/%i", Leader, Score, Frags, Assists, Deaths);
        }
        else
        {
                Format(STRING(m_szMessage), "• {teamcolor}%N [Scor: %d] {default}este cel mai mare {green}alcoolist {default}cu {lightred}%d/%i", Leader, Frags, Frags, Deaths);
        }

        ReplaceColors(STRING(m_szMessage), Leader);
        PrintToChatAll(m_szMessage);
       
        return Plugin_Handled;
}

FindLeader()
{
        new Leader = 0;
        new Score = -1;
        for(new i = 1; i <= MaxClients; i++)
        {
                if(IsClientInGame(i) && ((g_bCSGO && CS_GetClientContributionScore(i) > Score) || (!g_bCSGO && GetClientFrags(i) > Score)))
                {
                        if(g_bCSGO)
                                Score = CS_GetClientContributionScore(i);
                        else
                                Score = GetClientFrags(i);
                        Leader = i;
                }
        }
        return Leader;
}


Ilusion9 01-28-2021 17:02

Re: Message to appear only after first round not after warmup
 
PHP Code:


public OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
GameRules_GetProp("m_bWarmupPeriod") || !GameRules_GetProp("m_totalRoundsPlayed")) return;

    
CreateTimer(3.0LeaderAnnounceTimer);




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

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