odessa, https://cs-games.club/index.php?forums/Проблемы-с-плагинами.24/post-thread
Не забывайте включать логи cms_debug 4
Не забывайте включать логи cms_debug 4
Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature currently requires accessing the site using the built-in Safari browser.
/*
#Developed fashion by V1adJkee [vk.com/id196370862]
Qiwi +79393114860
*/
#pragma compress 1
/* -------------- [ Библиотеки ] -------------- */
#include <amxmodx>
#include <gamecms5>
/* -------------- [ Проверки ] -------------- */
#if AMXX_VERSION_NUM < 183
#error [ ERROR ] PLEASE, N0T USE 1.8.2 ( OR OLDED )
#endif
/* -------------- [ Настройки ] -------------- */
#define TIME_GIVE 60.0 /* [ ~> ] Время, через которое начнётся процесс [ <~ ] */
#define MAX_PLAYERS 32 /* [ ~> ] Кол-во слотов на вашем сервере [ <~ ] */
#define Flags "t" /* [ ~> ] Флаги которые нужно выдать [ <~ ] */
#define Time 600 /* [ ~> ] Время действия привелегии [ <~ ] */
#define AMOUT_FVIP 1 /* [ ~> ] Кол-во " Рандомных Випок " [ <~ ] */
#define ONLY_NOT_FLAGS t /* [ ~> ] Выдавать лишь тем, у кого нет флагов [ <~ ] */
/* ------------ [ UPDATE TO 1.2 ] ------------ */
#define MIN_ONLINE 6 // Минимальный Онлайн, для " Розыгрыша "
// Для отключения - 0
#define cPrefix "^4 EVENT © ^1" /* [ ~> ] Префикс в чате [ <~ ] */
#define cFade /* [ ~> ] Фейд-скрин, победителю [ <~ ] */
#define hInfo /* [ ~> ] Уведомления в DHUD [ <~ ] */
#define pRandom 1 // Тип выдачи
// 1 - выдача флага из дефайна Flags
// 2 - выдача случайного флага из szPrivleges
#if pRandom == 2
enum _:RDATA {
Name[32],
pFlags[16]
};
new szPriveleges[][RDATA] =
{ // Название, Флаги
{"LIGHT-VIP", "t"},
{"H4RD-VIP", "t"}
};
new szData[48][RDATA];
#undef Flags
#endif
#if defined cFade
#define cColor 4 // Цвет, для фейд-скрина
// 1 - Синий
// 2 - Зёленый
// 3 - Красный
// 4 - Случайное значение
#endif
#if defined hInfo
// Цвета могут принимать значения от 0 до 255
// random_num(0, 255) - внесёт случайное значение
// Координаты могут принимать значения от -1.0 до 1.0
// Получить координаты можно тут ( https://dev-cs.ru/hud/index.html )
// Отредактировать текст можно на строке 132
#define r random_num(0, 255) // Цвет ( R )
#define g random_num(0, 255) // Цвет ( G )
#define b random_num(0, 255) // Цвет ( B )
#define x 0.30 // Координата ( X )
#define y 0.52 // Координата ( Y )
#define t 5.0 // Время показа
#endif
/* -------------- [ Авторство ] -------------- */
new szPluginInfo[][] = { "Free Random Vip", "1.2", "V1adJkee" };
/* -------------- [ Переменные ] ------------- */
#if defined cFade
new g_MsgScreenFade;
#endif
public plugin_init()
{
register_plugin(szPluginInfo[0], szPluginInfo[1], szPluginInfo[2]);
set_task(TIME_GIVE, "OnGivePriveleges", 11538);
#if defined cFade
g_MsgScreenFade = get_user_msgid("ScreenFade");
#endif
}
public OnGivePriveleges()
{
#if MIN_ONLINE != 0
new iOnline = OnGetOnline();
if(iOnline < MIN_ONLINE)
{
client_print_color(0, 0, "%s На сервере недостаточно игроков [ %d / %d ]", cPrefix, iOnline, MIN_ONLINE);
return PLUGIN_HANDLED;
}
#endif
new bool:status = false;
new iCounter = 0;
while(!status)
{
new index = random_num(1, MAX_PLAYERS);
if(!is_user_connected(index)) continue;
#if defined ONLY_NOT_FLAGS
if(~get_user_flags(index) & ADMIN_USER) continue;
#endif
if( iCounter == AMOUT_FVIP )
{
status = true;
break;
}
#if pRandom == 2
new iRandom = random_num(0, sizeof(szPriveleges));
#endif
#if pRandom == 1
cmsapi_set_user_flags( index, Flags, Time, "Рандомная привелегия", false );
#else
new iFlags[16];
copy(szData[iRandom][pFlags], charsmax(szData[][pFlags]), iFlags);
cmsapi_set_user_flags( index, iFlags, Time, "Рандомная привелегия", false );
#endif
iCounter++;
new szName[25];
get_user_name(index, szName, charsmax(szName));
#if pRandom == 1
client_print_color(0, 0, "[%s] Игрок [^4 %s ^1] получил бесплатный [^4 VIP-статус ^1] на [^4 %d ^1] минут", cPrefix, szName, Time / 60);
#else
client_print_color(0, 0, "[%s] Игрок [^4 %s ^1] получил бесплатный [^4 %s ^1] на [^4 %d ^1] минут", cPrefix, szName, szPriveleges[iRandom][iRandom], Time / 60);
#endif
#if defined cFade
FadePlayer(index);
#endif
#if defined hInfo
for( new i = 1; i <= MAX_PLAYERS; i++ )
{
if( iCounter > 1 )
{
set_hudmessage ( r, g, b, x, y + 0.10, 0, 0.0, t, 0.0, 0.0, true );
} else {
set_hudmessage ( r, g, b, x, y, 0, 0.0, t, 0.0, 0.0, true );
}
#if pRandom == 1
show_dhudmessage(i, "Игрок [^4 %s ^1] получил бесплатный VIP^nНа %d минут", szName, Time / 60);
#else
show_dhudmessage(i, "Игрок [^4 %s ^1] получил бесплатный %s^nНа %d минут", szName, szPriveleges[iRandom], Time / 60);
#endif
}
#endif
}
return PLUGIN_HANDLED;
}
#if defined cFade
public FadePlayer(index)
{
message_begin(MSG_ONE_UNRELIABLE, g_MsgScreenFade, .player = index);
write_short(1<<10);
write_short(1<<11);
write_short(0x0000);
#if cColor == 1
write_byte(0);
write_byte(0);
write_byte(200);
#endif
#if cColor == 2
write_byte(0);
write_byte(100);
write_byte(0);
#endif
#if cColor == 3
write_byte(100);
write_byte(0);
write_byte(0);
#endif
#if cColor == 4
write_byte(random_num(0, 255));
write_byte(random_num(0, 255));
write_byte(random_num(0, 255));
#endif
write_byte(75);
message_end();
}
#endif
#if MIN_ONLINE != 0
public OnGetOnline() // 3a4em mne get_playersnum, kek.
{
new iPlayers;
for( new i = 1; i != MAX_PLAYERS; i++ )
{
if(!is_user_connected(i)) continue;
iPlayers++;
}
return iPlayers;
}
#endif