[Plugin] 100 Kills = Reset Score

Pluginuri facute de utilizatorii forumului eXtream.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

User avatar
GhosT ***
Membru, skill +2
Membru, skill +2
Posts: 604
Joined: 04 Dec 2013, 21:52
Detinator Steam: Da
CS Status: Morphin . [ Retras ]
SteamID: Mutulica1428
Reputatie: Fost Moderator ajutator
Location: Dumesti.
Has thanked: 40 times
Been thanked: 99 times
Contact:

25 Feb 2014, 15:46

LordOfNothing wrote:cruyff dc tot pui la sf rundei, nu e o ideie mai buna in DeathMsg ??
Asta ar insemna "GG" ..
LordOfNothing
Membru, skill +1
Membru, skill +1
Posts: 387
Joined: 19 Jul 2013, 15:51
Detinator Steam: Nu
Reputatie: Restrictie PM
Has thanked: 11 times
Been thanked: 35 times

25 Feb 2014, 20:45

GhosT *** wrote:
LordOfNothing wrote:cruyff dc tot pui la sf rundei, nu e o ideie mai buna in DeathMsg ??
Asta ar insemna "GG" ..
nu mai zi cuvinte la intimplare si incearca sa "gandesti" , cruyff se referea cai "gg" daca punem sa se reseteze mapa, DeathMsg e o optimizare a codului pentru a fi mai rapid
User avatar
GhosT ***
Membru, skill +2
Membru, skill +2
Posts: 604
Joined: 04 Dec 2013, 21:52
Detinator Steam: Da
CS Status: Morphin . [ Retras ]
SteamID: Mutulica1428
Reputatie: Fost Moderator ajutator
Location: Dumesti.
Has thanked: 40 times
Been thanked: 99 times
Contact:

26 Feb 2014, 17:30

LordOfNothing wrote:
GhosT *** wrote:
LordOfNothing wrote:cruyff dc tot pui la sf rundei, nu e o ideie mai buna in DeathMsg ??
Asta ar insemna "GG" ..
nu mai zi cuvinte la intimplare si incearca sa "gandesti" , cruyff se referea cai "gg" daca punem sa se reseteze mapa, DeathMsg e o optimizare a codului pentru a fi mai rapid
Iti convine ?
| Afiseaza codul
#include <amxmodx>
#include <colorchat>

#pragma semicolon 1

native set_user_frags(id=0, cantitate=0);
native cs_set_user_deaths(id=0, cantitate=0);

new CvarMaxKills;
new iMaxKills;

public plugin_cfg()
	iMaxKills = get_pcvar_num(CvarMaxKills);

//=========================================================================	

public plugin_init()
{
	new const
		PLUGIN_NAME[] = "100 kills = rs",
		PLUGIN_VERS[] = "1.2",
		PLUGIN_AUTH[] = "GhosT ***";
	
	register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH);
	
	register_event("DeathMsg", "DeathMsg", "a");
	
	CvarMaxKills = register_cvar("MaxKillsReset", "1");
}
public DeathMsg()
{
	new iAttacker = read_data(1);
	
	if(get_user_frags(iAttacker) >= iMaxKills && iMaxKills >= 1)
	{
		new iAttackerName[32];
		get_user_name(iAttacker, iAttackerName, sizeof(iAttackerName) - 1);
		
		set_user_frags(0, 0);
		cs_set_user_deaths(0, 0);
		
		ColorChat(0, RED, "----------------------------------------------");
		ColorChat(0, BLUE, "^x04[RESET]^x03 Scorul tuturor jucatorilor a fost resetat !");
		ColorChat(0, BLUE, "^x04[RESET]^x03 Deoarece %s a atins 100 fraguri !", iAttackerName);
		ColorChat(0, RED, "----------------------------------------------");
	}
	
	return PLUGIN_CONTINUE;
}
sUperstar # talenT
Membru, skill 0
Membru, skill 0
Posts: 43
Joined: 22 Oct 2009, 14:39
Detinator Steam: Da
CS Status: csdm.csblackdevil.com
Detinator server CS: csdm.csblackdevil.co
SteamID: duffy918
Location: Tg-Jiu
Has thanked: 8 times

04 Mar 2014, 11:16

Ce pot modifica ca la un anumit numar de fraguri .. sa se schimbe mapa automat cu cea din mapcycle
Image
User avatar
aEEk.#
Membru, skill 0
Membru, skill 0
Posts: 52
Joined: 13 Sep 2012, 22:06
Detinator Steam: Da
CS Status: Open your mind.
SteamID: ale_alexa2389
Location: VSTS
Has thanked: 7 times
Been thanked: 3 times
Contact:

25 Nov 2014, 20:41

Frumos, dar si mai frumos era daca setai un cvar gen amx_restart_mode 0/1/2 cu 0 dezactivat, 1 - activat pentru 1 singur jucator, 2 - activat pentru toata echipa

Vreau sa spun pentru 1 puteai sa pui o limita de x killuri, iar pentru 2 o limita de y killuri (2000 killuri) care sa fie luata pe toata echipa.
weez
Membru, skill 0
Membru, skill 0
Posts: 97
Joined: 16 Apr 2013, 19:36
Detinator Steam: Da
CS Status: MAPPER CS 1.6
Has thanked: 1 time
Been thanked: 5 times
Contact:

10 Oct 2015, 17:47

Nu merge .
User avatar
DaNNe.
Fost moderator
Fost moderator
Posts: 2811
Joined: 08 Nov 2013, 20:43
Detinator Steam: Da
CS Status: Activitate scăzută
SteamID: /id/FurienMaster
Reputatie: Nick anterior: DnD. Gold, Emrys
0.5/3
Fost moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 244 times
Been thanked: 129 times
Contact:

03 Nov 2015, 19:15

weez wrote:Nu merge .
Acum merge?
SMA | Afiseaza codul
#include 		<amxmodx>
#include 		<cstrike>
#include 		<fun>

#define 		PLUGIN		"Auto Reset Score"
#define 		VERSION		"2.0"
#define 		AUTHOR 		"GhosT ***" // Ma rog, doar ideea e de la el, dar sa nu zica ca e copiat, ca nu-i mare lucru.

new PlayerKills[33], cvar_autoreset, cvar_maxkills;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	cvar_autoreset 		=		register_cvar("auto_reset_mode", "1") // 1 - Reseteaza doar celui care atinge limita | 2 - Reseteaza tuturor atunci cand cineva atinge limita
	cvar_maxkills		=		register_cvar("auto_reset_kills", "30") // La cate kill-uri se reseteaza scorul
	
	if(get_pcvar_num(cvar_autoreset))
		register_event("DeathMsg",	"EVENT_Death", "a")
}

public EVENT_Death() {
	if(get_pcvar_num(cvar_autoreset)) {
		new Attacker	=		read_data(1),
			Victim		=		read_data(2);
		if(is_user_connected(Attacker) && is_user_connected(Victim) && Attacker != Victim) {
			PlayerKills[Attacker]++
			new Name[32]
			get_user_name(Attacker, Name, 31)
			if(PlayerKills[Attacker] >= get_pcvar_num(cvar_maxkills)) {
				switch(get_pcvar_num(cvar_autoreset)) {
					case 1: { 
						ColorChat(0, "!g%s!t a ajuns la!g %d!t frag-uri, scorul tuturor a fost resetat.", Name, get_pcvar_num(cvar_maxkills))
						cs_set_user_deaths(0, 0)
						set_user_frags(0, 0)
					}
					case 2: {
						ColorChat(0, "!g%s!t a ajuns la!g %d!t frag-uri, scorul acestuia a fost resetat.", Name, get_pcvar_num(cvar_maxkills))
						cs_set_user_deaths(Attacker, 0)
						set_user_frags(Attacker, 0)	
					}
				}
			}
		}
	}
}
					
stock ColorChat(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!g", "^4");
	replace_all(msg, 190, "!y", "^1");
	replace_all(msg, 190, "!t", "^3");
	
	if(id) players[0] = id;
	else get_players(players, count, "ch"); {
		for(new i = 0; i < count; i++) {
			if(is_user_connected(players)) {
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
				write_byte(players);
				write_string(msg);
				message_end();
			}
		}
	} 
}
endlessux
Membru, skill +1
Membru, skill +1
Posts: 338
Joined: 21 Dec 2014, 10:23
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
SteamID: skrol_hns
Fond eXtream: 0
Has thanked: 31 times
Been thanked: 7 times
Contact:

14 Nov 2023, 16:23

Ce versiune este cea care reseteaza doar scorul jucatorului ce a facut 100 killuri
User avatar
A k c 3 n 7
Super moderator
Super moderator
Posts: 5137
Joined: 25 Aug 2014, 21:31
Detinator Steam: Da
CS Status: who dares wins
SteamID: Jandarmeria
Reputatie: Super moderator
Moderatorul anului 2023
Fost Membru Club eXtreamCS ( o luna )
Fost eXtream Mod
Fost Intermediar
Nume anterior: Sorinel
Fond eXtream: 0
Location: Unknown
Discord: remusakcent
Has thanked: 3 times
Been thanked: 46 times

