What's new

Lua Anti speed / Fly script.

menethil

Registered User
Registered User
Joined
Apr 8, 2015
Messages
4
Reaction score
0
Hello, I have a script to protect zone, When a player enters a forbidden zone, freeze and teleported to another location.

Now I'm interested in that script detects the speed of the players, you have more than walking speed 1, script freezes player without teleport.


Original Antizone script:

--[==[
]==]

ZoneCheck = {}

ZoneCheckName = "|CFF1CB619[Zone Check System]|r"

ZoneCheck.Settings = {
TimeToTeleport = 5, -- Set 0 to Instant Teleport
Spell = 9454,
};

-- AreaId, ZoneId, MapId
ZoneCheck.ZonesAreas = {
[1] = { 876, 876, 1}, -- GM Island
};

function ZoneCheck.OnEnterZone(event, player, newZone, newArea)
local PlayerName = player:GetName()
local newMap = player:GetMapId()

for i, v in ipairs(ZoneCheck.ZonesAreas) do
if newArea == v[1] and newZone == v[2] and newMap == v[3] and player:IsGM() == false then
player:AddAura(ZoneCheck.Settings.Spell, player)
player:SetLuaCooldown(ZoneCheck.Settings.TimeToTeleport, 6)
player:RegisterEvent(ZoneCheck.CooldownCheck, 1000, player:GetLuaCooldown(6))
player:SendBroadcastMessage(string.format("%s You not a GameMaster you cant enter this zone!", ZoneCheckName))
for _, v in pairs(GetPlayersInWorld()) do
if v:IsGM() == true then
v:SendBroadcastMessage(string.format("%s Player %s Enter Zone %s Area %s Map %s without GM rights", ZoneCheckName, player:GetName(), newZone, newArea, newMap))
end
end
end
end
end

function ZoneCheck.CooldownCheck(event, delay, repeats, player)
if player:GetLuaCooldown(6) == 0 then
player:RemoveEventById(event)
player:RemoveAura(ZoneCheck.Settings.Spell)
player:Teleport(1, 956.240356, -3754.055176, 5.357097)
elseif player:GetLuaCooldown(6) <= ZoneCheck.Settings.TimeToTeleport then
player:SendBroadcastMessage(string.format("%s You will teleport in %s seconds!", ZoneCheckName, player:GetLuaCooldown(6)))
if player:IsGM() == true then
player:RemoveEventById(event)
player:RemoveAura(ZoneCheck.Settings.Spell)
end
end
end

RegisterPlayerEvent(27, ZoneCheck.OnEnterZone)



Test speed script:

-- Speed
function Anti_Speed (event, pPlayer)
if pPlayer:IsGm() == false and
pPlayer:IsPlayerMoving() == true and
pPlayer:IsMounted() == false and
pPlayer:IsInCombat() == false and
pPlayer:HasAura(2983) == false and
pPlayer:HasAura(8696) == false and
pPlayer:HasAura(11305) == false and
pPlayer:HasAura(1850) == false and
pPlayer:HasAura(9821) == false and
pPlayer:HasAura(33357) == false and
--Unholy Presence
pPlayer:HasAura(48625) == false and
pPlayer:HasAura(49772) == false and
pPlayer:HasAura(50391) == false and
pPlayer:HasAura(50392) == false then

-- Set speed of player and kick him!
pPlayer:SetPlayerSpeed(7)
pPlayer:KickPlayer(0)

end
end

RegisterServerHook(26, Anti_Speed)


Could someone help me convert this script?

Other test speed script (dont work) dont now why..


print "++++++++++++++ Anti Cheat Speed Loaded!"


local Line = 1 --line for normal player speed
local Timer = 10000 --timer of chack milisecond

local function speed(event, delay, calls, player)
if(player:IsGM() == true)then
-- Can speed
else

if(player:IsMounted() == true)then
player:SetSpeed(1, 4) --on mount
else

if(player:IsPvPFlagged() == true)then
player:SetSpeed(1, 1) --pvp flag on = 1 speed
else
if(Line == 1)then
player:SetSpeed(1, 2) --player speed all World 2 set normal speed 1

end
end
end
end
end
local function AntiSpeed(event, player)
player:RegisterEvent(speed, Timer, 0)
end

RegisterPlayerEvent(3, AntiSpeed)
 
Last edited:
Top