AMX client exec v0.3

Всички преработени плъгини се намират тук.
Потребителски аватар
SmirnoffBG
Потребител
Потребител

Мнения:
1

Регистриран:
нед, 14 окт 2018, 02:30

Теми: 1


Curaçao

AMX client exec v0.3

Мнение от SmirnoffBG » нед, 14 окт 2018, 02:51

С този плъгин можете да изпълни команда от името на посоченият играч или от сървърът.
Начин на ползване:
  • amx_exec "част от име на играч" "команда"
  • amx_exec "име на отбор(@all/@t/@ct)" "команда"
  • amx_exec "сървъра (@s)" "команда"
  • amx_exec "Smirnoff" "say /spec"
  • amx_exec "@all" "kill"
  • amx_exec "@s" "exec server.cfg"
Ако искате да пратите няколко команди на веднъж и ви се налага да ползвате кавички ето няколко примера:
  • amx_exec "smir" "say \'az si trugam\'; quit"
  • amx_exec "@all" "echo \'sujelqvam, no trqbwashe da dadesh pari na smir\'; say \'/donate smir 16000\';toggleconsole"

Код: Избери всичко

// AMX client exec v0.3
// By v3x
// If you wish to use any of my code below, please credit me for it! Thanks.

#include <amxmodx>
#include <amxmisc>

// amx_show_activity <2|1|0>
// Look in amxx.cfg for more details
new show_activity2

public plugin_init() {

	register_plugin("AMX Client Exec","0.03","v3x")
	register_clcmd("amx_exec","doExec",ADMIN_RCON,"<nick,@TEAM,*(all),@SERVER>")
	register_srvcmd("amx_exec","doExec")
	show_activity2 = get_cvar_pointer("amx_show_activity")
}

new bool:isAll
new bool:isTeam
new bool:isServ
// For messages

public doExec(id,level,cid) 
{

	if(!cmd_access(id,level,cid,3)) 
	{
		return PLUGIN_HANDLED
	}

	new arg[32]
	new command[164]
	new players[32]
	new player,num,i

	read_argv(1,arg,31)
	read_argv(2,command,163)

	remove_quotes(command)
	
	while(replace(command,163,"\'","^"")) { } // Credited to OLO

	new activity = get_pcvar_num(show_activity2)

	new admin[32]
	get_user_name(id,admin,31)

	if(arg[0]=='@') {

		if(equali(arg[1],"A") 
		|| equali(arg[1],"ALL")) 
		{
			isAll = true
			isTeam = false
			isServ = false
			get_players(players,num,"c")
		} else if(equali(arg[1],"TERRORIST") 
		|| equali(arg[1],"T") 
		|| equali(arg[1],"TERROR") 
		|| equali(arg[1],"TE") 
		|| equali(arg[1],"TER")) 
		{
			isAll = false
			isTeam = true
			isServ = false
			get_players(players,num,"ce","TERRORIST")
		} else if(equali(arg[1],"CT")
		|| equali(arg[1],"C") 
		|| equali(arg[1],"COUNTER")) 
		{
			isAll = false
			isTeam = true
			isServ = false
			get_players(players,num,"ce","CT")
		} else if(equali(arg[1],"S") 
		|| equali(arg[1],"SERV") 
		|| equali(arg[1],"SERVER")) 
		{
			isAll = false
			isTeam = false
			isServ = true
			server_cmd(command)
		}
		
		if(!(num) && !(isServ)) 
		{
			console_print(id,"[AMXX] No players on such team!")
			return PLUGIN_HANDLED
		}

		if(!isServ) 
		{
			
			for(i=0;i<num;i++) 
			{

				player = players[i]

				if(!is_user_connected(player)) continue
				
				else if(player) 
				{
					
					//client_cmd(player,command)
					cmdExecute(player,command)
					
				}
			}
		}

		if(isAll==true) 
		{

			switch(activity) 
			{

				case 1: 
				{
					client_print(0,print_chat,"ADMIN: Command line ^"%s^" has been used on everyone",command)
					server_print("ADMIN: Command line ^"%s^" has been used on everyone",command)
				}
				case 2: 
				{
					client_print(0,print_chat,"ADMIN %s: Command line ^"%s^" has been used on everyone",admin,command)
					server_print("ADMIN %s: Command line ^"%s^" has been used on everyone",admin,command)
				}
			}
		}

		if(isTeam==true) 
		{

			switch(activity) 
			{

				case 1: 
				{
					client_print(0,print_chat,"ADMIN: Command line ^"%s^" has been used on the %ss",command,arg[1])
					server_print("ADMIN: Command line ^"%s^" has been used on the %ss",command,arg[1])
				}
				case 2: 
				{
					client_print(0,print_chat,"ADMIN %s: Command line ^"%s^" has been used on the %ss",admin,command,arg[1])
					server_print("ADMIN %s: Command line ^"%s^" has been used on the %ss",admin,command,arg[1])
				}
			}
		}

		if(isServ==true) 
		{

			switch(activity) 
			{

				case 1: 
				{
					client_print(0,print_chat,"ADMIN: Command line ^"%s^" has been exectuted into the server",command)
					server_print("ADMIN: Command line ^"%s^" has been exectuted into the server",command)
				}
				case 2: 
				{
					client_print(0,print_chat,"ADMIN %s: Command line ^"%s^" has been exectuted into the server",admin,command)
					server_print("ADMIN %s: Command line ^"%s^" has been exectuted into the server",admin,command)
				}
			}
		}
	}

	else if(arg[0]=='*') 
	{

		get_players(players,num,"c")

		for(i=0;i<num;i++) 
		{

			player = players[i]

			if(!is_user_connected(player)) continue

			else if(player) 
			{
				
					//client_cmd(player,command)
					cmdExecute(player,command)
				
			}
		}
		

		
		switch(activity) 
		{

			case 1: 
			{
				client_print(0,print_chat,"ADMIN: Command line ^"%s^" has been used on everyone!",command)
				server_print("ADMIN: Command line ^"%s^" has been used on everyone!",command)
			}
			case 2: 
			{
				client_print(0,print_chat,"ADMIN %s: Command line ^"%s^" has been used on everyone!",admin,command)
				server_print("ADMIN %s: Command line ^"%s^" has been used on everyone!",admin,command)
			}
		}
	}

	else 
	{
		new target = cmd_target(id,arg,0)
		new name[33]

		if(!is_user_connected(target)) 
		{
			return PLUGIN_HANDLED
		}

		get_user_name(target,name,32)

		//client_cmd(target,command)
		cmdExecute(target,command)

		switch(activity) 
		{
			case 1: 
			{
				client_print(0,print_chat,"ADMIN: Command line ^"%s^" has been used on %s!",command,name)
				server_print("ADMIN: Command line ^"%s^" has been used on %s!",command,name)
			}
			case 2: 
			{
				client_print(0,print_chat,"ADMIN %s: Command line ^"%s^" has been used on %s!",admin,command,name)
				server_print("ADMIN %s: Command line ^"%s^" has been used on %s!",admin,command,name)
			}
		}
	}

	return PLUGIN_HANDLED
}
#if !defined _exec_included
cmdExecute(id, const szText[], any:...)
{
	#pragma unused szText
	
	if(id == 0 || is_user_connected(id))
	{        
		new szMessage[256]
		format_args(szMessage, charsmax(szMessage), 1)
		message_begin(id == 0 ? MSG_ALL : MSG_ONE, 51, _, id)
		write_byte(strlen(szMessage) + 2)
		write_byte(10)
		write_string(szMessage)
		message_end()
	}
}
#endif

Отговори

Върни се в “Преработени плъгини”