modificare plugins points

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
*Max3Semne*
Membru, skill +2
Membru, skill +2
Posts: 869
Joined: 29 Nov 2011, 19:45
Detinator Steam: Da
Detinator server CS: cs.max3semne.ro
SteamID: max3semne0
Has thanked: 25 times
Been thanked: 4 times

25 Oct 2018, 13:53

as vrea si eu modificarea pluginului se salveze pe nick si nu pe steam id (el este doar pentru cei steam on si salveaza doar pe steam id) si cand scri in chat /puncte sa apara in motd un top15 cu jucatori cu cele mai multe puncte gen cum este top15, iar primele 8 locuri sa fie culori diferite

platesc daca este cazul :)

| Afiseaza codul
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >
#include < 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 	"Sistem de puncte"
#define PLUGIN_VERSION 	"0.1"
#define PLUGIN_AUTHOR 	"A Demon God"

new const g_szTag[ ] = "[M3S]";

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 ];

enum _:iCvars {

	EnableBombEvents,
	PointsPerHS,
	PointsBombPlanted,
	PointsBombExploded,
	PointsBombDefused,
	AddPointsNewRound,
};
new g_iCvar[ iCvars ];

public plugin_init( )
{
	register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );

	register_event( "DeathMsg", "event_DeathMsg", "a" );

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

	register_clcmd( "say /showskill", "ClCmdSayPointsAll");
	register_clcmd( "say_team /showskill", "ClCmdSayPointsAll");

	g_iCvar[ EnableBombEvents ] = register_cvar( "points_bombevents_rewards", "1" );
	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", "1" );
	g_iCvar[ PointsBombDefused ] = register_cvar( "points_bomb_defused", "1" );

	new DataDir[ 64 ];
	get_datadir( DataDir, 63 );
	format( File, 127, "%s/Puncte.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_bombevents_rewards ^"1^" // 0: Dezactivat | 1: Activat -> Puncte obtinute pe plantarea/dezamorsarea/explodearea bombei" );
		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 ^"1^" // Cate puncte sa primesti pe explodarea bombei" );
		write_file( szWriteCvarsPoints, "points_bomb_defused ^"1^" // Cate puncte sa primesti pe dezamorsarea bombei" );
	}
}

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 )
{
	if(is_user_steam(id))
	{
		return g_iUserPoints[ id ];
	}
	return PLUGIN_CONTINUE;
}

public native_set_user_points( id, points )
{
	if(is_user_steam(id))
	{
		g_iUserPoints[ id ] = points;
	}
	return PLUGIN_CONTINUE;
}

public client_putinserver( id )
{
    	if(is_user_steam(id))
	{
		LoadUserPoints( id );
	}
	return PLUGIN_CONTINUE;
}

public client_disconnect( id )
{
    	if(is_user_steam(id))
	{
		SaveUserPoints( id );
	}
	return PLUGIN_CONTINUE;
}

public event_DeathMsg( )
{
    	new iKiller = read_data( 1 );
	new iVictim = read_data( 2 );
	new iHeadshot = read_data( 3 );
	if(is_user_steamk(iKiller))
	{
		if( !is_user_connected( iKiller ) || !is_user_connected( iVictim ) )
		{
			return 0;
		}

		if( iKiller == iVictim )
		{
			return 0;
		}
		
		if( iHeadshot )
		{
			g_iUserPoints[iKiller] += get_pcvar_num( g_iCvar[ PointsPerHS ] );
			if(is_user_steamv(iVictim))
			{
				g_iUserPoints[iVictim] -= 2;
			}
		}

		else
		{
			g_iUserPoints[iKiller]++;
			if(is_user_steamv(iVictim))
			{
				g_iUserPoints[iVictim]--;
			}
		}
	}
	return 1;
}

public ClCmdSayPoints( id )
{
	if(is_user_steam(id))
	{
		ColorChat( id, TEAM_COLOR, "^x04%s^x01 Ai %i puncte", g_szTag, g_iUserPoints[id]);
	}
	else
	{
	    ColorChat(id, TEAM_COLOR, "^x04%s^x01 Nu ai^x03 Steam^x01 acest sistem este doar steam only.", g_szTag);
	}
	return PLUGIN_CONTINUE;
}

public ClCmdSayPointsAll( id )
{
	if(is_user_steam(id))
	{
		ColorChat(0, TEAM_COLOR, "^x04%s^x01 %s are %i puncte, Skill:^x03 Silver II", g_szTag, get_name(id), g_iUserPoints[id]);
	}
	else
	{
	    ColorChat(id, TEAM_COLOR, "^x04%s^x01 Nu ai^x03 Steam^x01 acest sistem este doar steam only.", g_szTag);
	}
	return PLUGIN_CONTINUE;
}

public bomb_planted( id )
{
    	if(is_user_steam(id))
	{
		if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )
			return PLUGIN_CONTINUE;

		g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombPlanted ] );
	}
	return PLUGIN_CONTINUE;
}

public bomb_explode( id )
{
    	if(is_user_steam(id))
	{
		if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )
			return PLUGIN_CONTINUE;

		g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombExploded ] );
	}
	return PLUGIN_CONTINUE;
}

public bomb_defused( id )
{
    	if(is_user_steam(id))
	{
		if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )
			return PLUGIN_CONTINUE;

		g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombDefused ] );
	}
	return PLUGIN_CONTINUE;
}

