Cerere Plugin Points

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
User avatar
ForWWarD
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 392
Joined: 25 Feb 2017, 12:29
Detinator Steam: Da
CS Status: Intunericul meu e lumina ta,
Detinator server CS: NORD.PLAY-ARENA.RO
SteamID: /cafeanord
Reputatie: Utilizator neserios (tepar)
Fost Membru Club eXtreamCS (doua luni)
Fond eXtream: 0
Contact:

12 Jul 2018, 08:36

| Afiseaza codul
/*===========================================================================================================================

				        *********************************************************
				         *********** [ Advanced Points System 1.1 ] ************
				        *********************************************************

		-------------------------
		   ---- * Description * ----
		-------------------------

			- Acest plugin este un sistem de puncte ! Ce inseamna asta? Cand faci un frag vei primi X puncte si de asemenea
		mai faci puncte si pe alte obiective !

		-------------------------
		   --- * Configuration * ---
		-------------------------

			points_show_info "0 / 1"			- 0: Afiseaza datele in HUD sub radar | 1: Afiseaza datele deasupra vietii
			points_bombevents_rewards "0 / 1"		- 0: Dezactivat | 1: Activat -> Puncte obtinute pe plantarea/dezamorsarea/explodearea bombei
			points_costonepoint	"MONEY"			- Cat sa coste un punct atunci cand il cumperi prin comanda "/buypoint"
			points_per_headshot "PUNCTE"		- Cate puncte sa primesti pe HeadShot !
			points_bomb_planted "X"			- Cate puncte sa primesti pe plantarea bombei
			points_bomb_exploded "Y"			- Cate puncte sa primesti pe explodarea bombei
			points_bomb_defused "Z"			- Cate puncte sa primesti pe dezamorsarea bombei
			points_gamename "Adv. Points System v1.1"	- Schimbi numele default( Counter-Strike ) cu altul
			points_add_newround "PUNCTE"		- Cate puncte sa primesti la fiecare runda !
			points_enable_respawn "0 / 1"		- Activeaza / Dezactiveaza respawn-ul cand victima moare doar daca are X PUNCTE
			points_for_respawn "PUNCTE"		- Cate puncte sa aiba victima ca sa poata reinvia atunci cand este omorata
			points_respawn_chance "SANSE"		- De cate sanse are nevoie victima ca sa invie atunci cand are X PUNCTE

		-------------------------
		   ----- * Modules * -----
		-------------------------

				- Hamsandwich;
			- Fakemeta;
		- Cstrike;

		-------------------------
		      --- * Credits * ---
		-------------------------

			- sDs|Aragon* - sistemul avansat de salvare al punctelor;

		-------------------------
		    --- * Changelog * ---
		-------------------------

			* v1.0:
			   - Initial release | Private | ( 15th Oct 2013 ) :D

			* v1.1:
			   - Public Source ( 13th Dec 2013 )

		-------------------------
		    --- * Update * ---
		-------------------------

				        *********************************************************
				         *********** [ Advanced Points System 1.1 ] ************
				        *********************************************************

===========================================================================================================================*/

#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >
#include < CC_ColorChat >
#include < csx >
#include < cstrike >

#pragma semicolon 1

#define ADMIN_ACCESS ADMIN_IMMUNITY
#define is_user_player(%1) ( 1 <= %1 <= g_MaxPlayers )

#define PLUGIN_NAME 	"Advanced Points System"
#define PLUGIN_VERSION 	"1.1"
#define PLUGIN_AUTHOR 	"YONTU"

new const g_szTag[ ] = "[ Points Manager ]";

// Make files?
new const szWriteCvarsPoints[  ] = "addons/amxmodx/configs/points/points.cfg";
new const szLocationPoints[  ] = "addons/amxmodx/configs/points";

const PEV_SPEC_TARGET = pev_iuser2;

new g_iUserPoints[ 33 ];
new File[ 128 ];

