UPDATE #2
ADDED: ANTI-CR SYSTEM (PREVENTS A PLAYER FROM SHOOTING RPG WITHIN 24M IF AN ENEMY IS DETECTED NEARBY HIM)
ADDED: ANTI-CR SYSTEM (PREVENTS A PLAYER FROM SHOOTING RPG WITHIN 24M IF AN ENEMY IS DETECTED NEARBY HIM)
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: umar4911 on Aug 06, 2024, 09:23 AMA lot things to care of for example.Idk, I have edited this code and made IsFlyingNow and IsFallingNow but didnt publish them
What if I enter a vehicle very quickly after spawning and drive it?
What if someone hits me a car and I am sent flying?
class PlayerStats
{
nowcount = false;
}
function onPlayerDeath(player, reason) {
stats[ player.ID ].nowcount = false;
}
function s(player)
{
local p = FindPlayer(player);
local ID = p.ID;
stats[ ID ].nowcount= true;
}
function onPlayerSpawn( player )
{
NewTimer("s", 1000, 1, player.ID); // just to make delay and calculate speed after player position is set
}
function speedhack(player)
{
local p = FindPlayer(player.ID), Pid = p.ID, x = p.Pos.x, y = p.Pos.y, countxi/* X initial*/, countyi;// Y initial
if(x < 0) x = x * -1; // if x is -5, so when you do this equation (-5 * -1) it will be 5 and we can count it easily with this way
if (y < 0) y = y * -1;
countxi = x;
countyi = y;
NewTimer("speedhack2", 1000, 1, Pid, countxi, countyi);
print("=VG=Zer0neX's anti-speedhack system is loaded");
}
function speedhack2(player, countxi, countyi)
{
local p = FindPlayer(player);
local Pid = p.ID;
if (!p) {
return;
}
local x = p.Pos.x, y = p.Pos.y, z = p.Pos.z, count, countx, county, result, fresult;
if (x < 0) x = x * -1; /* if x is -5, so when you do this equation (-5 * -1) it will be 5 and we can count it easily with this way */
if (y < 0) y = y * -1;
countx = (x - countxi) / 1; // I've put () to calculate the final result of x before calculating time
county = (y - countyi) / 1; // In both calculations, '1' represents the time as in NewTimer()
count = sqrt((countx * countx) + (county * county)); // count = countx^2 + county^2 inside a root in math
fresult = count; // final result (Speed)
if (count < 0) fresult = count * -1;
else fresult = count;// to return it to an integer which is higher than '0', if result is -30, so it will be 30..
if (fresult > 18.00000) // You can change if needed
{
local P = GetPlayer(p.Name);
print(fresult + "");
Message("[#FFF000]"+P+" [#FF0000]has been kicked for modifying his speed. ([#FFA540]"+fresult+"m/s[#FF0000])");
KickPlayer(P);
}
else {
return onPlayerMove(player, x, y, z, a, b, c); // periodically analyzing speed of player
}
}
-------------------------------------------------------------------------------------------------------------function onPlayerMove(player, x, y, z, a, b, c)
{
if(stats[ player.ID ].nowcount == true && player.IsSpawned == true) speedhack(player);
}
[INFO]: keep credits & if you were kicked and u weren't using hacks, so you can change the fresult