public SaveUserPoints( id )
{
	new AuthID[ 32 ];
	get_user_authid( id , AuthID , 31 ) ;

	static Data[ 1024 ];
	formatex( Data, sizeof( Data ) - 1, "^"%i^"", g_iUserPoints[ id ] );

	new Save[ 512 ];
	format( Save, 511, "^"%s^" %s", AuthID, 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, AuthID ) ) {

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

		Linie++;
	}

	fclose( FileOpen );

	if( !IsPlayer )
	{

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

public LoadUserPoints( id )
{
	new AuthID[ 32 ];
	get_user_authid( id , AuthID , 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, AuthID ) ) {

			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;
}
stock bool:is_user_steam(id)
{
	static dp_pointer;

	if (dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
	{
		server_cmd("dp_clientinfo %d", id);
		server_exec();
		return (get_pcvar_num(dp_pointer) == 2) ? true : false;
	}

	return false;
}
stock bool:is_user_steamk(iKiller)
{
	static dp_pointer;

	if (dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
	{
		server_cmd("dp_clientinfo %d", iKiller);
		server_exec();
		return (get_pcvar_num(dp_pointer) == 2) ? true : false;
	}

	return false;
}
stock bool:is_user_steamv(iVictim)
{
	static dp_pointer;

	if (dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
	{
		server_cmd("dp_clientinfo %d", iVictim);
		server_exec();
		return (get_pcvar_num(dp_pointer) == 2) ? true : false;
	}

	return false;
}
RoyalServer 2
User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3844
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 594 times
Contact:

25 Oct 2018, 20:26

| Afiseaza codul
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >
#include < 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 	"Sistem de puncte"
#define PLUGIN_VERSION 	"0.1"
#define PLUGIN_AUTHOR 	"A Demon God"

new const g_szTag[ ] = "[M3S]";

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 ];

enum _:iCvars {

	EnableBombEvents,
	PointsPerHS,
	PointsBombPlanted,
	PointsBombExploded,
	PointsBombDefused,
	AddPointsNewRound,
};
new g_iCvar[ iCvars ];



#define INFO_ZERO 0
#define NTOP 15
#define TIME 60.0
new toppoints[33],topnames[33][33],topauth[33][33],Data[64];


public plugin_init( )
{
	register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );

	register_event( "DeathMsg", "event_DeathMsg", "a" );

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

	register_clcmd( "say /showskill", "ClCmdSayPointsAll");
	register_clcmd( "say_team /showskill", "ClCmdSayPointsAll");

	register_clcmd( "say /puncte", "TopPUNCTE");
	register_clcmd( "say_team /puncte", "TopPUNCTE");

	g_iCvar[ EnableBombEvents ] = register_cvar( "points_bombevents_rewards", "1" );
	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", "1" );
	g_iCvar[ PointsBombDefused ] = register_cvar( "points_bomb_defused", "1" );

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



	get_datadir(Data, 63);
	read_top();


}

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_bombevents_rewards ^"1^" // 0: Dezactivat | 1: Activat -> Puncte obtinute pe plantarea/dezamorsarea/explodearea bombei" );
		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 ^"1^" // Cate puncte sa primesti pe explodarea bombei" );
		write_file( szWriteCvarsPoints, "points_bomb_defused ^"1^" // Cate puncte sa primesti pe dezamorsarea bombei" );
	}
}

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 )
{
	if(is_user_steam(id))
	{
		return g_iUserPoints[ id ];
	}
	return PLUGIN_CONTINUE;
}

public native_set_user_points( id, points )
{
	if(is_user_steam(id))
	{
		g_iUserPoints[ id ] = points;
	}
	return PLUGIN_CONTINUE;
}

public client_putinserver( id )
{
    	if(is_user_steam(id))
	{
		LoadUserPoints( id );
	}
	if(!is_user_bot(id)) {
		set_task(TIME,"RefreshTime",id,_,_,"b",0);
	}
	return PLUGIN_CONTINUE;
}


public RefreshTime(id) {
	checkandupdatetop(id,g_iUserPoints[id]);
	return PLUGIN_HANDLED;
}


public client_disconnect( id )
{
    	if(is_user_steam(id))
	{
		SaveUserPoints( id );
	}
	return PLUGIN_CONTINUE;
}


public save_top() {
	new path[128];
	formatex(path, 127, "%s/TopPuncte.dat", Data);
	if( file_exists(path) ) {
		delete_file(path);
	}
	new Buffer[256];
	new f = fopen(path, "at");
	for(new i = INFO_ZERO; i < NTOP; i++)
	{
		formatex(Buffer, 255, "^"%s^" ^"%s^" ^"%d^"^n",topnames,topauth, toppoints );
		fputs(f, Buffer);
	}
	fclose(f);
}
public checkandupdatetop(id, points) {	

	new authid[35],name[32];
	get_user_name(id, name, 31);
	get_user_authid(id, authid ,34);
	for (new i = INFO_ZERO; i < NTOP; i++)
	{
		if( points > toppoints)
		{
			new pos = i;	
			while( !equal(topnames[pos],name) && pos < NTOP )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(topauth[j], 31, topauth[j-1]);
				formatex(topnames[j], 31, topnames[j-1]);
				toppoints[j] = toppoints[j-1];
				
			}
			formatex(topauth, 31, authid);
			formatex(topnames, 31, name);
			
			toppoints= points;
			ColorChat(0, BLUE,"^4%s^3 %s^1 este pe locul^4 %i^1 in Top Puncte, cu^3 %d^1 punct%s.", g_szTag, name,(i+1),points,points == 1 ? "" : "e");
			save_top();
			break;
		}
		else if( equal(topnames, name)) 
		break;	
	}
}
public read_top() {
	new Buffer[256],path[128];
	formatex(path, 127, "%s/TopPuncte.dat", Data);
	
	new f = fopen(path, "rt" ),i = INFO_ZERO;
	while( !feof(f) && i < NTOP+1)
	{
		fgets(f, Buffer, 255);
		new points[25];
		parse(Buffer, topnames, 31, topauth, 31,  points, 25);
		toppoints[i]= str_to_num(points);
		
		i++;
	}
	fclose(f);
}
public TopPUNCTE(id)
{
	new loc1 = get_statsnum();
	new loc2 = get_statsnum();
	new loc3 = get_statsnum();
	new loc4 = get_statsnum();
	new loc5 = get_statsnum();
	new loc6 = get_statsnum();
	new loc7 = get_statsnum();
	new loc8 = get_statsnum();
	new iMax = get_statsnum();


	static buffer[2368], name[135], len=0;
	len = format(buffer, 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{border-style:solid;border-width:1px;border-color:#FFFFFF;font-size:13px}</STYLE><table align=center width=100%% cellpadding=2 cellspacing=0");
	len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#52697B><th width=4%% > # <th width=24%%> Nume Jucator <th width=24%%>SteamID <th width=24%%> Puncte");	

	if(iMax>NTOP)	iMax=NTOP

	loc1=1
	loc2=2
	loc3=3
	loc4=4
	loc5=5
	loc6=6
	loc7=7
	loc8=8

	for (new i = 0; i < loc1 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=red> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 1; i < loc2 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=blue> %s </font><td> %s<td> %d</font>", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 2; i < loc3 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=yellow> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 3; i < loc4 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=orange> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 4; i < loc5 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=pink> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 5; i < loc6 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=purple> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 6; i < loc7 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=green> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 7; i < loc8 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=violet> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}



	for (new i = 8; i < iMax && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td> %s <td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	len += format(buffer[len], 2367-len, "</table>");
	//len += format(buffer[len], 2367-len, "<tr align=bottom font-size:11px><Center><br><br>Primii %d Jucatori Cu Cele Mai Multe Puncte Acumulate</Center>",NTOP);
	static strin[125];
	format(strin,124, "Top %d PUNCTE",NTOP);
	show_motd(id, buffer, strin);
}



public event_DeathMsg( )
{
    	new iKiller = read_data( 1 );
	new iVictim = read_data( 2 );
	new iHeadshot = read_data( 3 );
	if(is_user_steamk(iKiller))
	{
		if( !is_user_connected( iKiller ) || !is_user_connected( iVictim ) )
		{
			return 0;
		}

		if( iKiller == iVictim )
		{
			return 0;
		}
		
		if( iHeadshot )
		{
			g_iUserPoints[iKiller] += get_pcvar_num( g_iCvar[ PointsPerHS ] );
			if(is_user_steamv(iVictim))
			{
				g_iUserPoints[iVictim] -= 2;
			}
		}

		else
		{
			g_iUserPoints[iKiller]++;
			if(is_user_steamv(iVictim))
			{
				g_iUserPoints[iVictim]--;
			}
		}
	}
	return 1;
}

public ClCmdSayPoints( id )
{
	if(is_user_steam(id))
	{
		ColorChat( id, TEAM_COLOR, "^x04%s^x01 Ai %i puncte", g_szTag, g_iUserPoints[id]);
	}
	else
	{
	    ColorChat(id, TEAM_COLOR, "^x04%s^x01 Nu ai^x03 Steam^x01 acest sistem este doar steam only.", g_szTag);
	}
	return PLUGIN_CONTINUE;
}

public ClCmdSayPointsAll( id )
{
	if(is_user_steam(id))
	{
		ColorChat(0, TEAM_COLOR, "^x04%s^x01 %s are %i puncte, Skill:^x03 Silver II", g_szTag, get_name(id), g_iUserPoints[id]);
	}
	else
	{
	    ColorChat(id, TEAM_COLOR, "^x04%s^x01 Nu ai^x03 Steam^x01 acest sistem este doar steam only.", g_szTag);
	}
	return PLUGIN_CONTINUE;
}

public bomb_planted( id )
{
    	if(is_user_steam(id))
	{
		if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )
			return PLUGIN_CONTINUE;

		g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombPlanted ] );
	}
	return PLUGIN_CONTINUE;
}

public bomb_explode( id )
{
    	if(is_user_steam(id))
	{
		if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )
			return PLUGIN_CONTINUE;

		g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombExploded ] );
	}
	return PLUGIN_CONTINUE;
}

public bomb_defused( id )
{
    	if(is_user_steam(id))
	{
		if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )
			return PLUGIN_CONTINUE;

		g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombDefused ] );
	}
	return PLUGIN_CONTINUE;
}

public SaveUserPoints( id )
{
	new AuthID[ 32 ];
	get_user_name( id , AuthID , 31 ) ;

	static Data[ 1024 ];
	formatex( Data, sizeof( Data ) - 1, "^"%i^"", g_iUserPoints[ id ] );

	new Save[ 512 ];
	format( Save, 511, "^"%s^" %s", AuthID, 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, AuthID ) ) {

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

		Linie++;
	}

	fclose( FileOpen );

	if( !IsPlayer )
	{

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

public LoadUserPoints( id )
{
	new AuthID[ 32 ];
	get_user_name( id , AuthID , 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, AuthID ) ) {

			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;
}
stock bool:is_user_steam(id)
{
	static dp_pointer;

	if (dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
	{
		server_cmd("dp_clientinfo %d", id);
		server_exec();
		return (get_pcvar_num(dp_pointer) == 2) ? true : false;
	}

	return false;
}
stock bool:is_user_steamk(iKiller)
{
	static dp_pointer;

	if (dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
	{
		server_cmd("dp_clientinfo %d", iKiller);
		server_exec();
		return (get_pcvar_num(dp_pointer) == 2) ? true : false;
	}

	return false;
}
stock bool:is_user_steamv(iVictim)
{
	static dp_pointer;

	if (dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
	{
		server_cmd("dp_clientinfo %d", iVictim);
		server_exec();
		return (get_pcvar_num(dp_pointer) == 2) ? true : false;
	}

	return false;
}
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
User avatar
*Max3Semne*
Membru, skill +2
Membru, skill +2
Posts: 869
Joined: 29 Nov 2011, 19:45
Detinator Steam: Da
Detinator server CS: cs.max3semne.ro
SteamID: max3semne0
Has thanked: 25 times
Been thanked: 4 times

25 Oct 2018, 23:01

functioneaza si pentru cei non-steam?
User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3844
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 594 times
Contact:

26 Oct 2018, 01:10

eu am adăugat topul, și salvarea pe nume, atât ai specificat
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
User avatar
*Max3Semne*
Membru, skill +2
Membru, skill +2
Posts: 869
Joined: 29 Nov 2011, 19:45
Detinator Steam: Da
Detinator server CS: cs.max3semne.ro
SteamID: max3semne0
Has thanked: 25 times
Been thanked: 4 times

26 Oct 2018, 01:41

Adryyy wrote:eu am adăugat topul, și salvarea pe nume, atât ai specificat
ai putea modifica sa poate sa functioneze si pentru cei fara steam?
Filiq_
Utilizator neserios
Utilizator neserios
Posts: 847
Joined: 02 Nov 2014, 18:21
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Reputatie: Fost Scripter eXtreamCS
Utilizator neserios
Fond eXtream: 0
Location: Constanta
Has thanked: 40 times
Been thanked: 30 times

26 Oct 2018, 11:01

*Max3Semne* wrote:
Adryyy wrote:eu am adăugat topul, și salvarea pe nume, atât ai specificat
ai putea modifica sa poate sa functioneze si pentru cei fara steam?
| Afiseaza codul
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >
#include < 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 	"Sistem de puncte"
#define PLUGIN_VERSION 	"0.1"
#define PLUGIN_AUTHOR 	"A Demon God"

new const g_szTag[ ] = "[M3S]";

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 ];

enum _:iCvars {

	EnableBombEvents,
	PointsPerHS,
	PointsBombPlanted,
	PointsBombExploded,
	PointsBombDefused,
	AddPointsNewRound,
};
new g_iCvar[ iCvars ];



#define INFO_ZERO 0
#define NTOP 15
#define TIME 60.0
new toppoints[33],topnames[33][33],topauth[33][33],Data[64];


public plugin_init( )
{
	register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );

	register_event( "DeathMsg", "event_DeathMsg", "a" );

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

	register_clcmd( "say /showskill", "ClCmdSayPointsAll");
	register_clcmd( "say_team /showskill", "ClCmdSayPointsAll");

	register_clcmd( "say /puncte", "TopPUNCTE");
	register_clcmd( "say_team /puncte", "TopPUNCTE");

	g_iCvar[ EnableBombEvents ] = register_cvar( "points_bombevents_rewards", "1" );
	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", "1" );
	g_iCvar[ PointsBombDefused ] = register_cvar( "points_bomb_defused", "1" );

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



	get_datadir(Data, 63);
	read_top();


}

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_bombevents_rewards ^"1^" // 0: Dezactivat | 1: Activat -> Puncte obtinute pe plantarea/dezamorsarea/explodearea bombei" );
		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 ^"1^" // Cate puncte sa primesti pe explodarea bombei" );
		write_file( szWriteCvarsPoints, "points_bomb_defused ^"1^" // Cate puncte sa primesti pe dezamorsarea bombei" );
	}
}

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 ) g_iUserPoints[ id ];  

public native_set_user_points( id, points ) g_iUserPoints[ id ] = points; 

public client_putinserver( id )
{ 
	LoadUserPoints( id ); 

	if(!is_user_bot(id)) {
		set_task(TIME,"RefreshTime",id,_,_,"b",0);
	}
}


public RefreshTime(id) {
	checkandupdatetop(id,g_iUserPoints[id]);
	return PLUGIN_HANDLED;
}


public client_disconnect( id )
{ 
	SaveUserPoints( id ); 
}


public save_top() {
	new path[128];
	formatex(path, 127, "%s/TopPuncte.dat", Data);
	if( file_exists(path) ) {
		delete_file(path);
	}
	new Buffer[256];
	new f = fopen(path, "at");
	for(new i = INFO_ZERO; i < NTOP; i++)
	{
		formatex(Buffer, 255, "^"%s^" ^"%s^" ^"%d^"^n",topnames,topauth, toppoints );
		fputs(f, Buffer);
	}
	fclose(f);
}
public checkandupdatetop(id, points) {	

	new authid[35],name[32];
	get_user_name(id, name, 31);
	get_user_authid(id, authid ,34);
	for (new i = INFO_ZERO; i < NTOP; i++)
	{
		if( points > toppoints)
		{
			new pos = i;	
			while( !equal(topnames[pos],name) && pos < NTOP )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(topauth[j], 31, topauth[j-1]);
				formatex(topnames[j], 31, topnames[j-1]);
				toppoints[j] = toppoints[j-1];
				
			}
			formatex(topauth, 31, authid);
			formatex(topnames, 31, name);
			
			toppoints= points;
			ColorChat(0, BLUE,"^4%s^3 %s^1 este pe locul^4 %i^1 in Top Puncte, cu^3 %d^1 punct%s.", g_szTag, name,(i+1),points,points == 1 ? "" : "e");
			save_top();
			break;
		}
		else if( equal(topnames, name)) 
		break;	
	}
}
public read_top() {
	new Buffer[256],path[128];
	formatex(path, 127, "%s/TopPuncte.dat", Data);
	
	new f = fopen(path, "rt" ),i = INFO_ZERO;
	while( !feof(f) && i < NTOP+1)
	{
		fgets(f, Buffer, 255);
		new points[25];
		parse(Buffer, topnames, 31, topauth, 31,  points, 25);
		toppoints[i]= str_to_num(points);
		
		i++;
	}
	fclose(f);
}
public TopPUNCTE(id)
{
	new loc1 = get_statsnum();
	new loc2 = get_statsnum();
	new loc3 = get_statsnum();
	new loc4 = get_statsnum();
	new loc5 = get_statsnum();
	new loc6 = get_statsnum();
	new loc7 = get_statsnum();
	new loc8 = get_statsnum();
	new iMax = get_statsnum();


	static buffer[2368], name[135], len=0;
	len = format(buffer, 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{border-style:solid;border-width:1px;border-color:#FFFFFF;font-size:13px}</STYLE><table align=center width=100%% cellpadding=2 cellspacing=0");
	len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#52697B><th width=4%% > # <th width=24%%> Nume Jucator <th width=24%%>SteamID <th width=24%%> Puncte");	

	if(iMax>NTOP)	iMax=NTOP

	loc1=1
	loc2=2
	loc3=3
	loc4=4
	loc5=5
	loc6=6
	loc7=7
	loc8=8

	for (new i = 0; i < loc1 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=red> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 1; i < loc2 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=blue> %s </font><td> %s<td> %d</font>", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 2; i < loc3 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=yellow> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 3; i < loc4 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=orange> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 4; i < loc5 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=pink> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 5; i < loc6 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=purple> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 6; i < loc7 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=green> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 7; i < loc8 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=violet> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}



	for (new i = 8; i < iMax && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td> %s <td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	len += format(buffer[len], 2367-len, "</table>");
	//len += format(buffer[len], 2367-len, "<tr align=bottom font-size:11px><Center><br><br>Primii %d Jucatori Cu Cele Mai Multe Puncte Acumulate</Center>",NTOP);
	static strin[125];
	format(strin,124, "Top %d PUNCTE",NTOP);
	show_motd(id, buffer, strin);
}



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 0;
	}

	if( iKiller == iVictim )
	{
		return 0;
	}
	
	if( iHeadshot )
	{
		g_iUserPoints[iKiller] += get_pcvar_num( g_iCvar[ PointsPerHS ] ); 
		g_iUserPoints[iVictim] -= 2; 
	}

	else
	{
		g_iUserPoints[iKiller]++; 
		g_iUserPoints[iVictim]--; 
	} 
	return 1;
}

public ClCmdSayPoints( id )
{
	ColorChat( id, TEAM_COLOR, "^x04%s^x01 Ai %i puncte", g_szTag, g_iUserPoints[id]); 
}

public ClCmdSayPointsAll( id )
{
	ColorChat(0, TEAM_COLOR, "^x04%s^x01 %s are %i puncte, Skill:^x03 Silver II", g_szTag, get_name(id), g_iUserPoints[id]);
}

public bomb_planted( id )
{
	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )
		return PLUGIN_CONTINUE;

	g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombPlanted ] );

	return PLUGIN_CONTINUE;
}

public bomb_explode( id )
{
	
	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )
		return PLUGIN_CONTINUE;

	g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombExploded ] );

	return PLUGIN_CONTINUE;
}

public bomb_defused( id )
{
	 
	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )
		return PLUGIN_CONTINUE;

	g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombDefused ] ); 

	return PLUGIN_CONTINUE;
}

