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

Solved ace announcement, with money


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 09-22-2018 , 09:26   ace announcement, with money
Reply With Quote #1

Code:
#include < amxmodx >
#include < cstrike >
#include < ColorChat >

#pragma semicolon 1

#define SEMI_ACE 4


static const

	PLUGIN[ ] =		"AceAnnoucements",
	VERSION[ ] =		"1.1",
	AUTHOR[ ] =		"AlliedModders",
	
	TAG[ ] =		"[Dust2]";


new g_iFrags[ 33 ];

new iForward;


public plugin_init( )
{
	register_plugin( PLUGIN, VERSION, AUTHOR );
	register_cvar( PLUGIN, AUTHOR, FCVAR_SERVER );
	
	register_event( "HLTV", "EventNewRound", "a", "1=0", "2=0" );
	register_event( "DeathMsg", "EventDeathMsg", "a" );
	
	register_logevent( "LogEventRoundEnd", 2, "1=Round_End" );
	
	iForward  = CreateMultiForward( "FwdPlayerDidAceOrSemi", ET_STOP, FP_CELL, FP_CELL );
}

public plugin_end( )
{
	DestroyForward( iForward );
}

public client_connect( id )
{
	g_iFrags[ id ] = 0;
}

public EventNewRound( )
{
	arrayset( g_iFrags, 0, sizeof g_iFrags );
}

public EventDeathMsg( )
{
	new iKiller = read_data( 1 );
	new iVictim = read_data( 2 );
	
	CheckAce( iVictim );
	
	if( !iKiller || iKiller == iVictim || cs_get_user_team( iKiller ) == cs_get_user_team( iVictim ) )
	{
		return PLUGIN_CONTINUE;
	}
	
	g_iFrags[ iKiller ]++;
	
	return PLUGIN_CONTINUE;
}

public LogEventRoundEnd( )
{
	new iPlayers[ 32 ], iNum, player;
	
	get_players( iPlayers, iNum, "ch" );
	
	for( new i = 0; i < iNum; i++ )
	{
		player = iPlayers[ i ];
		
		if( g_iFrags[ player ] >= SEMI_ACE )
		{
			DidAceOrSemi( player );
			
			if( g_iFrags[ player ] == SEMI_ACE + 1 )
			{
				return PLUGIN_CONTINUE;
			}
		}
	}
	
	return PLUGIN_CONTINUE;
}

public CheckAce( id )
{
	if( g_iFrags[ id ] >= SEMI_ACE )
	{
		DidAceOrSemi( id );
	}
	
	g_iFrags[ id ] = 0;
}

public DidAceOrSemi( id )
{
	new iReturn = PLUGIN_CONTINUE;
	
	ExecuteForward( iForward, iReturn, id, g_iFrags[ id ] );
	
	if( iReturn == PLUGIN_HANDLED || iReturn == PLUGIN_HANDLED_MAIN )
	{
		return PLUGIN_HANDLED;
	}
	
	new szName[ 32 ];
	
	get_user_name( id, szName, sizeof szName - 1 );
			
	ColorChat( 0, GREEN, "%s ^x01Player ^x04%s ^x01has just made a%s ^x04%sACE^x01.",
	TAG, szName, g_iFrags [ id ] == SEMI_ACE ? "" : "n", g_iFrags [ id ] == SEMI_ACE ? "SEMI-" : "" );
	
	client_cmd( 0, "spk vox/buzwarn" );
	
	return PLUGIN_HANDLED;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
can someone add an amount of money?
when someone did an ace to get 1000$ and semi 500$
i tryied but didnt work, with
Code:
cs_set_user_money(id, money + 1000)
__________________
a simple act of caring creates an endless ripple.

Last edited by Nutu_; 10-01-2018 at 16:24.
Nutu_ is offline
666
Senior Member
Join Date: Mar 2015
Old 09-22-2018 , 11:28   Re: ace announcement, with money
Reply With Quote #2

try with:
PHP Code:
cs_set_user_money(id,cs_get_user_money(id) + 1000); 

Last edited by 666; 09-22-2018 at 12:44.
666 is offline
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 09-22-2018 , 12:06   Re: ace announcement, with money
Reply With Quote #3

ok but im a bit confused, where should i put it to work for ace and for semi-ace separately, cuz as i can see, its strange for me xD
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
666
Senior Member
Join Date: Mar 2015
Old 09-22-2018 , 12:45   Re: ace announcement, with money
Reply With Quote #4

Quote:
Originally Posted by Nutu_ View Post
ok but im a bit confused, where should i put it to work for ace and for semi-ace separately, cuz as i can see, its strange for me xD

REPLACE:
PHP Code:
public LogEventRoundEnd( )
{
    new 
iPlayers32 ], iNumplayer;
    
    
get_playersiPlayersiNum"ch" );
    
    for( new 
0iNumi++ )
    {
        
player iPlayers];
        
        if( 
g_iFragsplayer ] >= SEMI_ACE )
        {
            
cs_set_user_money(player,cs_get_user_money(player) + 500);
            
DidAceOrSemiplayer );
            
            if( 
g_iFragsplayer ] == SEMI_ACE )
            {
                
cs_set_user_money(player,cs_get_user_money(player) + 1000);
                return 
PLUGIN_CONTINUE;
            }
        }
    }
    
    return 
PLUGIN_CONTINUE;

666 is offline
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 09-22-2018 , 13:10   Re: ace announcement, with money
Reply With Quote #5

thanks
__________________
a simple act of caring creates an endless ripple.
Nutu_ 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 10:48.


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