AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Detect winning team in End Round (https://forums.alliedmods.net/showthread.php?t=316170)

Fuck For Fun 05-11-2019 10:56

Detect winning team in End Round
 
i want to dectect the team winning in roundend and give random Points by (these natives) and for all team win Alive/Dead

but my idea is 1 player is worth = 5,000 Points so 2 is 10,000 as died
Code:

native get_user_cash( Index ) // get the amount of cash a player have
native set_user_cash( Index, amount ) // set the amount of cash for a player

That message example i tried to do:
Code:

public MessageWon()
{
        new iPlayers[ 32 ], iNum, Index;
        get_players( iPlayers, iNum, "ch" );
       
        for( new i = 0; i < iNum; i++ )
        {
                Index = iPlayers[i]
               
                if( !is_user_connected( Index ) )
                        continue;
               
                switch( get_user_team( Index ) )
                {
                        case 1:
                        {
                                client_print(0, print_chat, "Debug: TRs Won" );
                                set_user_cash(Index, get_user_cash(Index) + get_pcvar_num(TeCash) );
                        }
                       
                        case 2:
                        {
                                client_print(0, print_chat, "Debug: CT Won" );
                                set_user_cash(Index, get_user_cash(Index) + get_pcvar_num(CtCash) );
                        }
                }
        }
}


SZOKOZ 05-11-2019 12:49

Re: Detect winning team in End Round
 
Hook the round_end event https://wiki.alliedmods.net/Counter-...ents#round_end
It can tell you which team won through the winner var.
Code:

public OnPluginStart
{
    HookEvent("round_end", OnRoundEnd);
}

public Action:OnRoundEnd(Handle Event, String:name[], bool:dontBroadcast)
{
    int team = GetEventInt(event, "winner");

    return Plugin_Continue;
}


Fuck For Fun 05-11-2019 15:17

Re: Detect winning team in End Round
 
Quote:

Originally Posted by SZOKOZ (Post 2651226)
Hook the round_end event https://wiki.alliedmods.net/Counter-...ents#round_end
It can tell you which team won through the winner var.
Code:

public OnPluginStart
{
    HookEvent("round_end", OnRoundEnd);
}

public Action:OnRoundEnd(Handle Event, String:name[], bool:dontBroadcast)
{
    int team = GetEventInt(event, "winner");

    return Plugin_Continue;
}


Wrong section:
Counter-Strike: Global Offensive Events


All times are GMT -4. The time now is 23:58.

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