new points_gamename;
new SyncHudMessage, g_MaxPlayers;

enum _:iCvars {

	EnableBombEvents,
	ShowType,
	CostOnePoint,
	PointsPerHS,
	PointsBombPlanted,
	PointsBombExploded,
	PointsBombDefused,
	AddPointsNewRound,
	EnableRespawn,
	PointsForRespawn,
	PointsForRespawnChance
}
;
new g_iCvar[ iCvars ];

public plugin_init( ) {

	register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );
	
	register_event( "DeathMsg", "event_DeathMsg", "a" );

	register_forward( FM_GetGameDescription, "GameDesc" ); 
	register_forward( FM_PlayerPreThink, "fwd_PlayerPreThink" );

	RegisterHam( Ham_Spawn, "player", "Ham_PlayerSpawned_Post", 1 );
	RegisterHam( Ham_Killed, "player", "Ham_PlayerKilled", 1 );
	
	register_clcmd( "say /buypoint", "ClCmdSayBuyPoint" );
	register_clcmd( "say_team /buypoint", "ClCmdSayBuyPoint" );

	register_clcmd( "say pall", "ClCmdSayShowAllPoints" );
	register_clcmd( "say_team pall", "ClCmdSayShowAllPoints" );

	register_clcmd( "say /points", "ClCmdSayPoints" );
	register_clcmd( "say_team /points", "ClCmdSayPoints" );

	register_concmd( "amx_give_points" ,"ClCmdGivePoints", ADMIN_ACCESS, "< nume / @ALL / @T / @CT > < Puncte >" );
	register_concmd( "amx_take_points", "ClCmdTakePoints", ADMIN_ACCESS, "< nume > < Puncte >" );
	register_concmd( "amx_reset_points", "ClCmdResetPoints", ADMIN_ACCESS, "< nume / @ALL >" );
	
	g_iCvar[ ShowType ] = register_cvar( "points_show_info", "1" );
	g_iCvar[ EnableBombEvents ] = register_cvar( "points_bombevents_rewards", "1" );
	g_iCvar[ CostOnePoint ] = register_cvar( "points_costonepoint", "4000" );
	g_iCvar[ PointsPerHS ] = register_cvar( "points_per_headshot", "2" );
	g_iCvar[ PointsBombPlanted ] = register_cvar( "points_bomb_planted", "1" );
	g_iCvar[ PointsBombExploded ] = register_cvar( "points_bomb_exploded", "2" );
	g_iCvar[ PointsBombDefused ] = register_cvar( "points_bomb_defused", "1" );
	g_iCvar[ PointsForRespawn ] = register_cvar( "points_for_respawn", "10000" );
	g_iCvar[ PointsForRespawnChance ] = register_cvar( "points_respawn_chance", "70" );
	g_iCvar[ EnableRespawn ] = register_cvar( "points_enable_respawn", "1" );
	points_gamename = register_cvar( "points_gamename", "Adv. Points System v1.1" );

	SyncHudMessage = CreateHudSyncObj(  );
	g_MaxPlayers = global_get( glb_maxClients );

	new DataDir[ 64 ];
	get_datadir( DataDir, 63 );
	format( File, 127, "%s/AdvancedPointsSystem.dat", DataDir );
}

