Jump to content
Sign in to follow this  
rzeRO

[REZOLVAT] [Cerere] Plugin Statsx.amxx colorat

Recommended Posts

Nume: statsx.amxx


Versiune: nu conteaza


Descriere detaliata: As dori un plugin statsx.amxx colorat, cand scriu /rank sa-mi apara colorat gen, cred ca stiti la ce ma refer.


 


Share this post


Link to post
Share on other sites

Incearca asta : 

#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#include <csx>

#pragma semicolon 1

new gNum;
new cvar_rank, cvar_rankstats, cvar_top, cvar_topnum, cvar_title, cvar_connect;

public plugin_init() {
	register_plugin("RRT", "0.3.1", "Ex3cuTioN/Arion");
	
	register_clcmd("say", "hook_say");
	register_clcmd("say_team", "hook_say");
	
	register_clcmd("amx_rank", "cmdRank");
	register_clcmd("amx_rankstats", "cmdRankstats");
	
	cvar_top = register_cvar("rrt_top","1");
	cvar_rank = register_cvar("rrt_rank","1");
	cvar_rankstats = register_cvar("rrt_rankstats","1");
	cvar_topnum = register_cvar("rrt_topnum", "10");
	cvar_title = register_cvar("rrt_title", "Top jucatori");
	cvar_connect = register_cvar("rrt_connect", "1");
}

public hook_say(id) {
	static s_Args[192];
	
	read_args(s_Args, sizeof(s_Args) - 1);
	remove_quotes(s_Args);
	
	if(equal(s_Args, "/rank", 5) || equal(s_Args,"/rankstats",10)) {
		replace(s_Args, sizeof(s_Args) - 1, "/", "");
		client_cmd(id, "amx_%s", s_Args);
	}	
	
	if(equal(s_Args,"/top",4)) {
		if(get_pcvar_num(cvar_top) == 0) {
			ColorChat(id,GREEN,"[Top]^x01 Dezactivat.");
			return PLUGIN_HANDLED;
		}
		
		replace(s_Args,sizeof(s_Args) - 1,"/top","");
		gNum = str_to_num(s_Args);
		
		cmdTop15(id);
	}
	
	return PLUGIN_CONTINUE;
}

/*public client_putinserver(id) {
	new connect = get_pcvar_num(cvar_connect);
	
	if(connect == 0)
		return PLUGIN_HANDLED;
	
	new name[32], izStats[8], izBody[8], iRankPos, iRankMax;

	iRankMax = get_statsnum();
	iRankPos = get_user_stats(id, izStats, izBody);
	
	get_user_name(id, name, 31);
	
	if(connect == 2)
		ColorChat(0, GREEN,"[RZE]^x03 %s^x01 se conecteaza, rank %d din %d cu %d fraguri si %d decese.", name, iRankPos, iRankMax, izStats[0], izStats[1]);
	else if(connect == 1)
		ColorChat(0, GREEN,"[RZE]^x03 %s^x01 se conecteaza, rank %d din %d.", name, iRankPos, iRankMax);
	
	return PLUGIN_CONTINUE;
}*/

public client_disconnect(id){
	new connect = get_pcvar_num(cvar_connect);
	
	if(connect == 0) return PLUGIN_HANDLED;
	
	new name[32], izStats[8], izBody[8], iRankPos, iRankMax;

	iRankMax = get_statsnum();
	iRankPos = get_user_stats(id, izStats, izBody);
	get_user_name(id, name, 31);
	
	if(connect == 2)
		ColorChat(0, GREEN,"[RZE]^x03 %s^x01 a iesit, rank %d din %d cu %d fraguri si %d decese.", name, iRankPos, iRankMax, izStats[0], izStats[1]);
	else if(connect == 1)
		ColorChat(0, GREEN,"[RZE]^x03 %s^x01 a iesit, rank %d din %d.", name, iRankPos, iRankMax);
		
	return PLUGIN_CONTINUE;
}