public SaveUserPoints( id )
{
	new AuthID[ 32 ];
	get_user_name( id , AuthID , 31 ) ;

	static Data[ 1024 ];
	formatex( Data, sizeof( Data ) - 1, "^"%i^"", g_iUserPoints[ id ] );

	new Save[ 512 ];
	format( Save, 511, "^"%s^" %s", AuthID, 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, AuthID ) ) {

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

		Linie++;
	}

	fclose( FileOpen );

	if( !IsPlayer )
	{

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

public LoadUserPoints( id )
{
	new AuthID[ 32 ];
	get_user_name( id , AuthID , 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, AuthID ) ) {

			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;
}


done.
https://discord.gg/VABVdhXMrK ZM CSO server in working..
User avatar
*Max3Semne*
Membru, skill +2
Membru, skill +2
Posts: 869
Joined: 29 Nov 2011, 19:45
Detinator Steam: Da
Detinator server CS: cs.max3semne.ro
SteamID: max3semne0
Has thanked: 25 times
Been thanked: 4 times

27 Oct 2018, 18:05

Diversity wrote:
*Max3Semne* wrote:
Adryyy wrote:eu am adăugat topul, și salvarea pe nume, atât ai specificat
ai putea modifica sa poate sa functioneze si pentru cei fara steam?
| Afiseaza codul
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >
#include < 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 	"Sistem de puncte"
#define PLUGIN_VERSION 	"0.1"
#define PLUGIN_AUTHOR 	"A Demon God"

new const g_szTag[ ] = "[M3S]";

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 ];

enum _:iCvars {

	EnableBombEvents,
	PointsPerHS,
	PointsBombPlanted,
	PointsBombExploded,
	PointsBombDefused,
	AddPointsNewRound,
};
new g_iCvar[ iCvars ];



#define INFO_ZERO 0
#define NTOP 15
#define TIME 60.0
new toppoints[33],topnames[33][33],topauth[33][33],Data[64];


public plugin_init( )
{
	register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );

	register_event( "DeathMsg", "event_DeathMsg", "a" );

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

	register_clcmd( "say /showskill", "ClCmdSayPointsAll");
	register_clcmd( "say_team /showskill", "ClCmdSayPointsAll");

	register_clcmd( "say /puncte", "TopPUNCTE");
	register_clcmd( "say_team /puncte", "TopPUNCTE");

	g_iCvar[ EnableBombEvents ] = register_cvar( "points_bombevents_rewards", "1" );
	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", "1" );
	g_iCvar[ PointsBombDefused ] = register_cvar( "points_bomb_defused", "1" );

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



	get_datadir(Data, 63);
	read_top();


}

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_bombevents_rewards ^"1^" // 0: Dezactivat | 1: Activat -> Puncte obtinute pe plantarea/dezamorsarea/explodearea bombei" );
		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 ^"1^" // Cate puncte sa primesti pe explodarea bombei" );
		write_file( szWriteCvarsPoints, "points_bomb_defused ^"1^" // Cate puncte sa primesti pe dezamorsarea bombei" );
	}
}

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 ) g_iUserPoints[ id ];  

public native_set_user_points( id, points ) g_iUserPoints[ id ] = points; 

public client_putinserver( id )
{ 
	LoadUserPoints( id ); 

	if(!is_user_bot(id)) {
		set_task(TIME,"RefreshTime",id,_,_,"b",0);
	}
}


public RefreshTime(id) {
	checkandupdatetop(id,g_iUserPoints[id]);
	return PLUGIN_HANDLED;
}


public client_disconnect( id )
{ 
	SaveUserPoints( id ); 
}


public save_top() {
	new path[128];
	formatex(path, 127, "%s/TopPuncte.dat", Data);
	if( file_exists(path) ) {
		delete_file(path);
	}
	new Buffer[256];
	new f = fopen(path, "at");
	for(new i = INFO_ZERO; i < NTOP; i++)
	{
		formatex(Buffer, 255, "^"%s^" ^"%s^" ^"%d^"^n",topnames,topauth, toppoints );
		fputs(f, Buffer);
	}
	fclose(f);
}
public checkandupdatetop(id, points) {	

	new authid[35],name[32];
	get_user_name(id, name, 31);
	get_user_authid(id, authid ,34);
	for (new i = INFO_ZERO; i < NTOP; i++)
	{
		if( points > toppoints)
		{
			new pos = i;	
			while( !equal(topnames[pos],name) && pos < NTOP )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(topauth[j], 31, topauth[j-1]);
				formatex(topnames[j], 31, topnames[j-1]);
				toppoints[j] = toppoints[j-1];
				
			}
			formatex(topauth, 31, authid);
			formatex(topnames, 31, name);
			
			toppoints= points;
			ColorChat(0, BLUE,"^4%s^3 %s^1 este pe locul^4 %i^1 in Top Puncte, cu^3 %d^1 punct%s.", g_szTag, name,(i+1),points,points == 1 ? "" : "e");
			save_top();
			break;
		}
		else if( equal(topnames, name)) 
		break;	
	}
}
public read_top() {
	new Buffer[256],path[128];
	formatex(path, 127, "%s/TopPuncte.dat", Data);
	
	new f = fopen(path, "rt" ),i = INFO_ZERO;
	while( !feof(f) && i < NTOP+1)
	{
		fgets(f, Buffer, 255);
		new points[25];
		parse(Buffer, topnames, 31, topauth, 31,  points, 25);
		toppoints[i]= str_to_num(points);
		
		i++;
	}
	fclose(f);
}
public TopPUNCTE(id)
{
	new loc1 = get_statsnum();
	new loc2 = get_statsnum();
	new loc3 = get_statsnum();
	new loc4 = get_statsnum();
	new loc5 = get_statsnum();
	new loc6 = get_statsnum();
	new loc7 = get_statsnum();
	new loc8 = get_statsnum();
	new iMax = get_statsnum();


	static buffer[2368], name[135], len=0;
	len = format(buffer, 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{border-style:solid;border-width:1px;border-color:#FFFFFF;font-size:13px}</STYLE><table align=center width=100%% cellpadding=2 cellspacing=0");
	len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#52697B><th width=4%% > # <th width=24%%> Nume Jucator <th width=24%%>SteamID <th width=24%%> Puncte");	

	if(iMax>NTOP)	iMax=NTOP

	loc1=1
	loc2=2
	loc3=3
	loc4=4
	loc5=5
	loc6=6
	loc7=7
	loc8=8

	for (new i = 0; i < loc1 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=red> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 1; i < loc2 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=blue> %s </font><td> %s<td> %d</font>", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 2; i < loc3 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=yellow> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 3; i < loc4 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=orange> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 4; i < loc5 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=pink> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 5; i < loc6 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=purple> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 6; i < loc7 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=green> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 7; i < loc8 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=violet> %s </font><td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}



	for (new i = 8; i < iMax && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td> %s <td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	len += format(buffer[len], 2367-len, "</table>");
	//len += format(buffer[len], 2367-len, "<tr align=bottom font-size:11px><Center><br><br>Primii %d Jucatori Cu Cele Mai Multe Puncte Acumulate</Center>",NTOP);
	static strin[125];
	format(strin,124, "Top %d PUNCTE",NTOP);
	show_motd(id, buffer, strin);
}



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 0;
	}

	if( iKiller == iVictim )
	{
		return 0;
	}
	
	if( iHeadshot )
	{
		g_iUserPoints[iKiller] += get_pcvar_num( g_iCvar[ PointsPerHS ] ); 
		g_iUserPoints[iVictim] -= 2; 
	}

	else
	{
		g_iUserPoints[iKiller]++; 
		g_iUserPoints[iVictim]--; 
	} 
	return 1;
}

public ClCmdSayPoints( id )
{
	ColorChat( id, TEAM_COLOR, "^x04%s^x01 Ai %i puncte", g_szTag, g_iUserPoints[id]); 
}

public ClCmdSayPointsAll( id )
{
	ColorChat(0, TEAM_COLOR, "^x04%s^x01 %s are %i puncte, Skill:^x03 Silver II", g_szTag, get_name(id), g_iUserPoints[id]);
}

public bomb_planted( id )
{
	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )
		return PLUGIN_CONTINUE;

	g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombPlanted ] );

	return PLUGIN_CONTINUE;
}