public plugin_precache(  ) {

	server_cmd( "exec %s", szWriteCvarsPoints );
       
	if( !dir_exists( szLocationPoints ) )
		mkdir( szLocationPoints );

	if( !file_exists( szWriteCvarsPoints ) ) {

		write_file( szWriteCvarsPoints, "// In acest fisier se afla cvar-urile legate despre puncte:");
		write_file( szWriteCvarsPoints, " ");
		write_file( szWriteCvarsPoints, "points_show_info ^"1^" // 0: Afiseaza datele in HUD sub radar | 1: Afiseaza datele deasupra vietii" );
		write_file( szWriteCvarsPoints, "points_bombevents_rewards ^"1^" // 0: Dezactivat | 1: Activat -> Puncte obtinute pe plantarea/dezamorsarea/explodearea bombei" );
		write_file( szWriteCvarsPoints, "points_costonepoint ^"4000^" // Cat sa coste un punct atunci cand il cumperi prin comanda /buypoint" );
		write_file( szWriteCvarsPoints, "points_per_headshot ^"2^" // Cate puncte sa primesti pe HeadShot !" );
		write_file( szWriteCvarsPoints, "points_bomb_planted ^"1^" // Cate puncte sa primesti pe plantarea bombei" );
		write_file( szWriteCvarsPoints, "points_bomb_exploded ^"2^" // Cate puncte sa primesti pe explodarea bombei" );
		write_file( szWriteCvarsPoints, "points_bomb_defused ^"1^" // Cate puncte sa primesti pe dezamorsarea bombei" );
		write_file( szWriteCvarsPoints, "points_enable_respawn ^"1^" // Activeaza / Dezactiveaza respawn-ul cand victima moare doar daca are X PUNCTE" );
		write_file( szWriteCvarsPoints, "points_for_respawn ^"1000^" // Cate puncte sa aiba victima ca sa poata reinvia atunci cand este omorata" );
		write_file( szWriteCvarsPoints, "points_respawn_chance ^"40^" // Cate sanse sa aiba victima ca sa poata reinvia" );
		write_file( szWriteCvarsPoints, "points_gamename ^"Adv. Points System v1.1^" // Schimbi numele default( Counter-Strike ) cu altul" );
		//write_file( szWriteCvarsPoints, "cvar ^"1 / 0^" // De cate sanse are nevoie victima ca sa invie atunci cand are X PUNCTE" );
	}
}

public plugin_natives( ) {

	register_native( "get_user_points", "native_get_user_points", 1 );
	register_native( "set_user_points", "native_set_user_points", 1 );
}

public native_get_user_points( id ) {

	return g_iUserPoints[ id ];
}

public native_set_user_points( id, points ) {

	g_iUserPoints[ id ] = points;
}

public client_putinserver( id ) {

	LoadUserPoints( id );
}

public client_disconnect( id ) {

	SaveUserPoints( id );
}

public GameDesc( ) {

	static szGameName[ 32 ];

	get_pcvar_string( points_gamename, szGameName, 31 );
	forward_return( FMV_STRING, szGameName );

	return FMRES_SUPERCEDE; 
}

public fwdPlayerPreThink( id ) {
	
	if( is_user_alive( id ) ) {
		
		new target, body; 
		get_user_aiming( id, target, body, 9999 );
		
		new CsTeams:team = cs_get_user_team( id );
		
		if( is_user_alive( target ) ) {

			if( is_user_player( target ) ) {
			
				new CsTeams:targetTeam = cs_get_user_team( target );
				
				new szName[ 32 ];
				get_user_name( target,  szName, sizeof( szName ) -1 );
							
				new sMessage[ 64 ];
				if( targetTeam == team ) {

					formatex( sMessage, sizeof( sMessage ) -1, "%s: %s^nHealth: %i | Points: %i", is_user_vip( target ) ? "VIP" : "Friend", szName, get_user_health( target ), g_iUserPoints[ target ] );
				}

				else if( targetTeam != team && team != CS_TEAM_CT ) {

					formatex( sMessage, sizeof( sMessage ) -1, "%s: %s^nHealth: %i | Points: %i", is_user_vip( target ) ? "VIP" : "Enemy", szName, get_user_health( target ), g_iUserPoints[ target ] );
				}
					
				if( targetTeam == CS_TEAM_CT ) {

					set_hudmessage( 0, 255, 0, -1.0, 0.6, 0, 0.0, 0.1, 0.0, 0.0, -1 );
				}

				else if( targetTeam == CS_TEAM_T ) {

					set_hudmessage( 127, 0, 0, -1.0, 0.6, 0, 0.0, 0.1, 0.0, 0.0, -1 );
				}	
				
				show_hudmessage( id, "%s",  sMessage );
			}
		}
	}
	
	return FMRES_IGNORED;
}