public cmdRank(id) {
	new rrt_rank = get_pcvar_num(cvar_rank);
	
	if(rrt_rank == 0) {
		ColorChat(id, GREEN, "[Rank]^x01 Dezactivat.");
		return PLUGIN_HANDLED;
	}
	
	new izStats[8], izBody[8], iRankPos, iRankMax, name[32], arg[32];
	
	read_argv(1, arg, 31);
	iRankMax = get_statsnum();
	
	if(equali(arg, "")) {
		iRankPos = get_user_stats(id, izStats, izBody);
		
		get_user_name(id, name, 31);
		
		if(rrt_rank == 2)
			ColorChat(id, GREEN, "[Rank]^x03 %s,^x01 esti pe locul^x03 %d^x01 din^x03 %d^x01 cu^x03 %d^x01 fraguri si^x03 %d^x01 decese.",name,iRankPos,iRankMax,izStats[0],izStats[1]);
		else if(rrt_rank == 1)
			ColorChat(id, GREEN, "[Rank]^x03 %s,^x01 esti pe locul %d din %d",name, iRankPos, iRankMax);
		
		return PLUGIN_HANDLED;
	}
	new player = cmd_target(id, arg, 14);
	
	if(!is_user_connected(player) || !player) {
		ColorChat(id,GREEN,"[Rank]^x01 Acest jucator nu este conectat.");
		return PLUGIN_HANDLED;
	}

	iRankPos = get_user_stats(player, izStats, izBody);
	get_user_name(player, name, 31);
	
	if(rrt_rank == 2)
		ColorChat(id, GREEN, "[Rank]^x03 %s^x01 este pe locul^x03 %d^x01 din^x03 %d^x01 cu^x03 %d^x01 fraguri si^x03 %d^x01 decese.", name, iRankPos, iRankMax, izStats[0], izStats[1]);
	else if(rrt_rank == 1)
		ColorChat(id, GREEN, "[Rank]^x03 %s^x01 este pe locul %d din %d", name, iRankPos, iRankMax);
	
	return PLUGIN_HANDLED;
}

public cmdRankstats(id) {
	if(get_pcvar_num(cvar_rankstats) == 0) {
		ColorChat(id, GREEN, "[Rankstats]^x01 Dezactivat.");
		return PLUGIN_HANDLED;
	}
	
	static buffer[2368], name[32], len, arg[32], iRankPos, izStats[8], izBody[8];
	
	len = format(buffer[len], 2367-len, "<style>body{background:#112233;font-family:Arial}th{background:#2E2E2E;color:#FFF;padding:5px 2px;text-align:center}td{padding:5px 2px}table{width:50%%;background:#EEEECC;font-size:12px;}h2{color:#FFF;font-family:Verdana;text-align:center}#c{background:#E2E2BC}</style>");
	
	read_argv(1, arg, 31);
	new iRankMax = get_statsnum();
	
	if(equali(arg, "")) {
		iRankPos = get_user_stats(id, izStats, izBody);
		get_user_name(id, name, 31);
		len += format(buffer[len], 2367-len, "<h2>Esti pe locul %d din %d</h2>",iRankPos, iRankMax);
	}
	else {
		new player = cmd_target(id, arg, 14);
	
		if(!is_user_connected(player) || !player) {
			ColorChat(id, GREEN, "[Rank]^x01 Acest jucator nu este conectat.");
			return PLUGIN_HANDLED;
		}
		
		iRankPos = get_user_stats(player, izStats, izBody);
		get_user_name(player, name, 31);
		
		len += format(buffer[len], 2367-len, "<h2>%s este pe locul %d din %d</h2>", name, iRankPos, iRankMax);
	}
	
	new server_name[64];
	get_cvar_string("hostname", server_name, 63);
	
	len += format(buffer[len], 2367-len, "<table border=^"0^" align=^"center^" cellpadding=^"0^" cellspacing=^"1^"><tbody>");
	
	len += format(buffer[len], 2367-len, "<tr><th colspan=^"2^">Statistici %s", name);
	
	len += format(buffer[len], 2367-len, "<tr id=^"c^"><td>Ucideri<td>%d (cu %d HS)", izStats[0], izStats[2]);
	len += format(buffer[len], 2367-len, "<tr><td>Deaths<td>%d", izStats[1]);
	len += format(buffer[len], 2367-len, "<tr id=^"c^"><td>Hits<td>%d", izStats[5]);
	len += format(buffer[len], 2367-len, "<tr><td>Shots<td>%d", izStats[4]);
	len += format(buffer[len], 2367-len, "<tr id=^"c^"><td>Damage(HP)<td>%d", izStats[6]);
	len += format(buffer[len], 2367-len, "<tr><td>ACC. (%)<td>%.02f%", accuracy(izStats));
	len += format(buffer[len], 2367-len, "<tr id=^"c^"><td>EFF.<td>%.02f%", effec(izStats));
	len += format(buffer[len], 2367-len, "<tr><th colspan=^"2^">%s", server_name);
	
	len += format(buffer[len], 2367-len, "</tbody></table></body>");
	show_motd(id, buffer, "Top jucatori");
	
	return PLUGIN_CONTINUE;
}