public bomb_explode( id )
{
	
	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )
		return PLUGIN_CONTINUE;

	g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombExploded ] );

	return PLUGIN_CONTINUE;
}

public bomb_defused( id )
{
	 
	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )
		return PLUGIN_CONTINUE;

	g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombDefused ] ); 

	return PLUGIN_CONTINUE;
}

public SaveUserPoints( id )
{
	new AuthID[ 32 ];
	get_user_name( id , AuthID , 31 ) ;

	static Data[ 1024 ];
	formatex( Data, sizeof( Data ) - 1, "^"%i^"", g_iUserPoints[ id ] );

	new Save[ 512 ];
	format( Save, 511, "^"%s^" %s", AuthID, 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, AuthID ) ) {

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

		Linie++;
	}

	fclose( FileOpen );

	if( !IsPlayer )
	{

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

public LoadUserPoints( id )
{
	new AuthID[ 32 ];
	get_user_name( id , AuthID , 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, AuthID ) ) {

			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;
}


done.


salut,scuze de intarziere la-am testat si merge bine doar daca ai putea sa il faci top10 nu top15 pentru ca top15 nu merge apare doar top12 si pe al 12-lea loc nu apare nimic si daca ai putea sa-mi faci primele 3 locuri alte culori iti las eu codurile: locul 1: #ffcc00, locul 2: #bfbfbf si locul 3: #993300


in rest e super pluginul platesc daca e nevoie pentru deranj :D
User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3844
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 594 times
Contact:

27 Oct 2018, 18:27

dacă ești non-steam..e posibil că nu apară complet motd(mai ales dacă folosești engine vechi)
| Afiseaza codul
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < ColorChat >
#include < csx >

//#pragma semicolon 1

#define PLUGIN_NAME 	"Sistem de puncte"
#define PLUGIN_VERSION 	"0.1"
#define PLUGIN_AUTHOR 	"A Demon God" //top fcs & fix for non-steam by Adryyy

new const g_szTag[ ] = "[M3S]";

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 ];

enum _:iCvars {

	EnableBombEvents,
	PointsPerHS,
	PointsBombPlanted,
	PointsBombExploded,
	PointsBombDefused,
	AddPointsNewRound,
};
new g_iCvar[ iCvars ];



#define INFO_ZERO 0 // nu umbla
#define NTOP 10//nr pe pagina de top
#define TIME 60.0//timpul de refresh pentru top -> 60.0(secunde)=>1minut
new toppoints[33],topnames[33][33],topauth[33][33],Data[64];//nu umbla
new const CuloareLoc1[]="#ffcc00",CuloareLoc2[]="#bfbfbf",CuloareLoc3[]="#993300";


public plugin_init( )
{
	register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );

	register_event( "DeathMsg", "event_DeathMsg", "a" );

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

	register_clcmd( "say /showskill", "ClCmdSayPointsAll");
	register_clcmd( "say_team /showskill", "ClCmdSayPointsAll");


	register_clcmd( "say /puncte", "TopPUNCTE");
	register_clcmd( "say_team /puncte", "TopPUNCTE");


	g_iCvar[ EnableBombEvents ] = register_cvar( "points_bombevents_rewards", "1" );
	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", "1" );
	g_iCvar[ PointsBombDefused ] = register_cvar( "points_bomb_defused", "1" );

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


	get_datadir(Data, 63);
	read_top();


}

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_bombevents_rewards ^"1^" // 0: Dezactivat | 1: Activat -> Puncte obtinute pe plantarea/dezamorsarea/explodearea bombei" );
		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 ^"1^" // Cate puncte sa primesti pe explodarea bombei" );
		write_file( szWriteCvarsPoints, "points_bomb_defused ^"1^" // Cate puncte sa primesti pe dezamorsarea bombei" );
	}
}

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 )
{
	if((!is_user_bot(id)||!is_user_hltv(id))&&is_user_connected(id)) {
		LoadUserPoints( id )
		set_task(TIME,"RefreshTime",id,_,_,"b",0);
	}
}

public RefreshTime(id)	checkandupdatetop(id,g_iUserPoints[id]);


public client_disconnect( id )	SaveUserPoints( id );