public event_DeathMsg( ) {

	new iKiller = read_data( 1 );
	new iVictim = read_data( 2 );
	new iHeadshot = read_data( 3 );
	
	if( !is_user_connected( iKiller ) || !is_user_connected( iVictim ) ) {

		return;
	}
	
	if( iKiller == iVictim ) {

		return;
	}
	
	if( iHeadshot ) {

		g_iUserPoints[ iKiller ] += get_pcvar_num( g_iCvar[ PointsPerHS ] );
		set_hudmessage( random( 255 ), random( 255 ), random( 255 ), 0.6, 0.7, 1, 6.0, 7.0 );
		show_hudmessage( iKiller, "+%i points", get_pcvar_num( g_iCvar[ PointsPerHS ] ) );
	}

	else {

		g_iUserPoints[ iKiller ]++;
		set_hudmessage( random( 255 ), random( 255 ), random( 255 ), 0.6, 0.7, 0, 6.0, 7.0 );
		show_hudmessage( iKiller, "+1 point" );
	}
}

public Ham_PlayerSpawned_Post( id ) {

	if( is_user_connected( id ) && is_user_alive( id ) ) {

		set_task( 1.0, "ShowHud", id, _, _, "b" );
	}
}

public Ham_PlayerKilled( iVictim, iAttacker, iShouldgib ) {

	if( get_pcvar_num( g_iCvar[ EnableRespawn ] ) == 0 || !is_user_connected( iVictim ) )
		return PLUGIN_CONTINUE;

	new iPoints = get_pcvar_num( g_iCvar[ PointsForRespawn ] );
	new iChance = random_num( 1, 100 );
	new iAccepted = get_pcvar_num( g_iCvar[ PointsForRespawnChance ] );

	if( g_iUserPoints[ iVictim ] == iPoints ) {

		if( iChance <= iAccepted ) {

			ExecuteHamB( Ham_CS_RoundRespawn, iVictim );
			ColorChat( 0, TEAM_COLOR, "^x04%s^x01 Tocmai ai fost inviat pentru ca ai avut^x03 %i^x01 sanse !", g_szTag, iChance );
		}

		if( iChance >= iAccepted ) {

			ColorChat( 0, TEAM_COLOR, "^x04%s^x01 Poate runda viitoare vei avea^x03 %i^x01 sanse pentru a putea reinvia !", g_szTag, iChance );
		}
	}

	return PLUGIN_CONTINUE;
}

public ShowHud( id ) {

	switch( get_pcvar_num( g_iCvar[ ShowType ] ) ) {

		case 0: {
	
			if( is_user_connected( id ) && is_user_alive( id ) && ( get_user_team( id ) == 1 || get_user_team( id ) == 2 ) ) {

				set_hudmessage( random( 250 ), random( 250 ), random( 250 ), 0.01, 0.23, 0, 0.5, 15.0, 2.0, 2.0, -1 );
				ShowSyncHudMsg( id, SyncHudMessage, "HP: %d^nPoints: %d", get_user_health( id ), g_iUserPoints[ id ] );
			}

			else {

				new idSpec;
				new iPlayerName[ 32 ];

				idSpec = pev( id, PEV_SPEC_TARGET );
				get_user_name( idSpec, iPlayerName, 31 );

				set_hudmessage( random( 250 ), random( 250 ), random( 250 ), 0.01, 0.22, 0, 0.5, 15.0, 2.0, 2.0, -1 );
				ShowSyncHudMsg( id, SyncHudMessage, "Spectating: %s^nHealth: %d^nPoints: %d", iPlayerName, get_user_health( idSpec ), g_iUserPoints[ idSpec ] );
			}
		}

		case 1: {
	
			if( is_user_connected( id ) && is_user_alive( id ) && ( get_user_team( id ) == 1 || get_user_team( id ) == 2 ) ) {

				set_hudmessage( 0, 0, 254, 0.01, 0.91, 0, 0.5, 15.0, 2.0, 2.0, -1 );
				ShowSyncHudMsg( id, SyncHudMessage, "HP: %d | AP: %d | Points: %d", get_user_health( id ), get_user_armor( id ), g_iUserPoints[ id ] );
			}

			else {

				new idSpec;
				new iPlayerName[ 32 ];

				idSpec = pev( id, PEV_SPEC_TARGET );
				get_user_name( idSpec, iPlayerName, 31 );

				set_hudmessage( random( 250 ), random( 250 ), random( 250 ), -1.0, 0.7, 0, 0.5, 15.0, 2.0, 2.0, -1 );
				ShowSyncHudMsg( id, SyncHudMessage, "Spectating: %s^nHealth: %d^nPoints: %d", iPlayerName, get_user_health( idSpec ), g_iUserPoints[ idSpec ] );
			}
		}
	}
}