Float:accuracy(izStats[8]) {
	if(!izStats[4])
		return (0.0);
	
	return (100.0 * float(izStats[5]) / float(izStats[4]));
}

Float:effec(izStats[8]) {
	if(!izStats[0])
		return (0.0);
	
	return (100.0 * float(izStats[0]) / float(izStats[0] + izStats[1]));
}

public cmdTop15(id) {
	new iMax = get_statsnum();
	new iNr = get_pcvar_num(cvar_topnum);
	
	if(iNr != 10 && iNr != 15)
		return PLUGIN_HANDLED;
			
	new start;
		
	if(gNum > 0 && gNum < 16) {
		start = 0;
		gNum = iNr;
	}
	else {
		if(gNum > iMax)
			gNum = iMax;
		else	
			start = gNum - iNr;
	}
			
	new title_data[128];
	new title = get_pcvar_string(cvar_title, title_data, 127);
		
	new buffer[2368], name[32], iBody[8], len, iStats[8];
		
	len = format(buffer[len], 2367-len, "<style>body{background:#112233;font-family:Arial}th{background:#2E2E2E;color:#FFF;padding:5px 2px;text-align:left}td{padding:5px 2px}table{width:100%%;background:#EEEECC;font-size:12px;}h2{color:#FFF;font-family:Verdana;text-align:center}#nr{text-align:center}#c{background:#E2E2BC}</style><h2>%s</h2><table border=^"0^" align=^"center^" cellpadding=^"0^" cellspacing=^"1^"><tbody>", title);
	len += format(buffer[len], 2367-len, "<tr><th id=nr>#</th><th>Name<th>Kills<th>Deaths<th>HS<th>Skill");
		
	for(new i = start; i < gNum; i++) {
		get_user_name(id, name, 31);
		get_stats(i, iStats, iBody, name, 31);
			
		new Float:fstats[8];
		for (new j = 0; j < 8; j++)
			fstats[j] = float(iStats[j]);
			
		while(containi(name, "<") != -1)
			replace(name, 31, "<", "<");
		while(containi(name, ">") != -1)
			replace(name, 31, ">", ">");
			
		len += format(buffer[len], 2367-len, "<tr %s><td id=nr>%d<td>%s<td>%d<td>%d<td>%d<td>%.02f",((i%2)==0) ? "" : " id=c", (i+1), name, iStats[0], iStats[1], iStats[2], ((fstats[0]-fstats[1])+fstats[2])/2);
	}
		
	new server_name[64];
	get_cvar_string("hostname", server_name, 63);
	len += format(buffer[len], 2367-len, "<tr><th colspan=^"7^" id=nr>%s", server_name);
		
	len += format(buffer[len], 2367-len, "</tbody></table></body>");
	show_motd(id, buffer, "Top jucatori");
	
	return PLUGIN_CONTINUE;
}

  • Like 1

Share this post


Link to post
Share on other sites

Tot problema care nu-mi arata kill-urile 

Dar in fine il las asa fara culoare.

 

