Вот собственно код
Code
/*
_______________________
[ ]
[ AntiKill Filterscript ]
[ Version 1.2 ]
[ [2008] (C) by MaVe ]
[_______________________]
°°° Don't take my scripts and call them your's! °°°
==> Go to line 37 to define your own exceptions for AntiKill.
*/
#include <a_samp>
new bool:KillFreezed[MAX_PLAYERS];
new RestSeconds[MAX_PLAYERS];
#define NOKILLING_STR "~r~No Killing here!~n~~n~~b~You are freezed~n~~n~~g~%d ~w~secs left"
#define GAMETEXT_STYLE 5
forward GameTextUpdate(playerid);
public OnPlayerDisconnect(playerid, reason)
{
KillFreezed[playerid] = false;
RestSeconds[playerid] = 0;
return 1;
}
// Define your own exceptions, e.g. DM-check
stock Exception(playerid)
{
if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return 1; // Don't check for killings if the player is the driver of a vehicle, thanks to kaisersouse.
return 0;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_FIRE && !KillFreezed[playerid] && !Exception(playerid))
{
KillFreezed[playerid] = true;
TogglePlayerControllable(playerid, false);
RestSeconds[playerid] = 5;
new str[128];
format(str, sizeof(str), NOKILLING_STR, RestSeconds[playerid]);
GameTextForPlayer(playerid, str, 1000, GAMETEXT_STYLE);
SetTimerEx("GameTextUpdate", 1000, 0, "i", playerid);
}
return 1;
}
public GameTextUpdate(playerid)
{
if (RestSeconds[playerid] != 0)
{
RestSeconds[playerid]--;
new str[128];
format(str, sizeof(str), NOKILLING_STR, RestSeconds[playerid]);
GameTextForPlayer(playerid, str, 1000, GAMETEXT_STYLE);
SetTimerEx("GameTextUpdate", 1000, 0, "i", playerid);
}
else
{
GameTextForPlayer(playerid, "~r~No Killing again!", 1000, GAMETEXT_STYLE);
KillFreezed[playerid] = false;
TogglePlayerControllable(playerid, true);
}
}
public OnFilterScriptExit()
{
for (new i=0; i<MAX_PLAYERS; i++)
{
if (KillFreezed[i])
{
TogglePlayerControllable(i, true);
KillFreezed[i] = false;
}
}
return 1;
}
По сути скрипт не должен давать пользоваться оружием на территории спавна. Это всё хорошо работает. Но и за приделами спавна тоже запрещает пользоваться =/ Что делать?