public ClCmdSayBuyPoint( id ) {

	if( is_user_connected( id ) )
	{
		new g_iUserMoney = cs_get_user_money( id );
		new iNeededMoney = get_pcvar_num( g_iCvar[ CostOnePoint ] );
 
		if( g_iUserMoney < iNeededMoney )
 
		ColorChat( 0, TEAM_COLOR, "^x04%s^x01 Mai ai nevoie de^x03 %d $^x01 pentru a cumpara^x03 1 punct^x01 !", g_szTag, iNeededMoney - g_iUserMoney );
 
		else {
 
			g_iUserPoints[ id ] += 1;
			cs_set_user_money( id, g_iUserMoney - iNeededMoney );
			ColorChat( 0, TEAM_COLOR, "^x04%s^x01 Tocmai ai cumparat^x03 1 punct^x01 pentru^x03 %d $ !", g_szTag, iNeededMoney );
		}
	}
}

public ClCmdSayShowAllPoints( id ) {

	new iPlayers[ 32 ], iPlayersNum, szName[ 40 ], szMotd[ 1024 ], len;

	len = formatex( szMotd, charsmax( szMotd ), "<html> ");
	get_players( iPlayers, iPlayersNum );

	for( new i = 0 ; i < iPlayersNum ; i++ ) {

		get_user_name( iPlayers[ i ], szName, charsmax( szName ) );
		len += formatex( szMotd[ len ], charsmax( szMotd ) - len, "<br> <center> <font color=#008000>Name:</font> <font color=#8A2BE2>%s</font> | <font color=#008000>Points:</font> <font color=#8A2BE2>%i</font> </center> <br>", szName, g_iUserPoints[ iPlayers[ i ] ] );
	}

	formatex( szMotd[ len ], charsmax( szMotd ) - len, "</html>" );
	show_motd( id, szMotd );	
}

public ClCmdSayPoints( id ) {

	set_hudmessage( 127, 42, 255, 0.03, 0.86, 2, 6.0, 10.0 );
	show_hudmessage( id, "Ai %i puncte !", g_iUserPoints[ id ] );
	
	ColorChat( id, TEAM_COLOR, "^x04%s^x01 Ai^x03 %i^x01 puncte !!!", g_szTag, g_iUserPoints[ id ] );
	
	return PLUGIN_CONTINUE;
}

public bomb_planted( iPlanter ) {

	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( iPlanter ) )
		return PLUGIN_CONTINUE;
		
	g_iUserPoints[ iPlanter ] += get_pcvar_num( g_iCvar[ PointsBombPlanted ] );
	ColorChat( 0, TEAM_COLOR, "^x04%s^x03 %s^x01 a primit^x03 1 punct^x01 pentru plantarea bombei !", g_szTag, get_name( iPlanter ) );
	
	return PLUGIN_CONTINUE;
}

