Ir para conteúdo
  • 0

Fahz

Pergunta

Eaai galerinha cool.png , eu aqui de novo pra resolver um problems, é um evento battle field no qual vence quem roubar a bandeira...

 

Bom eu instalei abriu corretamente mas só que eu cliko nas bandeiras e não acontece nada , vou deixar a script aqui.

______

 

na libs

 

battlefield = {
storage = 201206300801,
storage2 = 201206300802,
tpPos = {x=32342, y=32213, z=7}, -- aonde aparecerá o teleport
pos_team_1
= {x=31621,y=31860,z=7}, -- posição do team 1 (do lado direito)
pos_team_2 = {x=31582,y=31860,z=7}, -- posição do team 2 (do lado esquerdo)
spectors = {{x=31593,y=31853,z=6},{x=31609,y=31853,z=6},{x=31593,y=31866,z=6},{x=31609,y=31866,z=6}}, -- aonde aparecerá os espectadores (em volta do battlefield)
team1Name = "Black Assassins",
team2Name = "Red Barbarians",
}

function doBroadCastBattle(type,msg)

for _, cid in pairs(getPlayersOnline()) do
if getPlayerStorageValue(cid, battlefield.storage2) ~= -1 then
doPlayerSendTextMessage(cid,type,msg)
end
end

return true
end

function removeTp()

local t = getTileItemById(battlefield.tpPos, 1387)
if t then
doRemoveItem(t.uid, 1)
doSendMagicEffect(battlefield.tpPos, CONST_ME_POFF)
end

end

function OpenWallBattle()

local x = true
local B = {
[1] = {1056,{x=31601, y=31858, z=6, stackpos = 1}}, -- posição da barreira
[2] = {1056,{x=31601, y=31859, z=6, stackpos = 1}}, -- posição da barreira
[3] = {1056,{x=31601, y=31860, z=6, stackpos = 1}}, -- posição da barreira
[4] = {1056,{x=31601, y=31861, z=6, stackpos = 1}} -- posição da barreira
}

for i = 1, #B do
if getTileItemById(B[i][2], B[i][1]).uid == 0 then
x = false
end
if x == true then
doRemoveItem(getThingfromPos(B[i][2]).uid,1)
else
doCreateItem(B[i][1], 1, B[i][2])
end
end

end

function getWinnersBattle(storage)

local team = storage == 1 and battlefield.team1Name or battlefield.team2Name

doBroadcastMessage
("Players from team ".. team .." won the event battlefield,they received a Master Surprise Bag!")
setGlobalStorageValue(battlefield.storage, -1)
removeTp()
OpenWallBattle()

for _, cid in pairs(getPlayersOnline()) do
if getPlayerStorageValue(cid, battlefield.storage2) ~= -1 then
doRemoveCondition(cid, CONDITION_OUTFIT)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
if getPlayerStorageValue(cid, battlefield.storage2) == storage then
doPlayerAddItem(cid,6571,1)
end
setPlayerStorageValue(cid, battlefield.storage2, -1)
end
end

end

 

______

 

action

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

local team = getPlayerStorageValue(cid, battlefield.storage2)

if (item.actionid == 45001 and team == 1) or (item.actionid == 45002 and team == 2) then
getWinnersBattle(team)
end

return true
end

 

___

 

action xml

 

<action actionid="49901" event="script" value="battlefieldAbsolute.lua"/>
<action actionid="45002" event="script" value="battlefieldAbsolute.lua"/>

 

__

 

creaturescript/combat

 

function onLogin(cid)
if getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage) == -1 then
setGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage, 0)
setGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0)
setGlobalStorageValue(_Lib_Battle_Info.storage_count, 0)
end
registerCreatureEvent(cid, "BattleTeam")
registerCreatureEvent(cid, "BattleDeath")
return true
end


function onCombat(cid, target)
if isPlayer(cid) and isPlayer(target) then
if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage) == 1 and getPlayerStorageValue(target, _Lib_Battle_Info.TeamOne.storage) == 1 then
doPlayerSendCancel(cid, "You may not attack your team mates.") return false
end
if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage) == 1 and getPlayerStorageValue(target, _Lib_Battle_Info.TeamTwo.storage) == 1 then
doPlayerSendCancel(cid, "You may not attack your team mates.") return false
end
return true
end
return true
end

function onPrepareDeath(cid, deathList, lastHitKiller, mostDamageKiller)
if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage) >= 1 then
setPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage, -1)
setGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage, getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage)-1)
doRemoveCondition(cid, CONDITION_OUTFIT)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[battle Field] You Are Dead!")
if getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage) == 0 then
getWinnersBattle(_Lib_Battle_Info.TeamTwo.storage)
else
doBroadCastBattle(23,"[battleField Information] ".._Lib_Battle_Info.TeamOne.name.." "..getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage).." VS "..getGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage).." " .._Lib_Battle_Info.TeamTwo.name)
end
elseif getPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage) >= 1 then
setPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage, -1)
setGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage, getGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage)-1)
doRemoveCondition(cid, CONDITION_OUTFIT)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[battle Field] You Are Dead!")
if getGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage) == 0 then
getWinnersBattle(_Lib_Battle_Info.TeamOne.storage)
else
doBroadCastBattle(23,"[battleField Information] ".._Lib_Battle_Info.TeamOne.name.." "..getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage).." VS "..getGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage).." " .._Lib_Battle_Info.TeamTwo.name)
end
end
return true
end

 

_____

 

creaturescript/pdeath

 

function onPrepareDeath(cid, corpse, lastHitKiller, mostDamageKiller)

if getPlayerStorageValue(cid, config_tvt.green_kills) > 0 then
doTeleportThing(cid, config_tvt.green_pos)
setGlobalStorageValue(red_kills, getGlobalStorageValue(red_kills) + 1)
end

if getPlayerStorageValue(cid, config_tvt.red_kills) > 0 then
doTeleportThing(cid, config_tvt.red_pos)
setGlobalStorageValue(red_kills, getGlobalStorageValue(green_kills) + 1)
end

doPlayerSendTextMessage(cid, 27, "You dead! by Absolute")

return true
end

 

_____

 

creaturescript xml

 

<event type="preparedeath" name="BattlefieldP" event="script" value="pdeath.lua"/>

<event type="combat" name="BattlefieldC" event="script" value="combat.lua"/>

 

_______

 

movements

 

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 getPlayerAccess(cid) > 3 then
doTeleportThing(cid, battlefield.pos_team_1)
return true
elseif getGlobalStorageValue(battlefield.storage) == 0 then
doTeleportThing(cid, battlefield.spectors[math.random(#battlefield.spectors)])
return true
end

if getGlobalStorageValue(battlefield.storage) > 0 then
if getGlobalStorageValue(battlefield.storage) % 2 == 0 then
setPlayerStorageValue(cid, battlefield.storage2, 1)
doAddCondition(cid, conditionBlack)
doTeleportThing(cid, battlefield.pos_team_1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will join the team " .. battlefield.team1Name .. "!")
else
setPlayerStorageValue(cid, battlefield.storage2, 2)
doAddCondition(cid, conditionRed)
doTeleportThing(cid, battlefield.pos_team_2)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will join the team " .. battlefield.team2Name .. "!")
end
setGlobalStorageValue(battlefield.storage, getGlobalStorageValue(battlefield.storage)-1)
if getGlobalStorageValue(battlefield.storage) == 0 then
doBroadcastMessage("Battlefield will start in 1 minute, please create your strategy!")
addEvent(doBroadcastMessage, 60*1000, "BattleField will begin now!")
addEvent(OpenWallBattle, 60*1000)
else
doBroadcastMessage("We are waiting "..getGlobalStorageValue(battlefield.storage).." players to Battlefield starts.")
end
end

return true
end

 

_____

 

movements xml

 

<movevent type="StepIn" actionid="45000" event="script" value="battlefieldAbsolute.lua"/>

 

____

 

function onSay(cid, words, param)

if getGlobalStorageValue(battlefield.storage) ~= -1 then
doPlayerSendCancel(cid, "The event is already open.")
return true
elseif not tonumber(param) or param % 2 ~= 0 then
doPlayerSendCancel(cid, "You must choose an even number.")
return true
end

doBroadcastMessage("The event BattleField was opened and We are waiting "..param.." Players! Team divided into "..((param)/2).." VS "..((param)/2))
setGlobalStorageValue(battlefield.storage, tonumber(param))
local tp = doCreateItem(1387, 1, battlefield.tpPos)
doItemSetAttribute(tp, "aid", 45000)

return true
end

 

_____

 

<talkaction words="/battlefield" access="3" event="script" value="battlefieldopenAbsolute.lua"/>

 

____

 

o comando para abrir o evento é: /battlefield 20

 

.. Aguardando resposta dos profissionais wink_smile.gifwink_smile.gifwink_smile.gif

Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

  • 0

não sei postar ss laugh.pngicon_redface.gif

 

[ERROR - GlobalEvent [interface]

data/globalevents/script/battleglobalstart.lua:onStartup

description:

data/globalevents/scripts/battleglobalstart.lua:onStartup:3: attempt to index global ' Lib_Battle_info' <a nil value>

stack traceback:

data/globalevents/scripts/battleglobalstart.lua:onStartup:3: in function <data/globalevents/scripts/battleglobalstart.lua:1>

Editado por Fahz
Link para o comentário
Compartilhar em outros sites

  • 0
edit..

peço desculpas icon_redface.gificon_redface.gifsick.gif , essa script não tem globalevents .... não tem error no distro


só é usado lib, action, creaturescript, movements e Talktions pra abrir por comando , como eu postei..

Editado por Fahz
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...