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

Detect winning team in End Round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 05-11-2019 , 10:56   Detect winning team in End Round
Reply With Quote #1

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) );
			}
		}
	} 
}
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
SZOKOZ
Member
Join Date: Jan 2014
Old 05-11-2019 , 12:49   Re: Detect winning team in End Round
Reply With Quote #2

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;
}
__________________
May still be available for SM scripting. Just look at my Steam profile regarding my availability.
My Steam
SZOKOZ is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 05-11-2019 , 15:17   Re: Detect winning team in End Round
Reply With Quote #3

Quote:
Originally Posted by SZOKOZ View Post
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
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
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 18:02.


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