public bomb_explode( iExploder ) {
	
	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( iExploder ) )
		return PLUGIN_CONTINUE;
		
	g_iUserPoints[ iExploder ] += get_pcvar_num( g_iCvar[ PointsBombExploded ] );
	ColorChat( 0, TEAM_COLOR, "^x04%s^x03 %s^x01 a primit^x03 2 puncte^x01 pentru explodarea bombei !", g_szTag, get_name( iExploder ) );
	
	return PLUGIN_CONTINUE;
}

public bomb_defused( iDefuser ) {

	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( iDefuser ) )
		return PLUGIN_CONTINUE;
		
	g_iUserPoints[ iDefuser ] += get_pcvar_num( g_iCvar[ PointsBombDefused ] );
	ColorChat( 0, TEAM_COLOR, "^x04%s^x03 %s^x01 a primit^x03 1 punct^x01 pentru dezamorsarea bombei !", g_szTag, get_name( iDefuser ) );
	
	return PLUGIN_CONTINUE;
}

public ClCmdGivePoints( id ) {

	if( !( get_user_flags( id ) & ADMIN_ACCESS ) ) {

		client_cmd( id, "echo Nu ai acces la aceasta comanda!" );
		return 1;
	}
	
	new szFirstArg[ 32 ], szSecondArg[ 10 ];
	
	read_argv( 1, szFirstArg, sizeof ( szFirstArg ) -1 );
	read_argv( 2, szSecondArg, sizeof ( szSecondArg ) -1 );
	
	if( equal( szFirstArg, "" ) || equal( szSecondArg, "" ) ) {

		client_cmd( id, "echo amx_give_points < nume / @ALL / @T / @CT > < points >" );
		return 1;
	}
	
	new iPlayers[ 32 ];
	new iPlayersNum;
	
	new iPoints = str_to_num( szSecondArg );
	if( iPoints <= 0 ) {

		client_cmd( id, "echo Valoare Punctelor trebuie sa fie mai mare decat 0!" );
		return 1;
	}
	
	if( szFirstArg[ 0 ] == '@' ) {

		switch ( szFirstArg[ 1 ] ) {

			case 'A': {

				if( equal( szFirstArg, "@ALL" ) ) {
					
					get_players( iPlayers, iPlayersNum, "ch" );
					for( new i = 0; i < iPlayersNum ; i++ )
						g_iUserPoints[ iPlayers[ i ] ] += iPoints;
						
					ColorChat( 0, TEAM_COLOR, "^x04^%s^x01 Adminul^x03 %s^x01 le-a dat^x03 %i Puncte^x01 tuturor jucatorilor!", g_szTag, get_name( id ), iPoints );
					return 1;
				}
			}
			
			case 'T': {

				if( equal( szFirstArg, "@T" ) ) {
					
					get_players( iPlayers, iPlayersNum, "ceh", "TERRORIST" );
					if( iPlayersNum == 0 ) {

						client_cmd( id, "echo Nu se afla niciun jucator in aceasta echipa!" );
						return 1;
					}

					for( new i = 0; i < iPlayersNum ; i++ )
						g_iUserPoints[ iPlayers[ i ] ] += iPoints;
						
					ColorChat( 0, TEAM_COLOR, "^x04^%s^x01 Adminul^x03 %s^x01 le-a dat^x03 %i puncte^x01 jucatorilor de la^x03 TERO^x01!", g_szTag, get_name( id ), iPoints );
					return 1;
				}
			}
			
			case 'C': {

				if( equal( szFirstArg, "@CT" ) ) {
					
					get_players( iPlayers, iPlayersNum, "ceh", "CT" );
					if( iPlayersNum == 0 ) {

						client_cmd( id, "echo Nu se afla niciun jucator in aceasta echipa!" );
						return 1;
					}

					for( new i = 0; i < iPlayersNum ; i++ )
						g_iUserPoints[ iPlayers[ i ] ] += iPoints;
						
					ColorChat( 0, TEAM_COLOR, "^x04^%s^x01 Adminul^x03 %s^x01 le-a dat^x03 %i puncte^x01 jucatorilor de la^x03 CT^x01!", g_szTag, get_name( id ), iPoints );
					return 1;
				}
			}
		}
	}
		
	new iPlayer = cmd_target( id, szFirstArg, 8 );
	if( !iPlayer ) {

		client_cmd( id, "echo Jucatorul %s nu a fost gasit!", szFirstArg );
		return 1;
	}
	
	g_iUserPoints[ iPlayer ] += iPoints;
	
	new szName[ 32 ];
	get_user_name( iPlayer, szName, sizeof ( szName ) -1 );
	
	ColorChat( 0, TEAM_COLOR, "^x04%s^x01 Adminul^x03 %s^x01 i-a dat^x03 %i puncte^x01 lui^x03 %s^x01.", g_szTag, get_name( id ), iPoints, szName );
	
	return 1;
}

