UlkiorraJeezy | Дата: Суббота, 14.07.2012, 08:20 | Сообщение # 1 |
 Лейтенант
Группа: Администраторы
Сообщений: 71
Статус: 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; }
На этом все. Теперь у вас стоит анти афк система)
|
|
| |