Pawno-SAMP
Главная
Вход
Регистрация
Вторник, 15.07.2025, 23:47Приветствую Вас Гость | RSS
[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
[Мануал] своеобразная АФК система
UlkiorraJeezyДата: Суббота, 14.07.2012, 08:20 | Сообщение # 1
Лейтенант
Группа: Администраторы
Сообщений: 71
Репутация: 0
Статус: Offline
1. Ко всем new добовляем:
Code
new afk[MAX_PLAYERS];
new Float:x;
new Float:y;
new Float:z;
new cage;
new cage1;
new cage2;
new cage3;
new cage4;
new muted[MAX_PLAYERS];  

2. в public OnPlayerCommandText добавляем

Code
    if (strcmp("/afk", cmdtext, true, 10) == 0)
     {
         if (afk[playerid] == 0)
          {
          GetPlayerPos(playerid, x, y, z);
          muted[playerid] = 1;
         SetPlayerHealth(playerid, 100000000000);
           new name[MAX_PLAYER_NAME], string[44];
         GetPlayerName(playerid, name, sizeof(name));
         format(string, sizeof(string), "%s is AFK.",name);
         SendClientMessageToAll(0xFFFF00AA, string);
         afk[playerid] = 1;
         SetPlayerPos(playerid, 2261.4995, 1398.8009, 30.1234);
         new Float:xi = 2261.4995;
         new Float:yi = 1398.8009;
         new Float:zi = 30.1234;
         cage = CreateObject(985, xi, yi+4, zi, 0.0, 0.0, 0.0);
            cage2 = CreateObject(985, xi+4, yi, zi, 0.0, 0.0, 90.0);
            cage3 = CreateObject(985, xi-4, yi, zi, 0.0, 0.0, 270.0);
            cage4 = CreateObject(985, xi, yi-4, zi, 0.0, 0.0, 180.0);
         }
         else
         {
         SendClientMessage(playerid, 0xFFFF00AA,"Вы уже - AFK!");
         }
         return 1;
     }
      
     if (strcmp("/back", cmdtext, true, 10) == 0)
     {
         if (afk[playerid] == 1)
         {
         SetPlayerHealth(playerid, 100);
           new name[MAX_PLAYER_NAME], string[44];
         GetPlayerName(playerid, name, sizeof(name));
         format(string, sizeof(string), "%s is BACK.",name);
         SendClientMessageToAll(0xFFFF00AA, string);
         afk[playerid] = 0;
         SetPlayerPos(playerid, x, y, z);
         DestroyObject(cage);
         DestroyObject(cage1);
         DestroyObject(cage2);
         DestroyObject(cage3);
         DestroyObject(cage4);
         muted[playerid] = 0;
         }
         else
         {
         SendClientMessage(playerid, 0xFFFF00AA, "Вы вышли из AFK!");
         }
         return 1;
     }
     return 0;
}  

3. Создаём public OnPlayerDeath(playerid, killerid, reason) и вставляем в него
Code
{
     afk[playerid] = 0;
     return 1;
}

4. в public OnPlayerText вставляем
Code
{
     if (muted[playerid] == 1)
     {
         SendClientMessage(playerid, 0xFFFF00AA, "ВЫ НЕ МОЖЕТЕ ГОВОРИТЬ В ТО ВРЕМЯ КАК AFK!");
         return 0;
     }
     return 1;
}


На этом все. Теперь у вас стоит анти афк система)
 
  • Страница 1 из 1
  • 1
Поиск:


Пожертвования на развитие сайта. Yandex: 410011459268530 © 2025
Создать бесплатный сайт с uCoz