public ClCmdTakePoints( id ) {

	if( !( get_user_flags( id ) & ADMIN_ACCESS ) ) {

		client_cmd( id, "echo Nu ai acces la aceasta comanda!" );
		return 1;
	}
	
	new szFirstArg[ 32 ], szSecondArg[ 10 ];
	
	read_argv( 1, szFirstArg, sizeof ( szFirstArg ) -1 );
	read_argv( 2, szSecondArg, sizeof ( szSecondArg ) -1 );
	
	if( equal( szFirstArg, "" ) || equal( szSecondArg, "" ) ) {

		client_cmd( id, "echo amx_take_points < nume > < puncte >" );
		return 1;
	}
	
	new iPoints = str_to_num( szSecondArg );
	if( iPoints <= 0 ) {

		client_cmd( id, "echo Valoare Punctelor trebuie sa fie mai mare decat 0!" );
		return 1;
	}
			
	new iPlayer = cmd_target( id, szFirstArg, 8 );
	if( !iPlayer ) {

		client_cmd( id, "echo Jucatorul %s nu a fost gasit!", szFirstArg );
		return 1;
	}
	
	if( g_iUserPoints[ iPlayer ] < iPoints ) {

		client_cmd( id, "echo Jucatorul %s nu are atatea puncte! Are doar %i puncte !", szFirstArg, g_iUserPoints[ iPlayer ] );
		return 1;
	}
	
	g_iUserPoints[ iPlayer ] -= iPoints;
	
	new szName[ 32 ];
	get_user_name( iPlayer, szName, sizeof( szName ) -1 );
	
	ColorChat( 0, TEAM_COLOR, "^x04%s^x01 Adminul^x03 %s^x01 i-a sters^x03 %i puncte^x01 lui^x03 %s^x01.", g_szTag, get_name( id ), iPoints, szName );
	
	return 1;
}

public ClCmdResetPoints( id, level, cid ) {

	if( !cmd_access( id, level, cid, 2 ) ) {

		return PLUGIN_HANDLED; 
	}
	
	new szArgument[ 32 ];
   	read_argv( 1, szArgument, charsmax( szArgument ) );
	
	new iPlayer[ 32 ], iPlayersNum, all;
	get_players( iPlayer, iPlayersNum, "c" );

	if( equal( szArgument, "@ALL" ) ) {

		for( new i; i < iPlayersNum; i++ ) {

			all = iPlayer[ i ];
			
			g_iUserPoints[ all ] = 0;
			
			ColorChat( 0, TEAM_COLOR, "^x04%s^x01 Adminul^x03 %s^x01 v-a resetat toate^x03 punctele !!!", g_szTag, get_name( id ) );
		}
	}
			
	else {

		new player = cmd_target( id, szArgument, 10 );

		if( !player )  {

  			 return PLUGIN_HANDLED;
		}
	

		new TargetName[ 32 char ];
		get_user_name( player, TargetName, charsmax( TargetName ) );
	
		g_iUserPoints[ player ] = 0;
		ColorChat( 0, TEAM_COLOR, "^x04%s^x01 Adminul^x03 %s^x01 i-a resetat punctele lui^x03 %s^x01 !!!", g_szTag, get_name( id ), TargetName );
	}

	return PLUGIN_HANDLED;
}

