Тема за споделяне на всякакви AMXX команди

Мястото за намиране и споделяне на всякакви AMXX плъгини.
Отговори
Потребителски аватар

Автор на темата
OciXCrom™ MKD
Администратор
Администратор
Мнения: 3219
Регистриран: 06 окт 2016, 19:20
Местоположение: /resetscore
Години: 20
Контакти:

Тема за споделяне на всякакви AMXX команди

Мнение от OciXCrom™ MKD » 20 мар 2017, 22:28

Тъй като често виждам заявки за определени команди, реших тук да поставям всички команди, които съм направил, с цел потребители по-лесно да ги намират. Всеки може да ползва един от кодовете по-долу за да направи някоя собствена команда. Ако всичко е наред, ще я добавя в първия пост от темата.

Всеки плъгин съдържа настройки в началото на кода и обяснение за всяка една от тях. Прочетете ги внимателно преди да задавате въпроси. Можете да изключите командата в конзолата или чата като сложите // в началото на реда.
amx_grab & /grab • телепортира играча до администратора
amx_gravity & /gravity • променя гравитацията на играча
amx_revive & /revive • съживява играча

Потребителски аватар

MF1 PrivateS
Потребител
Потребител
Мнения: 268
Регистриран: 12 окт 2016, 21:15
Местоположение: Varna
Контакти:

Re: Тема за споделяне на всякакви AMXX команди

Мнение от MF1 PrivateS » 06 апр 2017, 17:35

Команда: amx_removei / amx_restorei
Описание: Командата amx_removei премахва имунитета на админ , командата amx_restorei връща имунитета на админ
Автор: OciXCrom

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

#include <amxmodx>
#include <amxmisc>

#define PLUGIN_VERSION "1.0"

new bool:g_bImmune[33]

public plugin_init()
{
    register_plugin("Remove Immunity", PLUGIN_VERSION, "OciXCrom")
    register_concmd("amx_removei", "ToggleImmunity", ADMIN_RCON, "<nick|#userid>")
    register_concmd("amx_restorei", "ToggleImmunity", ADMIN_RCON, "<nick|#userid>")
}

public client_putinserver(id)
    g_bImmune[id] = false

public ToggleImmunity(id, iLevel, iCid)
{
    if(!cmd_access(id, iLevel, iCid, 2))
        return PLUGIN_HANDLED
    
    new szPlayer[32]
    read_argv(1, szPlayer, charsmax(szPlayer))
    
    new iPlayer = cmd_target(id, szPlayer, CMDTARGET_ALLOW_SELF)
    
    if(!iPlayer)
        return PLUGIN_HANDLED
        
    new szName[32]
    get_user_name(iPlayer, szName, charsmax(szName))
    
    new szCommand[8]
    read_argv(0, szCommand, charsmax(szCommand))
    
    switch(szCommand[6])
    {
        case 'm':
        {
            if(is_user_immune(iPlayer))
            {
                remove_user_flags(iPlayer, ADMIN_IMMUNITY)
                console_print(id, "* Removed immunity from %s.", szName)
                g_bImmune[iPlayer] = true
            }
            else
                console_print(id, "* %s doesn't have immunity!", szName)
        }
        case 's':
        {
            if(is_user_immune(iPlayer))
                console_print(id, "* %s already has immunity!", szName)
            else if(!g_bImmune[iPlayer])
                console_print(id, "* %s didn't have immunity, so you can't restore it!", szName)
            else
            {
                set_user_flags(iPlayer, ADMIN_IMMUNITY)
                console_print(id, "* Restored %s's immunity.", szName)
            }
        }
    }
    
    return PLUGIN_HANDLED
}

bool:is_user_immune(id)
    return get_user_flags(id) & ADMIN_IMMUNITY ? true : false
PrivateServ.INFO # BaseBuilder v6.5 [AutoLock|CS:GO|Shop]
IP: 79.124.56.90:27019
bb_mf1_pirate
bb_mf1_pirate2
PrivateServ.INFO

Потребителски аватар

Fr0sTt FTW;
Потребител
Потребител
Мнения: 133
Регистриран: 16 фев 2018, 19:11

Тема за споделяне на всякакви AMXX команди

Мнение от Fr0sTt FTW; » 04 мар 2018, 12:06

На базата на твойте команди направих amx_health и amx_armor

Health Command:

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

#include <amxmodx>
#include <amxmisc>
#include <cromchat>
#include <fun>

/* The admin flag */
#define ADMIN_FLAG "e"

/* The console command. Put // in front to disable it */
new const CONSOLE_COMMAND[] = "amx_health"

/* The chat command. Put // in front to disable it */
new const CHAT_COMMAND[] = "/health"

/* Whether the command can be used on yourself (true = yes; false = no) */
new const bool:USE_ON_SELF = true

/* The chat prefix. Put // in front to disable it */
new const COMMAND_PREFIX[] = "&x04[AMXX]"

/* --- End of settings --- */

#define PLUGIN_VERSION "1.0"
new ADMIN_FLAG_BIT

public plugin_init()
{
	register_plugin("Health command", PLUGIN_VERSION, "OciXCrom @ amxx-bg.info")
	register_cvar("CRXCMD_Health", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
	ADMIN_FLAG_BIT = read_flags(ADMIN_FLAG)
	
	#if defined CONSOLE_COMMAND
	register_concmd(CONSOLE_COMMAND, "Cmd_Main", ADMIN_FLAG_BIT, "<nick|#userid> <hp amount>")
	#endif
	
	#if defined CHAT_COMMAND
	register_clcmd("say", "Cmd_Say")
	register_clcmd("say_team", "Cmd_Say")
	#endif
	
	#if defined COMMAND_PREFIX
	CC_SetPrefix(COMMAND_PREFIX)
	#endif
}

#if defined CONSOLE_COMMAND
public Cmd_Main(id, iLevel, iCid)
{
	if(!cmd_access(id, iLevel, iCid, 3))
		return PLUGIN_HANDLED
		
	new szPlayer[32], szAmount[8]
	read_argv(1, szPlayer, charsmax(szPlayer))
	read_argv(2, szAmount, charsmax(szAmount))
	DoAction(id, szPlayer, szAmount)
	return PLUGIN_HANDLED
}
#endif

#if defined CHAT_COMMAND
public Cmd_Say(id)
{
	if(~get_user_flags(id) & ADMIN_FLAG_BIT)
		goto @END
		
	static szArgs[64]
	read_args(szArgs, charsmax(szArgs))
	remove_quotes(szArgs)
	
	if(equali(szArgs[0], CHAT_COMMAND, charsmax(CHAT_COMMAND)))
	{
		new szPlayer[32], szAmount[8]
		parse(szArgs, szArgs, charsmax(szArgs), szPlayer, charsmax(szPlayer), szAmount, charsmax(szAmount))
		DoAction(id, szPlayer, szAmount)
		return PLUGIN_HANDLED
	}
	
	@END:
	return PLUGIN_CONTINUE
}
#endif

DoAction(id, szPlayer[], szAmount[])
{
	new iPlayer = cmd_target(id, szPlayer, CMDTARGET_ONLY_ALIVE)
	
	if(!iPlayer)
		return PLUGIN_HANDLED
	
	if(!is_str_num(szAmount))
	{
		CC_SendMessage(id, "Invalid health amount: &x07%s", szAmount)
		return PLUGIN_HANDLED
	}
	
	new iAmount = str_to_num(szAmount)
		
	if(id == iPlayer && !USE_ON_SELF)
	{
		CC_SendMessage(id, "You can't use this command on yourself!")
		return PLUGIN_HANDLED
	}
	

	
	new szName[2][32]
	get_user_name(id, szName[0], charsmax(szName[]))
	get_user_name(iPlayer, szName[1], charsmax(szName[]))
	SetHealth( iPlayer, iAmount );
	CC_LogMessage(0, _, "ADMIN &x03%s &x01set &x04%i &x01health on &x03%s", szName[0], iAmount, szName[1])
	return PLUGIN_CONTINUE
}

SetHealth( client, iHealth )
{
    if( iHealth <= 0 )
    {
        user_kill( client );
    }
    else
    {
        set_user_health( client, iHealth );
    }
}  
Armor Command:

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

#include <amxmodx>
#include <amxmisc>
#include <cromchat>
#include <fun>

/* The admin flag */
#define ADMIN_FLAG "e"

/* The console command. Put // in front to disable it */
new const CONSOLE_COMMAND[] = "amx_armor"

/* The chat command. Put // in front to disable it */
new const CHAT_COMMAND[] = "/armor"

/* Whether the command can be used on yourself (true = yes; false = no) */
new const bool:USE_ON_SELF = true

/* The chat prefix. Put // in front to disable it */
new const COMMAND_PREFIX[] = "&x04[AMXX]"

/* --- End of settings --- */

#define PLUGIN_VERSION "1.0"
new ADMIN_FLAG_BIT

public plugin_init()
{
	register_plugin("Armor command", PLUGIN_VERSION, "OciXCrom @ amxx-bg.info")
	register_cvar("CRXCMD_Armor", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
	ADMIN_FLAG_BIT = read_flags(ADMIN_FLAG)
	
	#if defined CONSOLE_COMMAND
	register_concmd(CONSOLE_COMMAND, "Cmd_Main", ADMIN_FLAG_BIT, "<nick|#userid> <armor amount>")
	#endif
	
	#if defined CHAT_COMMAND
	register_clcmd("say", "Cmd_Say")
	register_clcmd("say_team", "Cmd_Say")
	#endif
	
	#if defined COMMAND_PREFIX
	CC_SetPrefix(COMMAND_PREFIX)
	#endif
}

#if defined CONSOLE_COMMAND
public Cmd_Main(id, iLevel, iCid)
{
	if(!cmd_access(id, iLevel, iCid, 3))
		return PLUGIN_HANDLED
		
	new szPlayer[32], szAmount[8]
	read_argv(1, szPlayer, charsmax(szPlayer))
	read_argv(2, szAmount, charsmax(szAmount))
	DoAction(id, szPlayer, szAmount)
	return PLUGIN_HANDLED
}
#endif

#if defined CHAT_COMMAND
public Cmd_Say(id)
{
	if(~get_user_flags(id) & ADMIN_FLAG_BIT)
		goto @END
		
	static szArgs[64]
	read_args(szArgs, charsmax(szArgs))
	remove_quotes(szArgs)
	
	if(equali(szArgs[0], CHAT_COMMAND, charsmax(CHAT_COMMAND)))
	{
		new szPlayer[32], szAmount[8]
		parse(szArgs, szArgs, charsmax(szArgs), szPlayer, charsmax(szPlayer), szAmount, charsmax(szAmount))
		DoAction(id, szPlayer, szAmount)
		return PLUGIN_HANDLED
	}
	
	@END:
	return PLUGIN_CONTINUE
}
#endif

DoAction(id, szPlayer[], szAmount[])
{
	new iPlayer = cmd_target(id, szPlayer, CMDTARGET_ONLY_ALIVE)
	
	if(!iPlayer)
		return PLUGIN_HANDLED
	
	if(!is_str_num(szAmount))
	{
		CC_SendMessage(id, "Invalid armor amount: &x07%s", szAmount)
		return PLUGIN_HANDLED
	}
	
	new iAmount = str_to_num(szAmount)
		
	if(id == iPlayer && !USE_ON_SELF)
	{
		CC_SendMessage(id, "You can't use this command on yourself!")
		return PLUGIN_HANDLED
	}
	

	
	new szName[2][32]
	get_user_name(id, szName[0], charsmax(szName[]))
	get_user_name(iPlayer, szName[1], charsmax(szName[]))
	SetArmor( iPlayer, iAmount );
	CC_LogMessage(0, _, "ADMIN &x03%s &x01set &x04%i &x01armor on &x03%s", szName[0], iAmount, szName[1])
	return PLUGIN_CONTINUE
}

SetArmor( client, iArmor )
{
    if( iArmor <= 0 )
    {
        user_kill( client );
    }
    else
    {
        set_user_armor( client, iArmor );
    }
}  

Отговори

Върни се в “Плъгини”

Кой е на линия

Потребители, разглеждащи този форум: Няма регистрирани потребители и 1 гост