As mai avea o rugaminte daca se poate un plugin de say_team colorat cand scriu playerii pe u@ sa apara color

Share this post


Link to post
Share on other sites

Say and say_team : 

//Use !T for team-color (sorry, can't use red when on CT, and vice-versa)
//!G for green, and !W for normal (it's more of a tan than a white...)


//Includes
#include <amxmodx>
#include <cstrike>

//Defines
#if defined ACCESS_LEVEL
	#undef ACCESS_LEVEL
#endif
//#define ACCESS_LEVEL ADMIN_CHAT	//UNCOMMENT THIS LINE to allow only admins (with ADMIN_CHAT) to use colors

//Messages
new gmsgSayText

//Globals


//Initialization
public plugin_init()
{
	gmsgSayText = get_user_msgid("SayText")
	register_clcmd("say", "CatchSay")
	register_clcmd("say_team", "CatchSay")
	register_plugin("Admin Chat Color","1.0","BlueRaja")
	return PLUGIN_CONTINUE
}

//Functions
public CatchSay(id)
{
	#if defined ACCESS_LEVEL
		if( !(get_user_flags(id)&ACCESS_LEVEL) ) return PLUGIN_CONTINUE
	#endif

	new message[129]
	read_argv(1,message,128)
	
	if ( containi(message,"!t")==-1 &&
	     containi(message,"!w")==-1 &&
	     containi(message,"!g")==-1 )
	{
		return PLUGIN_CONTINUE
	}
	
	new szCommand[9]
	read_argv(0,szCommand,8)

	new CsTeams:team = cs_get_user_team(id)
	new isAlive = is_user_alive(id)
	
	new playerList[32]//players to send message to
	new playerCount
	
	new message_to_send[129] = "^x01"

	new szFlags[4] = ""
	if(isAlive){
		add(szFlags,3,"a")//Only alive players
	} else {
		add(szFlags,3,"b")//Only dead players
		add(message_to_send,128,"*DEAD*")
	}
	add(szFlags,3,"c")//skip bots
	
	if(equal(szCommand,"say_team")) {
		add(szFlags,3,"e")//Match with passed teamname
		if(team==CS_TEAM_T){
			get_players(playerList,playerCount,szFlags,"TERRORIST")
			add(message_to_send,128,"(Terrorist) ^x03")
		} else if(team==CS_TEAM_CT) {
			get_players(playerList,playerCount,szFlags,"CT")
			add(message_to_send,128,"(Counter-terrorist) ^x03")
		} else { //assume Spectator
			get_players(playerList,playerCount,szFlags,"SPECTATOR")
			add(message_to_send,128,"(Spectator) ^x03")
		}
	} else { //assume "say"
		get_players(playerList,playerCount,szFlags)
		if(isAlive)
		{
			add(message_to_send,128,"^x03")
		} else {
			add(message_to_send,128," ^x03")
		}
	}	
	
	new username[129]
	get_user_name(id,username,128)
	add(message_to_send,128,username)
	add(message_to_send,128,"^x01 :  ")

	add( message_to_send,128,message,(128-strlen(message_to_send)) )

	while(containi(message_to_send,"!t") != -1)
	{
		replace(message_to_send,128,"!T","^x03")
		replace(message_to_send,128,"!t","^x03")
	}
	while(containi(message_to_send,"!g") != -1)
	{
		replace(message_to_send,128,"!G","^x04")
		replace(message_to_send,128,"!g","^x04")
	}
	while(containi(message_to_send,"!w") != -1)
	{
		replace(message_to_send,128,"!W","^x01")
		replace(message_to_send,128,"!w","^x01")
	}


	for(new i=0; i<playerCount; i++)
	{
		message_begin(MSG_ONE, gmsgSayText, {0,0,0}, playerList[i])
		write_byte(playerList[i])
		write_string(message_to_send)
		message_end()
	}

	return PLUGIN_HANDLED
}
  • Like 1

Share this post


Link to post
Share on other sites

Daca mai ai nevoie de pluginuri sau ai nevoie de support , dai pm  , te ajut cu mare placere.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×