public SaveUserPoints( id ) {

	new Name[ 32 ];
	get_user_name( id, Name, 31 );
	
	static Data[ 1024 ];
	formatex( Data, sizeof( Data ) - 1, "^"%i^"", g_iUserPoints[ id ] );
	
	new Save[ 512 ];
	format( Save, 511, "^"%s^" %s", Name, Data );
	
	new Line[ 128 ], Linie, IsPlayer = false, Arg1[ 32 ];
	
	new FileOpen = fopen( File, "rt" );

	while( !feof( FileOpen ) ) {

		fgets( FileOpen, Line, 127 );
		trim( Line );
		
		parse( Line, Arg1, 31 );
		
		if( equali( Arg1, Name ) ) {

			write_file( File, Save, Linie );
			IsPlayer = true;
			break;
		}
		
		Linie++;
	}

	fclose( FileOpen );

	if( !IsPlayer ) {

		write_file( File, Save, -1 );
	}
}

public LoadUserPoints( id ) {

	new Name[ 32 ];
	get_user_name( id, Name, 31 );
	
	new Line[ 128 ], IsPlayer = false, Arg1[ 32 ], Arg2[ 32 ];
	
	new FileOpen = fopen( File, "rt" );

	while( !feof( FileOpen ) ) {

		fgets( FileOpen, Line, 127 );
		trim( Line );
		
		parse( Line, Arg1, 31, Arg2, 31 );
		
		if( equali( Arg1, Name ) ) {

			g_iUserPoints[ id ] = str_to_num( Arg2 );
			IsPlayer = true;
			break;
		}
	}

	fclose( FileOpen );
	
	if( !IsPlayer ) {

		g_iUserPoints[ id ] = 1;
	}
}

stock get_name( id ) {

	new szName[ 32 ];
	get_user_name( id, szName, sizeof ( szName ) -1 );
	return szName;
}

stock bool:is_user_vip( id ) {

	if( get_user_flags( id ) & read_flags( "h" )  )
		return true;
	
	return false;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
vreau că pluginul sa nu afecteze deloc vipul când bag pluginul nu mai arata dmg la vip
User avatar
Laurentiu P.
Super moderator
Super moderator
Posts: 2095
Joined: 10 Jul 2013, 20:26
Detinator Steam: Da
CS Status: Activitate scazuta !
Detinator server CS: Da
SteamID: trust_ro
Reputatie: Moderator > Super moderator
Nume anterior: Do[N]e ;3
Fond eXtream: 1
Location: Constanta
Has thanked: 4 times
Been thanked: 3 times

12 Jul 2018, 09:58

Schimba ordinea celor două in plugins.ini. Pune vipul in fata acestui sistem de puncte
Image
User avatar
ForWWarD
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 392
Joined: 25 Feb 2017, 12:29
Detinator Steam: Da
CS Status: Intunericul meu e lumina ta,
Detinator server CS: NORD.PLAY-ARENA.RO
SteamID: /cafeanord
Reputatie: Utilizator neserios (tepar)
Fost Membru Club eXtreamCS (doua luni)
Fond eXtream: 0
Contact:

12 Jul 2018, 10:53

Do[N]e ;3 wrote:Schimba ordinea celor două in plugins.ini. Pune vipul in fata acestui sistem de puncte
Crezi că n-am incercat deja? L-am pus ultimul in plugins și vipul primul degeaba.
Post Reply

Return to “Cereri”

  • Information