Cerere modificare amx_spectate[Rezolvat]

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Locked
User avatar
N3v3rM1nd
Membru, skill +1
Membru, skill +1
Posts: 106
Joined: 06 Oct 2018, 13:41
Detinator Steam: Da
CS Status: Just a simple guy :P
Detinator server CS: As vrea eu xD
SteamID: Da
Fond eXtream: 0
Location: Constanta
Has thanked: 20 times
Contact:

21 May 2020, 18:21

Salut extream , as avea nevoie de ajutor la pluginul amx_spectate ... Mai pe scurt vreau ca atunci cand un admin se muta la spectatori ,pluginul sa il puna automat pe amx_spectate
acesta este codul

Code: Select all

/* http://forums.alliedmods.net/showthread.php?p=551999#post551999
*
* Changelog
* added cvar amx_inv_dead_percent <value>
*
*/

#include <amxmodx>
#include <fakemeta>

#if AMXX_VERSION_NUM < 180
	#define charsmax(%1)	sizeof(%1) - 1
#endif

#define MAX_PLAYERS	32

#define DEAD_FLAG   (1<<0)

#define OFFSET_TEAM 	114

enum {
 	CS_TEAM_UNASSIGNED,
 	CS_TEAM_T,
 	CS_TEAM_CT,
 	CS_TEAM_SPECTATOR
}

new bool:g_roundend
new pcvar_percent
new g_invisible[MAX_PLAYERS+1][2]
new gmsgScoreAttrib, gmsgTeamInfo

public plugin_init() {
	register_plugin("Invisible Spectator", "0.2", "ConnorMcLeod")

	pcvar_percent = register_cvar("amx_inv_dead_percent", "40")

	register_clcmd("amx_spectate", "make_invis", ADMIN_VOTE)

	gmsgScoreAttrib = get_user_msgid("ScoreAttrib")
	gmsgTeamInfo = get_user_msgid("TeamInfo")

	register_message( gmsgScoreAttrib, "msg_ScoreAttrib")
	register_message( gmsgTeamInfo, "msg_TeamInfo")

	register_event("HLTV", "eNewRound", "a", "1=0", "2=0")
	register_logevent("eRoundEnd", 2, "1=Round_End")
	register_event("ResetHUD", "eResetHUD", "be")
	register_event("DeathMsg", "eDeathMsg", "a")
}

public make_invis(id, level) {
	if( ~get_user_flags(id) & level )
		return PLUGIN_CONTINUE

	if(g_invisible[id][0])
	{
		client_print(id, print_console, "You're not invisible anymore")
		g_invisible[id][0] = 0
		return PLUGIN_HANDLED
	}
		
	if( is_user_alive(id) )
	{
		client_print(id, print_console, "You have to be dead first to be an invisible spectator !")
		return PLUGIN_HANDLED
	}

	g_invisible[id][0] = 1
	client_print(id, print_console, "You're now an invisible spectator")

	new team = get_pdata_int(id, OFFSET_TEAM)
	if( CS_TEAM_T <= team <= CS_TEAM_CT )
	{
		g_invisible[id][1] = team
		set_pdata_int(id, OFFSET_TEAM, CS_TEAM_SPECTATOR)
	}
	else
	{
		new players[MAX_PLAYERS], tnum, ctnum
		get_players(players, tnum, "e", "TERRORIST")
		get_players(players, ctnum, "e", "CT")
		g_invisible[id][1] = ctnum > tnum ? 1 : 2
	}

	send_ScoreAttrib(id, 0)

	new teamname[12]
	switch( g_invisible[id][1] )
	{
		case 1:formatex(teamname, charsmax(teamname), "TERRORIST")
		case 2:formatex(teamname, charsmax(teamname), "CT")
	}
	send_TeamInfo(id, teamname)

	return PLUGIN_HANDLED
}

public eDeathMsg() {
	if(g_roundend)
		return

	new players[MAX_PLAYERS], dead, inum, player, Float:percent = get_pcvar_float(pcvar_percent) / 100.0
	get_players(players, dead, "bh")
	get_players(players, inum, "h")

	if( float(dead) / float(inum) < percent) 
		return

	for(new i; i < inum; i++)
	{
		player = players[i]
		if( g_invisible[player][0] )
			send_ScoreAttrib(player, DEAD_FLAG)
	}
}

public eNewRound() {
	g_roundend = false
	new players[MAX_PLAYERS], inum, player
	get_players(players, inum)
	for(new i; i < inum; i++)
	{
		player = players[i]
		if( g_invisible[player][0] )
			send_ScoreAttrib(player, 0)
	}
}

public eRoundEnd() {
	g_roundend = true
	new players[MAX_PLAYERS], inum, player
	get_players(players, inum)
	for(new i; i < inum; i++)
	{
		player = players[i]
		if( g_invisible[player][0] )
			send_ScoreAttrib(player, DEAD_FLAG)
	}
}

public eResetHUD(id) {
	if( g_invisible[id][0] )
		g_invisible[id][0] = 0
}

// Doesn't seem to work so set flag to 0 at NewRound event.
public msg_ScoreAttrib(msg_type, msg_dest, target) {
	if(!g_invisible[get_msg_arg_int(1)][0])
		return PLUGIN_CONTINUE

	new flags = get_msg_arg_int(2)
	if(flags & DEAD_FLAG)
		set_msg_arg_int(2, 0, flags & ~DEAD_FLAG)

	return PLUGIN_CONTINUE 
}

public msg_TeamInfo(msg_type, msg_dest, target) {
	new id = get_msg_arg_int(1)
	if(!g_invisible[id][0])
		return PLUGIN_CONTINUE

	new teamname[12]
	get_msg_arg_string(2, teamname, charsmax(teamname))
	if( g_invisible[id][1] == CS_TEAM_T && strcmp(teamname, "TERRORIST") != 0 )
		set_msg_arg_string(2, "TERRORIST")
	else if( g_invisible[id][1] == CS_TEAM_CT && strcmp(teamname, "CT") != 0 )
		set_msg_arg_string(2, "CT")

	return PLUGIN_CONTINUE
}

send_ScoreAttrib(id, flags)
{
	message_begin(MSG_ALL, gmsgScoreAttrib, _, 0)
	write_byte(id)
	write_byte(flags)
	message_end()
}

send_TeamInfo(id, teamname[])
{
	message_begin(MSG_ALL, gmsgTeamInfo, _, 0)
	write_byte(id)
	write_string(teamname)
	message_end()
}
Last edited by Madross on 22 May 2020, 23:57, edited 1 time in total.
Reason: Marcat ca rezolvat . Topic Closed.
Zonek
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2966
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 39 times
Been thanked: 454 times
Contact:

21 May 2020, 20:07

Code: Select all

/* Plugin generated by AMXX-Studio */

#include <amxmodx>

public plugin_init()	register_event( "DeathMsg", "ev_DeathMsg", "a" )
public ev_DeathMsg(){
	new Victim=read_data(2)
	if(!is_user_connected(Victim)||!(get_user_flags(Victim)&ADMIN_VOTE))	return
	evo_callfunc(Victim,"make_invis","spectate.amxx")
}
stock evo_callfunc( id, function[], plugin[] ){
	if( callfunc_begin( function, plugin ) == 1 ){
		callfunc_push_int( id );
		callfunc_push_int(ADMIN_VOTE);
		callfunc_end( );
	}
}
Faceți cerere bine detaliată aici și respectând modelul dacă vreți ajutor. Nu-mi mai dați add doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz!
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici, iar dacă sunt ceva probleme sau aveți dvs. probleme nu ezitați să luați legătura cu mine.
HOST CS1.6
User avatar
N3v3rM1nd
Membru, skill +1
Membru, skill +1
Posts: 106
Joined: 06 Oct 2018, 13:41
Detinator Steam: Da
CS Status: Just a simple guy :P
Detinator server CS: As vrea eu xD
SteamID: Da
Fond eXtream: 0
Location: Constanta
Has thanked: 20 times
Contact:

21 May 2020, 20:18

EdiT : daca x il omoara pe y atunci pe y il pune pe amx_spectate si se buguieste runda
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2966
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 39 times
Been thanked: 454 times
Contact:

21 May 2020, 20:52

Code: Select all

/* Plugin generated by AMXX-Studio */

#include <amxmodx>

public plugin_init()	register_event( "DeathMsg", "ev_DeathMsg", "a" )
public ev_DeathMsg(){
	new Victim=read_data(2)
	if(!is_user_connected(Victim)||!(get_user_flags(Victim)&ADMIN_VOTE)||get_user_team(Victim)!=3)	return
	evo_callfunc(Victim,"make_invis","spectate.amxx")
}
stock evo_callfunc( id, function[], plugin[] ){
	if( callfunc_begin( function, plugin ) == 1 ){
		callfunc_push_int( id );
		callfunc_push_int(ADMIN_VOTE);
		callfunc_end( );
	}
}
Faceți cerere bine detaliată aici și respectând modelul dacă vreți ajutor. Nu-mi mai dați add doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz!
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici, iar dacă sunt ceva probleme sau aveți dvs. probleme nu ezitați să luați legătura cu mine.
HOST CS1.6
User avatar
N3v3rM1nd
Membru, skill +1
Membru, skill +1
Posts: 106
Joined: 06 Oct 2018, 13:41
Detinator Steam: Da
CS Status: Just a simple guy :P
Detinator server CS: As vrea eu xD
SteamID: Da
Fond eXtream: 0
Location: Constanta
Has thanked: 20 times
Contact:

21 May 2020, 21:18

Cand x ( x fiind admin cu ADMIN_VOTE ) se pune singur la spectatori cu comanda amx_spec x , il pune x pe amx_spectate , dar daca x apasa m6 il pune la spectatori fara amx_spectate , iar daca un admin il muta pe adminul x la spectatori cu comanda amx_spec nu il pune pe x pe amx_spectate
Asta e sursa la pluginul de transfer

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#pragma tabsize 0;

new const Slash [] = "/";

new Commands [ ] [ ] = {

   "/t",
   "/ct",
   "/spec"
};

public plugin_init() {

       register_plugin ( "Transfer", "1.0", "TTF" );
       register_concmd ( "amx_t", "CmdTerrorists", ADMIN_KICK, "[Nume]" );
       register_concmd ( "amx_ct", "CmdCounterTerrorists", ADMIN_KICK, "[Nume]" );
       register_concmd ( "amx_spec", "CmdSpectators", ADMIN_KICK, "[Nume]" );

       register_clcmd ( "say", "cmdSay" )
}

public spec(id) {

    cs_set_user_team(id,CS_TEAM_SPECTATOR);

    if(is_user_alive(id))
    user_silentkill(id);

    return PLUGIN_CONTINUE;
}

public ct(id) {

    cs_set_user_team(id,CS_TEAM_CT);
    user_silentkill(id);

    return PLUGIN_CONTINUE;
}

public t(id) {

    cs_set_user_team(id,CS_TEAM_T);
    user_silentkill(id);

    return PLUGIN_CONTINUE;
}

public cmdSay ( id ) 
{
	static Args [192]; read_args ( Args, charsmax ( Args ) );
	if ( !Args [0] ) return PLUGIN_CONTINUE;
	remove_quotes ( Args [0] )
	
	static Command [192];
	for ( new i; i < sizeof Commands; i++ )
	{
		if ( equal ( Args, Commands[i] , strlen ( Commands[i]  ) ) )
		{
			if ( get_user_flags ( id ) & ADMIN_SLAY )
			{
				replace ( Args, charsmax ( Args ), Slash, "" );
				formatex ( Command, charsmax ( Command ),"amx_%s", Args );
				client_cmd ( id, Command );
			}
			break;
		}
	}
	return PLUGIN_CONTINUE;
}

public CmdTerrorists ( id, level, cid ) 
{ 
if ( !cmd_access ( id, level, cid, 2 ) )
	return PLUGIN_HANDLED;
	
	new Arg[32]; read_argv ( 1, Arg, charsmax ( Arg ) );
	
	new player = cmd_target ( id, Arg, 0 );
	
	if ( !player )
		return PLUGIN_HANDLED;
	
	if ( cs_get_user_team ( player ) == CS_TEAM_T )
	{
		console_print ( id, " * Jucatorul este deja Terrorists" );
		return PLUGIN_HANDLED;
	}
	
	static AdminName [32]; get_user_name ( id, AdminName, 31 );
	static PlayerName [32]; get_user_name ( player, PlayerName, 31 );
	
	cs_set_user_team ( player, CS_TEAM_T );
	user_silentkill ( player );
	
	ColorChat(0, "!n[!tCLUB TRANSFER!n] !gAdmin !t%s !n: l-a mutat pe !g%s !nla echipa !tT", AdminName, PlayerName);
	
	return PLUGIN_HANDLED;
}

public CmdCounterTerrorists ( id, level, cid )
{ 
	if ( !cmd_access ( id, level, cid, 2 ) )
		return PLUGIN_HANDLED;
	
	new Arg[32]; read_argv ( 1, Arg, charsmax ( Arg ) );
	
	new player = cmd_target ( id, Arg, 0 );
	
	if ( !player )
		return PLUGIN_HANDLED;
	
	if (cs_get_user_team(player) == CS_TEAM_CT)
	{
		console_print(id, "Jucatorul este deja in echipa CT");
		return PLUGIN_HANDLED;
	}
	
	static AdminName [32]; get_user_name( id, AdminName, 31 );
	static PlayerName [32]; get_user_name( player, PlayerName, 31 );
	
	cs_set_user_team ( player,CS_TEAM_CT );
	user_silentkill ( player );
	
	ColorChat (0, "!n[!tCLUB TRANSFER!n] !gAdmin !t%s !n: l-a mutat pe !g%s !nla echipa !tCT", AdminName, PlayerName);
	
	return PLUGIN_HANDLED;
}

public CmdSpectators ( id, level, cid )
{ 
	if ( !cmd_access ( id, level, cid, 2 ) )
		return PLUGIN_HANDLED;
	
	new Arg[32]; read_argv ( 1, Arg, charsmax ( Arg ) );
	
	new player = cmd_target ( id, Arg, 0 );
	
	if (!player)
		return PLUGIN_HANDLED;
	
	if (cs_get_user_team(player) == CS_TEAM_SPECTATOR)
	{
		console_print(id, " Jucatorul este deja la echipa spectatorilor ");
		return PLUGIN_HANDLED;
	}
	
	static AdminName [32]; get_user_name(id,AdminName,31);
	static PlayerName [32]; get_user_name(player,PlayerName, 31);
	
	cs_set_user_team ( player, CS_TEAM_SPECTATOR ) ;
	user_silentkill ( player );
	
	ColorChat(0, "!n[!tCLUB TRANSFER!n] !gAdmin !t%s !n: l-a mutat pe !g%s !nla !tSpectatori", AdminName, PlayerName);
	
	client_cmd(id, "amx_spectate");
	return PLUGIN_HANDLED;
}
stock ColorChat(const id, const input[], any:...)
{
	new count = 1, players[32]
	static msg[320]
	vformat(msg, 190, input, 3)
	replace_all(msg, 190, "!g", "^4")
	replace_all(msg, 190, "!n", "^1")
	replace_all(msg, 190, "!t", "^3")
	replace_all(msg, 190, "!t2", "^0")
	if (id) players[0] = id; else get_players(players, count, "ch")

	for (new i = 0; i < count; i++)
	{
		if (is_user_connected(players[i]))
		{
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
			write_byte(players[i])
			write_string(msg)
			message_end()
		}
	}

}
User avatar
N3v3rM1nd
Membru, skill +1
Membru, skill +1
Posts: 106
Joined: 06 Oct 2018, 13:41
Detinator Steam: Da
CS Status: Just a simple guy :P
Detinator server CS: As vrea eu xD
SteamID: Da
Fond eXtream: 0
Location: Constanta
Has thanked: 20 times
Contact:

22 May 2020, 12:27

up?
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2966
Joined: 24 Aug 2011, 11:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Has thanked: 39 times
Been thanked: 454 times
Contact:

22 May 2020, 18:13

Code: Select all

/* Plugin generated by AMXX-Studio */

#include <amxmodx>

const CMD_ACC = ADMIN_VOTE

public plugin_init()	register_event( "TeamInfo", "event_team_info", "a" );
public event_team_info(){
	new id = read_data( 1 );
	
	new team[2];
	read_data( 2, team, charsmax(team) );
	if(equal(team[0],"S")&&get_user_flags(id)&CMD_ACC)	evo_callfunc(id,"make_invis","spectate.amxx")
}
stock evo_callfunc( id, function[], plugin[] ){
	if( callfunc_begin( function, plugin ) == 1 ){
		callfunc_push_int( id );
		callfunc_push_int(CMD_ACC);
		callfunc_end( );
	}
}
Faceți cerere bine detaliată aici și respectând modelul dacă vreți ajutor. Nu-mi mai dați add doar pentru a mă avea în lista de prieteni.
Am cont și activez doar aici! Aveți grijă la cei ce încearcă să mă copieze..Puteți lua legătura cu mine dacă aveți o problemă/nelămurire în acest caz!
În cazul în care utilizați ceva din addonsurile postate de mine aici, e bine să fiți la curent cu modificările aduse unor plugine, aici, iar dacă sunt ceva probleme sau aveți dvs. probleme nu ezitați să luați legătura cu mine.
HOST CS1.6
User avatar
N3v3rM1nd
Membru, skill +1
Membru, skill +1
Posts: 106
Joined: 06 Oct 2018, 13:41
Detinator Steam: Da
CS Status: Just a simple guy :P
Detinator server CS: As vrea eu xD
SteamID: Da
Fond eXtream: 0
Location: Constanta
Has thanked: 20 times
Contact:

22 May 2020, 21:46

Rezolvat ! Se poate da TC , ms L E V I N
Locked

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests