12.08.2010, 09:25
С лютой долей испралений имеем:
PHP Code:
#include <a_samp>
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
new BugTickCountOld[MAX_PLAYERS],BugTickCountNew[MAX_PLAYERS],bool: PressedFire[MAX_PLAYERS];
public OnFilterScriptInit()
{
print("Antibug Collection 0.1 by Psycho loaded!");
for(new i = 0; i < MAX_PLAYERS; i++)
{
PressedFire[i] = false;
BugTickCountOld[i] = 0;
BugTickCountNew[i] = 0;
}
return 1;
}
public OnFilterScriptExit()
{
print("Antibug Collection 0.1 Psycho unloaded!");
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new wid = GetPlayerWeapon(playerid);
BugTickCountNew[playerid] = GetTickCount();
new ticks = BugTickCountNew[playerid] - BugTickCountOld[playerid];
if(PressedFire[playerid] && PRESSED(KEY_CROUCH))
{
if(22 <= wid <= 38)
{
if(10 < ticks < 1500 && GetPlayerSpeed(playerid) > 0)
{
new string[128];
GetPlayerName(playerid, string, MAX_PLAYER_NAME);
format(string,128,"%s (id: %d) èñïîëüçîâàë áàã-ïðèñÿäêó.",string,playerid);
SendClientMessage(playerid,0xffffffff,string);
SetPlayerVelocity(playerid,0.0,0.0,7.0);
}
PressedFire[playerid] = false;
}
}
if (PRESSED(KEY_FIRE))
{
PressedFire[playerid] = true;
BugTickCountOld[playerid] = GetTickCount();
}
return 1;
}
stock GetPlayerSpeed(playerid)
{
new Float:ST[3];
if(IsPlayerInAnyVehicle(playerid))GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
ST[0] = floatsqroot(floatpower(ST[0], 2.0) + floatpower(ST[1], 2.0) + floatpower(ST[2], 2.0));
return floatround(ST[3])*100;
}