addEventHandler("onPlayerDamage", getRootElement(),
function(attacker, weapon, body, loss)
if not (attacker == source) then
local attackAccount = getPlayerAccount(attacker)
local sourceAccount = getPlayerAccount(source)
if not isGuestAccount(sourceAccount) then
if not isGuestAccount(attackAccount) then
setAccountData(attackAccount, "antideslog", false)
setTimer(function()
for i, v in ipairs(getElementsByType("player"))do -- check if the player still connected in the server
if v == attacker then
setAccountData(attackAccount, "antideslog", true)
-- The attacker is not in combat anymore after 1 min
end
end
end, 60000, 1)
end
setAccountData(sourceAccount, "antideslog", false)
setTimer(function()
for i, v in ipairs(getElementsByType("player"))do -- check if the player still connected in the server
if v == source then
setAccountData(sourceAccount, "antideslog", true)
-- The player who receive the shot is not in combat anymore after 1 min
end
end
end, 60000, 1)
end
-- They are now in combat.
end
end)
addEventHandler("onPlayerLogin", getRootElement(),
function(previous, current, autologin)
if current then
local data = getAccountData(current, "antideslog")
if (data == true) then
-- ok, he can play
elseif(data == false)then
-- ban the player
setAccountData(current, "antideslog", true)
banPlayer(source)
else
end
end
end)
This is a script for Anti Combat Relog and i need help transforming it in a resource if someone can make the script better it's ok :3 Please help me!