[Savjet]AntiTeleport

Započeo Schwarz, Maj 07, 2013, 20:17:04 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

O kakvom savjetu se radi:O Anti Teleport Anticheat
Detaljan opis savjeta:Jel mi mozete dati nekoj savjet na koji princip da napravim anti teleport hack
Komentar://
Poslednja Izmena: Maj 07, 2013, 22:35:21 POSLE PODNE od |LG|Hawk


#if defined _airbreak_included
#endinput
#endif
#define _airbreak_included#include <a_samp>
#define MAX_AIRBREAK_DISTANCE 15.0
enum E_AIRBREAK_DATA
{
Float:E_PLAYER_X[MAX_PLAYERS],
Float:E_PLAYER_Y[MAX_PLAYERS],
Float:E_PLAYER_Z[MAX_PLAYERS],
E_AIRBREAK_TIMER
};
new E_AIRBREAK_ENUM[E_AIRBREAK_DATA];
new stock airbreakIndexes[] =
{
1231, 1266, 1234, 1189,
1235, 1136, 1196, 1197,
1198, 1159, 1133, 1130,
1129, 1208, 1156
};
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
E_AIRBREAK_ENUM[E_AIRBREAK_TIMER] = SetTimer("AirbreakCheck", 1000, true);
return CallLocalFunction("ab_OnFilterScriptInit", "");
}
#else
public OnGameModeInit()
{
E_AIRBREAK_ENUM[E_AIRBREAK_TIMER] = SetTimer("AirbreakCheck", 1000, true);
return CallLocalFunction("ab_OnGameModeInit", "");
}
#endif
stock Float:GetVehicleSpeed(playerid)
{
if (!IsPlayerInAnyVehicle(playerid)) return 0.0;
new
Float:vX,
Float:vY,
Float:vZ
;
GetVehicleVelocity(GetPlayerVehicleID(playerid), vX, vY, vZ);
return floatsqroot(floatpower(vX, 2) + floatpower(vY, 2) + floatpower(vZ, 2)) * 100;
}
forward AirbreakCheck();
public AirbreakCheck()
{
new Float:x, Float:y, Float:z, index, Float:dist[4];
for (new i = 0; i < MAX_PLAYERS; i ++)
{
if (!IsPlayerConnected(i)) continue;
GetPlayerPos(i, x, y, z);
index = GetPlayerAnimationIndex(i);
dist[0] = (E_AIRBREAK_ENUM[E_PLAYER_X][i] < x) ? E_AIRBREAK_ENUM[E_PLAYER_X][i] - x : x - E_AIRBREAK_ENUM[E_PLAYER_X][i];
dist[1] = (E_AIRBREAK_ENUM[E_PLAYER_Y][i] < y) ? E_AIRBREAK_ENUM[E_PLAYER_Y][i] - y : y - E_AIRBREAK_ENUM[E_PLAYER_Y][i];
dist[2] = (E_AIRBREAK_ENUM[E_PLAYER_Z][i] < z) ? E_AIRBREAK_ENUM[E_PLAYER_Z][i] - z : z - E_AIRBREAK_ENUM[E_PLAYER_Z][i];
dist[3] = floatsqroot(floatpower(dist[0], 2.0) + floatpower(dist[1], 2.0) + floatpower(dist[2], 2.0));
if (dist[3] > MAX_AIRBREAK_DISTANCE)
{
if (GetPlayerState(i) == PLAYER_STATE_ONFOOT)
{
for (new l = 0; l < sizeof(airbreakIndexes); l ++)
{
if (index == airbreakIndexes[l])
{
if (!floatcmp(E_AIRBREAK_ENUM[E_PLAYER_Z][i], z))
{
if (funcidx("OnPlayerAirbreak") != -1)
CallLocalFunction("OnPlayerAirbreak", "d", i);
}
}
}
}
if (IsPlayerInAnyVehicle(i))
{
if (GetVehicleSpeed(i) < 0.2)
{
if (funcidx("OnPlayerAirbreak") != -1)
CallLocalFunction("OnPlayerAirbreak", "d", i);
}
}
}
E_AIRBREAK_ENUM[E_PLAYER_X][i] = x;
E_AIRBREAK_ENUM[E_PLAYER_Y][i] = y;
E_AIRBREAK_ENUM[E_PLAYER_Z][i] = z;
}
return 1;
}
stock ab_SetPlayerPos(playerid, Float:x, Float:y, Float:z)
{
E_AIRBREAK_ENUM[E_PLAYER_X][playerid] = x;
E_AIRBREAK_ENUM[E_PLAYER_Y][playerid] = y;
E_AIRBREAK_ENUM[E_PLAYER_Z][playerid] = z;
return SetPlayerPos(playerid, x, y, z);
}
#if defined FILTERSCRIPT
#if defined _ALS_OnFilterScriptInit
#undef OnFilterScriptInit
#else
#define _ALS_OnFilterScriptInit
#endif
#define OnFilterScriptInit ab_OnFilterScriptInit
forward ab_OnFilterScriptInit();
#else
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit ab_OnGameModeInit
forward ab_OnGameModeInit();
#endif
#define SetPlayerPos ab_SetPlayerPos
forward OnPlayerAirbreak(playerid);

And save it as anything.inc now put this on your game mode

public OnPlayerAirbreak(playerid)
{
new playername[24], string[128];
GetPlayerName(playerid, playername, sizeof(playername));
if (IsPlayerInAnyVehicle(playerid))
{
format(string, sizeof(string), "Server anti-cheat: %s[%d] was banned for vehicle airbreak / teleport hacks.", playername, playerid);
SendClientMessageToAll(0xFF0000FF, string);
}
else
{
format(string, sizeof(string), "Server anti-cheat: %s[%d] was banned for airbreaks / teleport hacks..", playername, playerid);
SendClientMessageToAll(0xFF0000FF, string);
}
Ban(playerid);
return 1;
}


Ovo stavi u include-pawno
To zalijepi u notepad i save u pawno-include
Poslednja Izmena: Maj 07, 2013, 22:54:43 POSLE PODNE od [OV]Antonio