public save_top() {
	new path[128];
	formatex(path, 127, "%s/TopPuncte.dat", Data);
	if( file_exists(path) ) {
		delete_file(path);
	}
	new Buffer[256];
	new f = fopen(path, "at");
	for(new i = INFO_ZERO; i < NTOP; i++)
	{
		formatex(Buffer, 255, "^"%s^" ^"%s^" ^"%d^"^n",topnames,topauth, toppoints );
		fputs(f, Buffer);
	}
	fclose(f);
}
public checkandupdatetop(id, points) {	

	new authid[35],name[32];
	get_user_name(id, name, 31);
	get_user_authid(id, authid ,34);
	for (new i = INFO_ZERO; i < NTOP; i++)
	{
		if( points > toppoints)
		{
			new pos = i;	
			while( !equal(topnames[pos],name) && pos < NTOP )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(topauth[j], 31, topauth[j-1]);
				formatex(topnames[j], 31, topnames[j-1]);
				toppoints[j] = toppoints[j-1];
				
			}
			formatex(topauth, 31, authid);
			formatex(topnames, 31, name);
			
			toppoints= points;
			ColorChat(0, BLUE,"^4%s^3 %s^1 este pe locul^4 %i^1 in Top Puncte, cu^3 %d^1 punct%s.", g_szTag, name,(i+1),points,points == 1 ? "" : "e");
			save_top();
			break;
		}
		else if( equal(topnames, name)) 
		break;	
	}
}
public read_top() {
	new Buffer[256],path[128];
	formatex(path, 127, "%s/TopPuncte.dat", Data);
	
	new f = fopen(path, "rt" ),i = INFO_ZERO;
	while( !feof(f) && i < NTOP+1)
	{
		fgets(f, Buffer, 255);
		new points[25];
		parse(Buffer, topnames, 31, topauth, 31,  points, 25);
		toppoints[i]= str_to_num(points);
		
		i++;
	}
	fclose(f);
}
public TopPUNCTE(id)
{
	new loc1 = get_statsnum();
	new loc2 = get_statsnum();
	new loc3 = get_statsnum();

	new iMax = get_statsnum();


	static buffer[2368], name[135], len//=0;
	//html+body
	len = format(buffer, 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{border-style:solid;border-width:1px;border-color:#FFFFFF;font-size:13px}</STYLE><table align=center width=100%% cellpadding=2 cellspacing=0>");
	len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#52697B><th width=4%% > # <th width=24%%> Nume Jucator <th width=24%%>SteamID <th width=24%%> Puncte");	

	if(iMax>NTOP)	iMax=NTOP

	loc1=1
	loc2=2
	loc3=3

	for (new i = 0; i < loc1 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=%s> %s </font><td> %s<td> %d", (i+1),CuloareLoc1, name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 1; i < loc2 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=%s> %s </font><td> %s<td> %d</font>", (i+1),CuloareLoc2, name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 2; i < loc3 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=%s> %s </font><td> %s<td> %d", (i+1),CuloareLoc3, name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 3; i < iMax && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td> %s <td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	len += format(buffer[len], 2367-len, "</table>");
	len += format(buffer[len], 2367-len, "<tr align=bottom font-size:11px><Center><br><br>Primii %d Jucatori Cu Cele Mai Multe Puncte Acumulate</Center>",NTOP);
	//len += format(buffer[len], 2367-len, "</body></html>");
	static strin[125];
	format(strin,124, "Top %d PUNCTE",NTOP);
	show_motd(id, buffer, strin);
}



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 ) || iKiller == iVictim )	return 0;
		
	if( iHeadshot )
	{
		g_iUserPoints[iKiller] += get_pcvar_num( g_iCvar[ PointsPerHS ] );
		if(g_iUserPoints[iVictim]>0)	g_iUserPoints[iVictim] -= 2;
	}
	else
	{
		g_iUserPoints[iKiller]++;
		if(g_iUserPoints[iVictim]>0)	g_iUserPoints[iVictim]--;
	}

	return 1;
}

public ClCmdSayPoints( id )	ColorChat( id, TEAM_COLOR, "^x04%s^x01 Ai %i puncte", g_szTag, g_iUserPoints[id]);
public ClCmdSayPointsAll( id )	ColorChat(0, TEAM_COLOR, "^x04%s^x01 %s are %i puncte, Skill:^x03 Silver II", g_szTag, get_name(id), g_iUserPoints[id]);

public bomb_planted( id )
{
	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )	return PLUGIN_CONTINUE;

	g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombPlanted ] );

	return PLUGIN_CONTINUE;
}

public bomb_explode( id )
{
	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )	return PLUGIN_CONTINUE;

	g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombExploded ] );

	return PLUGIN_CONTINUE;
}

public bomb_defused( id )
{
	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )	return PLUGIN_CONTINUE;

	g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombDefused ] );

	return PLUGIN_CONTINUE;
}

public SaveUserPoints( id )
{
	new AuthID[ 32 ];
	get_user_name( id , AuthID , 31 ) ;

	static Data[ 1024 ];
	formatex( Data, sizeof( Data ) - 1, "^"%i^"", g_iUserPoints[ id ] );

	new Save[ 512 ];
	format( Save, 511, "^"%s^" %s", AuthID, 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, AuthID ) ) {

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

		Linie++;
	}

	fclose( FileOpen );

	if( !IsPlayer )
	{

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

public LoadUserPoints( id )
{
	new AuthID[ 32 ];
	get_user_name( id , AuthID , 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, AuthID ) ) {

			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;
}
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
User avatar
*Max3Semne*
Membru, skill +2
Membru, skill +2
Posts: 869
Joined: 29 Nov 2011, 19:45
Detinator Steam: Da
Detinator server CS: cs.max3semne.ro
SteamID: max3semne0
Has thanked: 25 times
Been thanked: 4 times

27 Oct 2018, 20:22

Adryyy wrote:dacă ești non-steam..e posibil că nu apară complet motd(mai ales dacă folosești engine vechi)
| Afiseaza codul
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < ColorChat >
#include < csx >

//#pragma semicolon 1

#define PLUGIN_NAME 	"Sistem de puncte"
#define PLUGIN_VERSION 	"0.1"
#define PLUGIN_AUTHOR 	"A Demon God" //top fcs & fix for non-steam by Adryyy

new const g_szTag[ ] = "[M3S]";

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 ];

enum _:iCvars {

	EnableBombEvents,
	PointsPerHS,
	PointsBombPlanted,
	PointsBombExploded,
	PointsBombDefused,
	AddPointsNewRound,
};
new g_iCvar[ iCvars ];



#define INFO_ZERO 0 // nu umbla
#define NTOP 10//nr pe pagina de top
#define TIME 60.0//timpul de refresh pentru top -> 60.0(secunde)=>1minut
new toppoints[33],topnames[33][33],topauth[33][33],Data[64];//nu umbla
new const CuloareLoc1[]="#ffcc00",CuloareLoc2[]="#bfbfbf",CuloareLoc3[]="#993300";


public plugin_init( )
{
	register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );

	register_event( "DeathMsg", "event_DeathMsg", "a" );

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

	register_clcmd( "say /showskill", "ClCmdSayPointsAll");
	register_clcmd( "say_team /showskill", "ClCmdSayPointsAll");


	register_clcmd( "say /puncte", "TopPUNCTE");
	register_clcmd( "say_team /puncte", "TopPUNCTE");


	g_iCvar[ EnableBombEvents ] = register_cvar( "points_bombevents_rewards", "1" );
	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", "1" );
	g_iCvar[ PointsBombDefused ] = register_cvar( "points_bomb_defused", "1" );

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


	get_datadir(Data, 63);
	read_top();


}

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_bombevents_rewards ^"1^" // 0: Dezactivat | 1: Activat -> Puncte obtinute pe plantarea/dezamorsarea/explodearea bombei" );
		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 ^"1^" // Cate puncte sa primesti pe explodarea bombei" );
		write_file( szWriteCvarsPoints, "points_bomb_defused ^"1^" // Cate puncte sa primesti pe dezamorsarea bombei" );
	}
}

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 )
{
	if((!is_user_bot(id)||!is_user_hltv(id))&&is_user_connected(id)) {
		LoadUserPoints( id )
		set_task(TIME,"RefreshTime",id,_,_,"b",0);
	}
}