15 Nov 2023, 18:43

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <ColorChat>

#define PLUGIN "100 Kills = Reset Score  xD"
#define VERSION "1.0"
#define AUTHOR "GhosT ***"


public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_logevent ("round_end", 2, "1=Round_End");
}

public round_end(id)
{
	if(!get_user_frags(id) >= 100 && is_user_connected(id))
	{
		cs_set_user_deaths(0, 0)
		set_user_frags(0, 0)
		cs_set_user_deaths(0, 0)
		set_user_frags(0, 0)
		ColorChat(0, TEAM_COLOR, "--------------------------------------------------------")
	//	ColorChat(0, GREEN, "[RESET] Scorul tuturor jucatorilor a fost resetat !")
	//	ColorChat(0, GREEN, "[RESET] Deoarece unul dintre jucatori a atins 100 kills!")
	        ColorChat(id, GREEN, "[RESET] Scorul tau a fost resetat deoarece ai facut 100 de killuri!")
		ColorChat(0, TEAM_COLOR, "--------------------------------------------------------")
	}
}
endlessux
Membru, skill +1
Membru, skill +1
Posts: 338
Joined: 21 Dec 2014, 10:23
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
SteamID: skrol_hns
Fond eXtream: 0
Has thanked: 31 times
Been thanked: 7 times
Contact:

16 Nov 2023, 12:41

Eroare la compilare
User avatar
A k c 3 n 7
Super moderator
Super moderator
Posts: 5137
Joined: 25 Aug 2014, 21:31
Detinator Steam: Da
CS Status: who dares wins
SteamID: Jandarmeria
Reputatie: Super moderator
Moderatorul anului 2023
Fost Membru Club eXtreamCS ( o luna )
Fost eXtream Mod
Fost Intermediar
Nume anterior: Sorinel
Fond eXtream: 0
Location: Unknown
Discord: remusakcent
Has thanked: 3 times
Been thanked: 46 times

16 Nov 2023, 17:31

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <ColorChat>

#define PLUGIN "100 Kills = Reset Score  xD"
#define VERSION "1.0"
#define AUTHOR "GhosT ***"


public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_logevent ("round_end", 2, "1=Round_End");
}

public round_end(id)
{
	if(!(get_user_frags(id) >= 100 && is_user_connected(id)))
	{
		cs_set_user_deaths(0, 0)
		set_user_frags(0, 0)
		cs_set_user_deaths(0, 0)
		set_user_frags(0, 0)
		ColorChat(0, TEAM_COLOR, "--------------------------------------------------------")
	//	ColorChat(0, GREEN, "[RESET] Scorul tuturor jucatorilor a fost resetat !")
	//	ColorChat(0, GREEN, "[RESET] Deoarece unul dintre jucatori a atins 100 kills!")
	        ColorChat(id, GREEN, "[RESET] Scorul tau a fost resetat deoarece ai facut 100 de killuri!")
		ColorChat(0, TEAM_COLOR, "--------------------------------------------------------")
	}
}
este posibil sa nu ai ColorChat.inc in include. poftim, copiezi textul il pui intr un fisier txt si il salavezi ColorChat.inc dupa care il pui in folderul scripting/include

Code: Select all

/* Fun functions
*
* by Numb
*
* This file is provided as is (no warranties).
*/

#if defined _colorchat_included
  #endinput
#endif
#define _colorchat_included

enum Color
{
	NORMAL = 1, // clients scr_concolor cvar color
	GREEN, // Green Color
	TEAM_COLOR, // Red, grey, blue
	GREY, // grey
	RED, // Red
	BLUE, // Blue
}

new TeamName[][] = 
{
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}

ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
	new message[256];

	switch(type)
	{
		case NORMAL: // clients scr_concolor cvar color
		{
			message[0] = 0x01;
		}
		case GREEN: // Green
		{
			message[0] = 0x04;
		}
		default: // White, Red, Blue
		{
			message[0] = 0x03;
		}
	}

	vformat(message[1], 251, msg, 4);

	// Make sure message is not longer than 192 character. Will crash the server.
	message[192] = '^0';

	new team, ColorChange, index, MSG_Type;
	
	if(id)
	{
		MSG_Type = MSG_ONE;
		index = id;
	} else {
		index = FindPlayer();
		MSG_Type = MSG_ALL;
	}
	
	team = get_user_team(index);
	ColorChange = ColorSelection(index, MSG_Type, type);

	ShowColorMessage(index, MSG_Type, message);
		
	if(ColorChange)
	{
		Team_Info(index, MSG_Type, TeamName[team]);
	}
}

ShowColorMessage(id, type, message[])
{
	static bool:saytext_used;
	static get_user_msgid_saytext;
	if(!saytext_used)
	{
		get_user_msgid_saytext = get_user_msgid("SayText");
		saytext_used = true;
	}
	message_begin(type, get_user_msgid_saytext, _, id);
	write_byte(id)		
	write_string(message);
	message_end();	
}

Team_Info(id, type, team[])
{
	static bool:teaminfo_used;
	static get_user_msgid_teaminfo;
	if(!teaminfo_used)
	{
		get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
		teaminfo_used = true;
	}
	message_begin(type, get_user_msgid_teaminfo, _, id);
	write_byte(id);
	write_string(team);
	message_end();

	return 1;
}

ColorSelection(index, type, Color:Type)
{
	switch(Type)
	{
		case RED:
		{
			return Team_Info(index, type, TeamName[1]);
		}
		case BLUE:
		{
			return Team_Info(index, type, TeamName[2]);
		}
		case GREY:
		{
			return Team_Info(index, type, TeamName[0]);
		}
	}

	return 0;
}

FindPlayer()
{
	new i = -1;

	while(i <= get_maxplayers())
	{
		if(is_user_connected(++i))
			return i;
	}

	return -1;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
endlessux
Membru, skill +1
Membru, skill +1
Posts: 338
Joined: 21 Dec 2014, 10:23
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
SteamID: skrol_hns
Fond eXtream: 0
Has thanked: 31 times
Been thanked: 7 times
Contact:

16 Nov 2023, 19:30

Am salvat colorchat.cfg

Code: Select all

#if defined _colorchat_included
  #endinput
#endif
#define _colorchat_included

/* ColorChat Support */
#define NORMAL DontChange
#define GREEN DontChange
#define TEAM_COLOR DontChange
#define RED Red
#define BLUE Blue
#define GREY Grey
#define ColorChat client_print_color
/* ColorChat Support */

enum _:Colors {
	DontChange,
	Red,
	Blue,
	Grey
}

stock const g_szTeamName[Colors][] = 
{
	"UNASSIGNED",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}

stock client_print_color(id, iColor=DontChange, const szMsg[], any:...)
{
	// check if id is different from 0
	if( id && !is_user_connected(id) )
	{
		return 0;
	}

	if( iColor > Grey )
	{
		iColor = DontChange;
	}

	new szMessage[192];
	if( iColor == DontChange )
	{
		szMessage[0] = 0x04;
	}
	else
	{
		szMessage[0] = 0x03;
	}

	new iParams = numargs();
	// Specific player code
	if(id)
	{
		if( iParams == 3 )
		{
			copy(szMessage[1], charsmax(szMessage)-1, szMsg);
		}
		else
		{
			vformat(szMessage[1], charsmax(szMessage)-1, szMsg, 4);
		}

		if( iColor )
		{
			new szTeam[11]; // store current team so we can restore it
			get_user_team(id, szTeam, charsmax(szTeam));

			// set id TeamInfo in consequence
			// so SayText msg gonna show the right color
			Send_TeamInfo(id, id, g_szTeamName[iColor]);

			// Send the message
			Send_SayText(id, id, szMessage);

			// restore TeamInfo
			Send_TeamInfo(id, id, szTeam);
		}
		else
		{
			Send_SayText(id, id, szMessage);
		}
	} 

	// Send message to all players
	else
	{
		// Figure out if at least 1 player is connected
		// so we don't send useless message if not
		// and we gonna use that player as team reference (aka SayText message sender) for color change
		new iPlayers[32], iNum;
		get_players(iPlayers, iNum, "ch");
		if( !iNum )
		{
			return 0;
		}

		new iFool = iPlayers[0];

		new iMlNumber, i, j;
		new Array:aStoreML = ArrayCreate();
		if( iParams >= 5 ) // ML can be used
		{
			for(j=4; j<iParams; j++)
			{
				// retrieve original param value and check if it's LANG_PLAYER value
				if( getarg(j) == LANG_PLAYER )
				{
					i=0;
					// as LANG_PLAYER == -1, check if next parm string is a registered language translation
					while( ( szMessage[ i ] = getarg( j + 1, i++ ) ) ) {}
					if( GetLangTransKey(szMessage) != TransKey_Bad )
					{
						// Store that arg as LANG_PLAYER so we can alter it later
						ArrayPushCell(aStoreML, j++);

						// Update ML array saire so we'll know 1st if ML is used,
						// 2nd how many args we have to alterate
						iMlNumber++;
					}
				}
			}
		}

		// If arraysize == 0, ML is not used
		// we can only send 1 MSG_BROADCAST message
		if( !iMlNumber )
		{
			if( iParams == 3 )
			{
				copy(szMessage[1], charsmax(szMessage)-1, szMsg);
			}
			else
			{
				vformat(szMessage[1], charsmax(szMessage)-1, szMsg, 4);
			}

			if( iColor )
			{
				new szTeam[11];
				get_user_team(iFool, szTeam, charsmax(szTeam));
				Send_TeamInfo(0, iFool, g_szTeamName[iColor]);
				Send_SayText(0, iFool, szMessage);
				Send_TeamInfo(0, iFool, szTeam);
			}
			else
			{
				Send_SayText(0, iFool, szMessage);
			}
		}

		// ML is used, we need to loop through all players,
		// format text and send a MSG_ONE_UNRELIABLE SayText message
		else
		{
			new szTeam[11], szFakeTeam[10];
			
			if( iColor )
			{
				get_user_team(iFool, szTeam, charsmax(szTeam));
				copy(szFakeTeam, charsmax(szFakeTeam), g_szTeamName[iColor]);
			}

			for( i = 0; i < iNum; i++ )
			{
				id = iPlayers[i];

				for(j=0; j<iMlNumber; j++)
				{
					// Set all LANG_PLAYER args to player index ( = id )
					// so we can format the text for that specific player
					setarg(ArrayGetCell(aStoreML, j), _, id);
				}

				// format string for specific player
				vformat(szMessage[1], charsmax(szMessage)-1, szMsg, 4);

				if( iColor )
				{
					Send_TeamInfo(id, iFool, szFakeTeam);
					Send_SayText(id, iFool, szMessage);
					Send_TeamInfo(id, iFool, szTeam);
				}
				else
				{
					Send_SayText(id, iFool, szMessage);
				}
			}
			ArrayDestroy(aStoreML);
		}
	}
	return 1;
}

stock Send_TeamInfo(iReceiver, iPlayerId, szTeam[])
{
	static iTeamInfo = 0;
	if( !iTeamInfo )
	{
		iTeamInfo = get_user_msgid("TeamInfo");
	}
	message_begin(iReceiver ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iTeamInfo, .player=iReceiver);
	write_byte(iPlayerId);
	write_string(szTeam);
	message_end();
}

stock Send_SayText(iReceiver, iPlayerId, szMessage[])
{
	static iSayText = 0;
	if( !iSayText )
	{
		iSayText = get_user_msgid("SayText");
	}
	message_begin(iReceiver ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iSayText, .player=iReceiver);
	write_byte(iPlayerId);
	write_string(szMessage);
	message_end();
}

stock register_dictionary_colored(const filename[])
{
	if( !register_dictionary(filename) )
	{
		return 0;
	}

	new szFileName[256];
	get_localinfo("amxx_datadir", szFileName, charsmax(szFileName));
	format(szFileName, charsmax(szFileName), "%s/lang/%s", szFileName, filename);
	new fp = fopen(szFileName, "rt");
	if( !fp )
	{
		log_amx("Failed to open %s", szFileName);
		return 0;
	}

	new szBuffer[512], szLang[3], szKey[64], szTranslation[256], TransKey:iKey;

	while( !feof(fp) )
	{
		fgets(fp, szBuffer, charsmax(szBuffer));
		trim(szBuffer);

		if( szBuffer[0] == '[' )
		{
			strtok(szBuffer[1], szLang, charsmax(szLang), szBuffer, 1, ']');
		}
		else if( szBuffer[0] )
		{
			strbreak(szBuffer, szKey, charsmax(szKey), szTranslation, charsmax(szTranslation));
			iKey = GetLangTransKey(szKey);
			if( iKey != TransKey_Bad )
			{
				while( replace(szTranslation, charsmax(szTranslation), "!g", "^4") ){}
				while( replace(szTranslation, charsmax(szTranslation), "!t", "^3") ){}
				while( replace(szTranslation, charsmax(szTranslation), "!n", "^1") ){}
				AddTranslation(szLang, iKey, szTranslation[2]);
			}
		}
	}
	
	fclose(fp);
	return 1;
}
Post Reply

Return to “Pluginuri eXtream”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests