• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

RevScripts Update Battle Event Script

Gaber Zen

Well-Known Member
Joined
Apr 22, 2023
Messages
243
Reaction score
64
Location
Egypt
Hello everyone
can Some one update Battle event
Battle event when player Dead Back Templo, other team winner
can fix it to can rush player dead and to battle agine?
i can add position in Edit map to back agine rush but how fix code
lib
Sourc 0.4

Lua:
_Lib_Battle_Info = {
Reward = {
exp = {true, 10000}, items = {true, 6544, 100}, premium_days = {false, 2}
},
TeamOne = {name = "Black Assassins", storage = 140120, pos = {x=1035,y=1166,z=7}},
TeamTwo = {name = "Red Barbarians",storage = 140121,pos = {x=983,y=1166,z=7}},
storage_count = 180400,
tpPos = {x=999, y=1004, z=7},
limit_Time = 5 -- limite de tempo para adentrar o evento
}
function resetBattle()
setGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage, 0)
setGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0)
end
function OpenWallBattle()
local B = {
{3517,{x=1009, y=1164, z=7, stackpos = 1}},
{3517,{x=1009, y=1165, z=7, stackpos = 1}},
{3517,{x=1009, y=1166, z=7, stackpos = 1}},
{3517,{x=1009, y=1167, z=7, stackpos = 1}}
}
for i = 1, #B do
if getTileItemById(B[i][2], B[i][1]).uid == 0 then
doCreateItem(B[i][1], 1, B[i][2])
else
doRemoveItem(getThingfromPos(B[i][2]).uid,1)
end
end
end
function doBroadCastBattle(type, msg)
for _, cid in pairs(getPlayersOnline()) do
if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage) >= 1 or getPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage) >= 1 then
doPlayerSendTextMessage(cid,type,msg)
end
end
end
function removeBattleTp()
local t = getTileItemById(_Lib_Battle_Info.tpPos, 1387).uid
return t > 0 and doRemoveItem(t) and doSendMagicEffect(_Lib_Battle_Info.tpPos, CONST_ME_POFF)
end
function getWinnersBattle(storage)
local str, c = "" , 0
for _, cid in pairs(getPlayersOnline()) do
if getPlayerStorageValue(cid, storage) == 1 then
if _Lib_Battle_Info.Reward.exp[1] == true then doPlayerAddExperience(cid, _Lib_Battle_Info.Reward.exp[2]) end
if _Lib_Battle_Info.Reward.items[1] == true then doPlayerAddItem(cid, _Lib_Battle_Info.Reward.items[2], _Lib_Battle_Info.Reward.items[3]) end
if _Lib_Battle_Info.Reward.premium_days[1] == true then doPlayerAddPremiumDays(cid, _Lib_Battle_Info.Reward.premium_days[2]) end
doRemoveCondition(cid, CONDITION_OUTFIT)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
setPlayerStorageValue(cid, storage, -1)
c = c+1
end
end
str = str .. ""..c.." Player"..(c > 1 and "s" or "").." from team "..(getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage) == 0 and _Lib_Battle_Info.TeamTwo.name or _Lib_Battle_Info.TeamOne.name).." won the event battlefield!"
resetBattle()
OpenWallBattle()
return doBroadcastMessage(str)
end
function CheckEvent(delay)
if delay > 0 and getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then
doBroadcastMessage("[BattleField Event] We are waiting "..getGlobalStorageValue(_Lib_Battle_Info.storage_count).." players to Battlefield starts")
elseif delay == 0 and getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then
for _, cid in pairs(getPlayersOnline()) do
if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage) >= 1 or getPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage) >= 1 then
doRemoveCondition(cid, CONDITION_OUTFIT)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
setPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage, -1)
setPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage, -1)
end
end
doBroadcastMessage("The event cannot be started because not had enough players.")
setGlobalStorageValue(_Lib_Battle_Info.storage_count, 0)
resetBattle()
removeBattleTp()
end
addEvent(CheckEvent, 60000, delay-1)
end
<movevent type="StepIn" actionid="45000" event="script" value="BattleMovements.lua"/>
Code:
local conditionBlack = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditionBlack, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditionBlack, {lookType = 134, lookHead = 114, lookBody = 114, lookLegs = 114, lookFeet = 114})
local conditionRed = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditionRed, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(conditionRed, {lookType = 143, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})
function onStepIn(cid, item, position, fromPosition)
if not isPlayer(cid) then return true end
if getPlayerAccess(cid) > 3 then
return doTeleportThing(cid, _Lib_Battle_Info.TeamOne.pos)
end
if getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then
local getMyTeam = getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage) < getGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage) and {_Lib_Battle_Info.TeamOne.storage,_Lib_Battle_Info.TeamOne.pos,_Lib_Battle_Info.TeamOne.name,conditionBlack}  or {_Lib_Battle_Info.TeamTwo.storage,_Lib_Battle_Info.TeamTwo.pos, _Lib_Battle_Info.TeamTwo.name, conditionRed}
doAddCondition(cid, getMyTeam[4])
setPlayerStorageValue(cid,getMyTeam[1], 1)
setGlobalStorageValue(getMyTeam[1], getGlobalStorageValue(getMyTeam[1])+1)
doTeleportThing(cid, getMyTeam[2])
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will join the team " .. getMyTeam[3] .. "!")
setGlobalStorageValue(_Lib_Battle_Info.storage_count, getGlobalStorageValue(_Lib_Battle_Info.storage_count)-1)
end
if getGlobalStorageValue(_Lib_Battle_Info.storage_count) == 0 then
removeBattleTp()
doBroadcastMessage("Battlefield will start in 1 minutes, please create your strategy!")
addEvent(doBroadcastMessage, 1*60*1000-500, "BattleField will begin now!")
addEvent(OpenWallBattle, 1*60*1000)
end
return true
end
Createscript
Lua:
--[[
    Capture The Flag System
    Author: Maxwell Denisson(MaXwEllDeN)
    Version: 2.0
    Contact: [email protected]
]]


local CTF = CTF_LIB

function onStatsChange(cid, attacker, type, combat, value)
    if getPlayerStorageValue(cid, 16700) ~= -1 and type == 1 and getCreatureHealth(cid) - value <= 0 then
        if getPlayerStorageValue(cid, 16702) ~= -1 then
            CTF.returnFlag(cid, 1)
        end

        doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
        doCreatureAddMana(cid, getCreatureMaxMana(cid))
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
        return false
    end

    return true
end

function onLogout(cid)
    if getPlayerStorageValue(cid, 16700) ~= -1 then
        CTF.removePlayer(cid)
    end

   return true
end

function onCombat(cid, target)
    if getPlayerStorageValue(cid, 16700) ~= -1 then
        if getPlayerStorageValue(cid, 16700) == getPlayerStorageValue(target, 16700) then
            return false
        end
    end

    return true
end

function onAttack(cid, target)
    if getPlayerStorageValue(cid, 16700) ~= -1 then
        if getPlayerStorageValue(cid, 16700) == getPlayerStorageValue(target, 16700) then
            return false
        end
    end

    return true
end
 
Last edited:
Tfs have backward compatibility support, which means put those files in latest tfs and i don't think you will have errors, nothing complicated compat.lua won't be able to comprehend, i think it is already working for tfs 1.5
 
Back
Top