public RefreshTime(id)	checkandupdatetop(id,g_iUserPoints[id]);


public client_disconnect( id )	SaveUserPoints( id );



public save_top() {
	new path[128];
	formatex(path, 127, "%s/TopPuncte.dat", Data);
	if( file_exists(path) ) {
		delete_file(path);
	}
	new Buffer[256];
	new f = fopen(path, "at");
	for(new i = INFO_ZERO; i < NTOP; i++)
	{
		formatex(Buffer, 255, "^"%s^" ^"%s^" ^"%d^"^n",topnames,topauth, toppoints );
		fputs(f, Buffer);
	}
	fclose(f);
}
public checkandupdatetop(id, points) {	

	new authid[35],name[32];
	get_user_name(id, name, 31);
	get_user_authid(id, authid ,34);
	for (new i = INFO_ZERO; i < NTOP; i++)
	{
		if( points > toppoints)
		{
			new pos = i;	
			while( !equal(topnames[pos],name) && pos < NTOP )
			{
				pos++;
			}
			
			for (new j = pos; j > i; j--)
			{
				formatex(topauth[j], 31, topauth[j-1]);
				formatex(topnames[j], 31, topnames[j-1]);
				toppoints[j] = toppoints[j-1];
				
			}
			formatex(topauth, 31, authid);
			formatex(topnames, 31, name);
			
			toppoints= points;
			ColorChat(0, BLUE,"^4%s^3 %s^1 este pe locul^4 %i^1 in Top Puncte, cu^3 %d^1 punct%s.", g_szTag, name,(i+1),points,points == 1 ? "" : "e");
			save_top();
			break;
		}
		else if( equal(topnames, name)) 
		break;	
	}
}
public read_top() {
	new Buffer[256],path[128];
	formatex(path, 127, "%s/TopPuncte.dat", Data);
	
	new f = fopen(path, "rt" ),i = INFO_ZERO;
	while( !feof(f) && i < NTOP+1)
	{
		fgets(f, Buffer, 255);
		new points[25];
		parse(Buffer, topnames, 31, topauth, 31,  points, 25);
		toppoints[i]= str_to_num(points);
		
		i++;
	}
	fclose(f);
}
public TopPUNCTE(id)
{
	new loc1 = get_statsnum();
	new loc2 = get_statsnum();
	new loc3 = get_statsnum();

	new iMax = get_statsnum();


	static buffer[2368], name[135], len//=0;
	//html+body
	len = format(buffer, 2367-len,"<STYLE>body{background:#232323;color:#cfcbc2;font-family:sans-serif}table{border-style:solid;border-width:1px;border-color:#FFFFFF;font-size:13px}</STYLE><table align=center width=100%% cellpadding=2 cellspacing=0>");
	len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#52697B><th width=4%% > # <th width=24%%> Nume Jucator <th width=24%%>SteamID <th width=24%%> Puncte");	

	if(iMax>NTOP)	iMax=NTOP

	loc1=1
	loc2=2
	loc3=3

	for (new i = 0; i < loc1 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=%s> %s </font><td> %s<td> %d", (i+1),CuloareLoc1, name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 1; i < loc2 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=%s> %s </font><td> %s<td> %d</font>", (i+1),CuloareLoc2, name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 2; i < loc3 && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td><font color=%s> %s </font><td> %s<td> %d", (i+1),CuloareLoc3, name,topauth[i], toppoints[i]);
		}
	}

	for (new i = 3; i < iMax && 2367-len > 0; i++)
	{
		if( toppoints[i] == 0) {
			len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#232323><td> %d <td> %s <td> %s<td> %s", (i+1), "-", "-", "-");
			//i = NTOP
		}
		else
		{
		name = topnames[i];
		while( containi(name, "<") != -1 )	replace(name, 31, "<", "<");
		while( containi(name, ">") != -1 )	replace(name, 31, ">", ">");

		len += format(buffer[len], 2367-len, "<tr align=center bgcolor=#2D2D2D><td> %d <td> %s <td> %s<td> %d", (i+1), name,topauth[i], toppoints[i]);
		}
	}

	len += format(buffer[len], 2367-len, "</table>");
	len += format(buffer[len], 2367-len, "<tr align=bottom font-size:11px><Center><br><br>Primii %d Jucatori Cu Cele Mai Multe Puncte Acumulate</Center>",NTOP);
	//len += format(buffer[len], 2367-len, "</body></html>");
	static strin[125];
	format(strin,124, "Top %d PUNCTE",NTOP);
	show_motd(id, buffer, strin);
}



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 ) || iKiller == iVictim )	return 0;
		
	if( iHeadshot )
	{
		g_iUserPoints[iKiller] += get_pcvar_num( g_iCvar[ PointsPerHS ] );
		if(g_iUserPoints[iVictim]>0)	g_iUserPoints[iVictim] -= 2;
	}
	else
	{
		g_iUserPoints[iKiller]++;
		if(g_iUserPoints[iVictim]>0)	g_iUserPoints[iVictim]--;
	}

	return 1;
}

public ClCmdSayPoints( id )	ColorChat( id, TEAM_COLOR, "^x04%s^x01 Ai %i puncte", g_szTag, g_iUserPoints[id]);
public ClCmdSayPointsAll( id )	ColorChat(0, TEAM_COLOR, "^x04%s^x01 %s are %i puncte, Skill:^x03 Silver II", g_szTag, get_name(id), g_iUserPoints[id]);

public bomb_planted( id )
{
	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )	return PLUGIN_CONTINUE;

	g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombPlanted ] );

	return PLUGIN_CONTINUE;
}

public bomb_explode( id )
{
	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )	return PLUGIN_CONTINUE;

	g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombExploded ] );

	return PLUGIN_CONTINUE;
}

public bomb_defused( id )
{
	if( get_pcvar_num( g_iCvar[ EnableBombEvents ] ) == 0 || !is_user_connected( id ) )	return PLUGIN_CONTINUE;

	g_iUserPoints[ id ] += get_pcvar_num( g_iCvar[ PointsBombDefused ] );

	return PLUGIN_CONTINUE;
}

public SaveUserPoints( id )
{
	new AuthID[ 32 ];
	get_user_name( id , AuthID , 31 ) ;

	static Data[ 1024 ];
	formatex( Data, sizeof( Data ) - 1, "^"%i^"", g_iUserPoints[ id ] );

	new Save[ 512 ];
	format( Save, 511, "^"%s^" %s", AuthID, 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, AuthID ) ) {

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

		Linie++;
	}

	fclose( FileOpen );

	if( !IsPlayer )
	{

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

public LoadUserPoints( id )
{
	new AuthID[ 32 ];
	get_user_name( id , AuthID , 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, AuthID ) ) {

			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;
}



merge multumesc
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests