amx_message2 0/1/2 (0 - Chat ; 1 - HUD ; 2 - DHUD) - как да излиза второто съобщение
amx_sc_advert_time (Default: 300.0) - през колко секунди да се показва рекламното съобщение.
/scadvert - включва / изключва advert съобщенията в чата. По подразбиране е включено.
Код за потвърждение: Избери целия код
#include <amxmodx>
#include <formatin>
#include <cromchat>
#if AMXX_VERSION_NUM < 183
#include <dhudmessage>
#endif
// Defines
#define AUTHOR "summertime vibes"
#define VERSION "1.2"
#define HudPrefix "[HUD Prefix]"
#define DHUDPrefix "[DHUD PREFIX]"
#define firstcommand "/command1"
#define secondcommand "/command2"
// New
new pCvar, pCvar2, cvar_time
new bool:g_AdvertMessage = true
// New Const
new const g_iCommand[] = { "/command1" }
new const g_iCommandTwo[] = { "/command2" }
new const g_iCommandAdvert[] = { "/scadvert" }
public plugin_init()
{
register_plugin("Server Commands", VERSION, AUTHOR)
for(new i; i<sizeof(g_iCommand); i++)
{
register_clcmd(formatin("say %s", g_iCommand[i]), "cmd1")
register_clcmd(formatin("say_team %s", g_iCommand[i]), "cmd1")
}
for(new i; i<sizeof(g_iCommandTwo); i++)
{
register_clcmd(formatin("say %s", g_iCommandTwo[i]), "cmd2")
register_clcmd(formatin("say_team %s", g_iCommandTwo[i]), "cmd2")
}
for(new i; i<sizeof(g_iCommandAdvert); i++)
{
register_clcmd(formatin("say %s", g_iCommandAdvert[i]), "advertcmd")
register_clcmd(formatin("say_team %s", g_iCommandAdvert[i]), "advertcmd")
}
pCvar = register_cvar("amx_sc_message", "0") // 0 - chat ; 1 - hud ; 2 - dhud
pCvar2 = register_cvar("amx_sc_message2", "0") // 0 - chat ; 1 - hud ; 2 - dhud
cvar_time = register_cvar("amx_sc_advert_time", "300.0")
set_task(get_pcvar_float(cvar_time), "Advert", _,_,_, "b");
CC_SetPrefix("&x04[Server Commands]")
}
public Advert()
if(g_AdvertMessage)
{
CC_SendMessage(0, "^x03Write in the chat &x01%s &x03or &x01%s &x03to view the commands information&x01.",firstcommand, secondcommand);
return
}
public advertcmd(id)
{
g_AdvertMessage = !g_AdvertMessage
CC_SendMessage(id, "&x01Advert Messages have been &x03%s&x01.", g_AdvertMessage ? "enabled" : "disabled" );
}
public cmd(id)
{
switch(get_pcvar_num(pCvar))
{
case 0: CC_SendMessage(id, "^x04The text when you write the command.")
case 1:
{
set_hudmessage(random(256), random(256), random(256), -1.0, 0.26, 2, 6.0, 12.0)
show_hudmessage(id, "%s The text when you write the command.",HudPrefix)
}
case 2:
{
set_dhudmessage(random(256), random(256), random(256), -1.0, 0.26, 2, 6.0, 12.0)
show_dhudmessage(id, "%s The text when you write the command.",DHUDPrefix)
}
}
}
public cmd2(id)
{
switch(get_pcvar_num(pCvar2))
{
case 0: CC_SendMessage(id, "^x04The text when you write the command.")
case 1:
{
set_hudmessage(random(256), random(256), random(256), -1.0, 0.26, 2, 6.0, 12.0)
show_hudmessage(id, "%s The text when you write the command.",HudPrefix)
}
case 2:
{
set_dhudmessage(random(256), random(256), random(256), -1.0, 0.26, 2, 6.0, 12.0)
show_dhudmessage(id, "%s The text when you write the command.",DHUDPrefix)
}
}
}
Ако има интерес към плъгина бих му правил ъпдейти с радост.
Formatin библиотеката: