Ir para conteúdo
  • Cadastre-se

[Ajuda] Recompensa Battlefield


Posts Recomendados

Gostaria de uma ajuda para o Battlefield Event:

 

Para no time vencedor = ganhar 3 pontos do site (premium_points)

E para o time perdedor = ganhar 1 ponto do site (mesma coisa)

 

Script do Battlefield e parte da recompensa inclusa (é uma lib com tudo)

 

_Lib_Battle_Info = {
    Reward = {9971,10},
    TeamOne = {name = "Black Assassins", storage = 140120, pos = {x=1262,y=1150,z=6}},
    TeamTwo = {name = "Red Barbarians",storage = 140121,pos = {x=1275,y=1150,z=6}},
    storage_count = 180400,
    tpPos = {x=161, y=44, z=7},
    limit_Time = 10 -- em minutos
}
 
function resetBattle()
    return setGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage, 0) and setGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0)
end
 
function OpenWallBattle()
    local B = {
        {3517,{x=1270, y=1161, z=6, stackpos = 1}},
        {3517,{x=1270, y=1162, z=6, stackpos = 1}},
        {3517,{x=1270, y=1163, z=6, stackpos = 1}},
        {3517,{x=1270, y=1164, z=6, stackpos = 1}}
    }
    for i = 1, #B do
        if getTileItemById(B[2], B[1]).uid == 0 then
            doCreateItem(B[1], 1, B[2])
        else
            doRemoveItem(getThingfromPos(B[2]).uid,1)
        end
    end
end
 
function doBroadCastBattle(type,msg)
    local players = {}
    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
            table.insert(players, cid)
        end
    end
    for i = 1, #players do
        doPlayerSendTextMessage(players,type,msg)
    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 players,str = {},""
    for _, cid in pairs(getPlayersOnline()) do
        if getPlayerStorageValue(cid, storage) == 1 then
            table.insert(players, cid)
        end
    end
    str = str .. ""..#players.." Player"..(#players > 1 and "s" or "").." do time "..(getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage) == 0 and _Lib_Battle_Info.TeamTwo.name or _Lib_Battle_Info.TeamOne.name).." venceu o evento Battlefield, todos do time vencedor ganharam ".._Lib_Battle_Info.Reward[2].." "..getItemNameById(_Lib_Battle_Info.Reward[1]).."!"
    for i = 1, #players do
        doRemoveCondition(players, CONDITION_OUTFIT)
        doTeleportThing(players, getTownTemplePosition(getPlayerTown(players)))
        setPlayerStorageValue(players, storage, -1)
        setPlayerStorageValue(players, 52310, getPlayerStorageValue(cid, 52310) + 3)
    end
    resetBattle()
    OpenWallBattle()
    return doBroadcastMessage(str)
end

function CheckEvent(delay)
    if delay > 0 and getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then
        doBroadcastMessage("[battleField Evento] Esta esperando "..getGlobalStorageValue(_Lib_Battle_Info.storage_count).." players para o evento Battlefield começar.")
        elseif delay == 0 and getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then
        local players = {}
        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
                table.insert(players, cid)
            end
        end
        
        for i = 1, #players do
            doRemoveCondition(players, CONDITION_OUTFIT)
            setPlayerStorageValue(players, 52310, getPlayerStorageValue(cid, 52310) + 1)
            doTeleportThing(players, getTownTemplePosition(getPlayerTown(players)))
            setPlayerStorageValue(players, getPlayerStorageValue(players, _Lib_Battle_Info.TeamOne.storage) == 1 and _Lib_Battle_Info.TeamOne.storage or _Lib_Battle_Info.TeamTwo.storage, -1)
        end
        doBroadcastMessage("Evento não pode ser iniciado por falta de jogadores.")
        setGlobalStorageValue(_Lib_Battle_Info.storage_count, 0)
        resetBattle()
        removeBattleTp()
    end
    addEvent(CheckEvent, 60000, delay-1)
end

 

Script completo:

http://www.tibiaking.com/forum/topic/16699-sistema-battlefield-event/

Editado por Disturbbed (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 4 weeks later...

MAS UÉ? o evento tem base se MATAR todos do time inimigo...

 

então quer dizer que se eu morrer no evento eu ganho 1 premium_points?

 

se eu ganhar o evento e ainda estiver vivo, eu ganho 3? é isso?

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

É eu quero dar recompensa aos que perdem também. Pois como é sorte a escolha dos players, se cair todos high level em 1 time, o outro time não tem nem chance, então não fica tão justo.

Mas caso não haja como, pode me dizer como fazer apenas aos que ganham? =) Grato

Editado por Toulouse (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

da para fazer sim.. mas oque eu quero dizer é que:

 

 

João e Zé = time vermelho

 

Pedro e Ana = time black

 

 

se o zé(Red), Pedro(black) e Ana(black) morrer vai sobrar o João(Red)... No caso o time vermelho ganhou, certo?

 

o Zé que era do time red ainda ganha 3 pontos? msm que ela tenha morrido e seu time foi vencedor?  ou ele só ganha 1 ponto como o time da ana e do pedro(black) que todos morreram

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

Tipo, o script do battlefield eu acho que o time todo mesmo que morreu ganhe, sendo que esse script do battlefield ainda foi o que voce fez, se não me engano o time todo ganha, mesmo os mortos.

Link para o post
Compartilhar em outros sites

Não. só ganha quem estiver vivo...

 

se todos do black morrer só ganha recompensa quem estiver vivo no time red... entendeu?

 

pq o certo era adicionar 1 premium points pra quem morreu, independente do time, e ganhar 3 pontos quem ficou vivo, ai eu acho justo...

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

É realmente nao tinha pensado nisso, é uma ideia melhor, concordo, se voce puder me ajudar hhaha ^^

Link para o post
Compartilhar em outros sites

lib

_Lib_Battle_Info = {
    Reward = 3,
    TeamOne = {name = "Black Assassins", storage = 140120, pos = {x=1262,y=1150,z=6}},
    TeamTwo = {name = "Red Barbarians",storage = 140121,pos = {x=1275,y=1150,z=6}},
    storage_count = 180400,
    tpPos = {x=161, y=44, z=7},
    limit_Time = 10 -- em minutos
}
 
function resetBattle()
    return setGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage, 0) and setGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0)
end
 
function OpenWallBattle()
    local B = {
        {3517,{x=1270, y=1161, z=6, stackpos = 1}},
        {3517,{x=1270, y=1162, z=6, stackpos = 1}},
        {3517,{x=1270, y=1163, z=6, stackpos = 1}},
        {3517,{x=1270, y=1164, z=6, 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)
    local players = {}
    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
            table.insert(players, cid)
        end
    end
    for i = 1, #players do
        doPlayerSendTextMessage(players[i],type,msg)
    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 players,str = {},""
    for _, cid in pairs(getPlayersOnline()) do
        if getPlayerStorageValue(cid, storage) == 1 then
            table.insert(players, cid)
        end
    end
    str = str .. ""..#players.." Player"..(#players > 1 and "s" or "").." do time "..(getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage) == 0 and _Lib_Battle_Info.TeamTwo.name or _Lib_Battle_Info.TeamOne.name).." venceu o evento Battlefield, todos do time vencedor ganharam ".._Lib_Battle_Info.Reward.." premium points!"
    for i = 1, #players do
        db.executeQuery('UPDATE accounts SET premium_points=premium_points+' .. _Lib_Battle_Info.Reward ..' WHERE id=' .. getPlayerAccountId(players[i]))
        doRemoveCondition(players[i], CONDITION_OUTFIT)
        doTeleportThing(players[i], getTownTemplePosition(getPlayerTown(players[i])))
        setPlayerStorageValue(players[i], storage, -1)
        setPlayerStorageValue(players[i], 52310, getPlayerStorageValue(cid, 52310) + 3)
    end
    resetBattle()
    OpenWallBattle()
    return doBroadcastMessage(str)
end
 
function CheckEvent(delay)
    if delay > 0 and getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then
        doBroadcastMessage("[BattleField Evento] Esta esperando "..getGlobalStorageValue(_Lib_Battle_Info.storage_count).." players para o evento Battlefield começar.")
        elseif delay == 0 and getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then
        local players = {}
        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
                table.insert(players, cid)
            end
        end
        
        for i = 1, #players do
            doRemoveCondition(players[i], CONDITION_OUTFIT)
            setPlayerStorageValue(players[i], 52310, getPlayerStorageValue(cid, 52310) + 1)
            doTeleportThing(players[i], getTownTemplePosition(getPlayerTown(players[i])))
            setPlayerStorageValue(players[i], getPlayerStorageValue(players[i], _Lib_Battle_Info.TeamOne.storage) == 1 and _Lib_Battle_Info.TeamOne.storage or _Lib_Battle_Info.TeamTwo.storage, -1)
        end
        doBroadcastMessage("Evento não pode ser iniciado por falta de jogadores.")
        setGlobalStorageValue(_Lib_Battle_Info.storage_count, 0)
        resetBattle()
        removeBattleTp()
    end
    addEvent(CheckEvent, 60000, delay-1)
end

-----------------

creaturescript

 

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)
db.executeQuery('UPDATE accounts SET premium_points= premium_points+1 WHERE id= '..getPlayerAccountId(cid))
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)
db.executeQuery('UPDATE accounts SET premium_points= premium_points+1 WHERE id= '..getPlayerAccountId(cid))
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

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

Add essa função na lib: 

function addPoint(uid, count)
	local accountPoints = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `name` = '" .. getPlayerAccount(uid) .. "' LIMIT 1;")
	local points = tonumber(accountPoints:getDataInt("premium_points"))
	db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. points + count .. " WHERE `name`='" .. getPlayerAccount(uid) .. "' LIMIT 1;")
end

Troque o movements do battlefield por esse:

 

function onStepIn(cid, item, position, fromPosition)
	
	if getPlayerAccess(cid) > 3 then
		doTeleportThing(cid, _Lib_Battle_Info.TeamOne.pos) return false
	elseif getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then
		setGlobalStorageValue(_Lib_Battle_Info.storage_count, getGlobalStorageValue(_Lib_Battle_Info.storage_count)-1)
	end
	
	if getGlobalStorageValue(_Lib_Battle_Info.storage_count) >= 0 then
		if getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage) < getGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage) then
			setPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage, 1)
			doAddCondition(cid, conditionBlack)
			setGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage, getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage)+1)
			doTeleportThing(cid, _Lib_Battle_Info.TeamOne.pos)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will join the team " .. _Lib_Battle_Info.TeamOne.name .. "!")
		else
			setPlayerStorageValue(cid, _Lib_Battle_Info.TeamTwo.storage, 1)
			doAddCondition(cid, conditionRed)
			setGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage, getGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage)+1)
			doTeleportThing(cid, _Lib_Battle_Info.TeamTwo.pos)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will join the team " .. _Lib_Battle_Info.TeamTwo.name .. "!")
		end

		addPoint(cid, 1)
	end

	if getGlobalStorageValue(_Lib_Battle_Info.storage_count) == 0 then
		removeBattleTp()
		doBroadcastMessage("Battlefield will start in 2 minutes, please create your strategy!")
		addEvent(doBroadcastMessage, 2*60*1000-500, "BattleField will begin now!")
		addEvent(OpenWallBattle, 2*60*1000)
	end
	
	return true
end




Troque a função getWinnersBattle que esta na lib por esta: 

function getWinnersBattle(storage)
	
	local players,str = {},""
	for _, cid in pairs(getPlayersOnline()) do
		if getPlayerStorageValue(cid, storage) == 1 then
			table.insert(players, cid)
		end
	end
	
	str = str .. ""..#players.." Player"..(#players > 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, they received a ".._Lib_Battle_Info.Reward[2].." "..getItemNameById(_Lib_Battle_Info.Reward[1]).."!"
	
	for i = 1, #players do
		doPlayerAddItem(players[i], _Lib_Battle_Info.Reward[1], _Lib_Battle_Info.Reward[2])
		doRemoveCondition(players[i], CONDITION_OUTFIT)
		doTeleportThing(players[i], getTownTemplePosition(getPlayerTown(players[i])))
		setPlayerStorageValue(players[i], storage, -1)
		addPoint(players[i], 2)
	end
	
	resetBattle()
	OpenWallBattle()
	
	return doBroadcastMessage(str)
end

Link para o post
Compartilhar em outros sites

lib

_Lib_Battle_Info = {
    Reward = 3,
    TeamOne = {name = "Black Assassins", storage = 140120, pos = {x=1262,y=1150,z=6}},
    TeamTwo = {name = "Red Barbarians",storage = 140121,pos = {x=1275,y=1150,z=6}},
    storage_count = 180400,
    tpPos = {x=161, y=44, z=7},
    limit_Time = 10 -- em minutos
}
 
function resetBattle()
    return setGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage, 0) and setGlobalStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0)
end
 
function OpenWallBattle()
    local B = {
        {3517,{x=1270, y=1161, z=6, stackpos = 1}},
        {3517,{x=1270, y=1162, z=6, stackpos = 1}},
        {3517,{x=1270, y=1163, z=6, stackpos = 1}},
        {3517,{x=1270, y=1164, z=6, 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)
    local players = {}
    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
            table.insert(players, cid)
        end
    end
    for i = 1, #players do
        doPlayerSendTextMessage(players[i],type,msg)
    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 players,str = {},""
    for _, cid in pairs(getPlayersOnline()) do
        if getPlayerStorageValue(cid, storage) == 1 then
            table.insert(players, cid)
        end
    end
    str = str .. ""..#players.." Player"..(#players > 1 and "s" or "").." do time "..(getGlobalStorageValue(_Lib_Battle_Info.TeamOne.storage) == 0 and _Lib_Battle_Info.TeamTwo.name or _Lib_Battle_Info.TeamOne.name).." venceu o evento Battlefield, todos do time vencedor ganharam ".._Lib_Battle_Info.Reward.." premium points!"
    for i = 1, #players do
    if isCreature(players[i]) then
        db.executeQuery('UPDATE accounts SET premium_points=premium_points+' .. _Lib_Battle_Info.Reward ..' WHERE id=' .. getPlayerAccountId(players[i]))
        doRemoveCondition(players[i], CONDITION_OUTFIT)
        doTeleportThing(players[i], getTownTemplePosition(getPlayerTown(players[i])))
        setPlayerStorageValue(players[i], storage, -1)
        setPlayerStorageValue(players[i], 52310, getPlayerStorageValue(cid, 52310) + 3)
        end
    end
    resetBattle()
    OpenWallBattle()
    return doBroadcastMessage(str)
end
 
function CheckEvent(delay)
    if delay > 0 and getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then
        doBroadcastMessage("[BattleField Evento] Esta esperando "..getGlobalStorageValue(_Lib_Battle_Info.storage_count).." players para o evento Battlefield começar.")
        elseif delay == 0 and getGlobalStorageValue(_Lib_Battle_Info.storage_count) > 0 then
        local players = {}
        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
                table.insert(players, cid)
            end
        end
        
        for i = 1, #players do
            doRemoveCondition(players[i], CONDITION_OUTFIT)
            setPlayerStorageValue(players[i], 52310, getPlayerStorageValue(cid, 52310) + 1)
            doTeleportThing(players[i], getTownTemplePosition(getPlayerTown(players[i])))
            setPlayerStorageValue(players[i], getPlayerStorageValue(players[i], _Lib_Battle_Info.TeamOne.storage) == 1 and _Lib_Battle_Info.TeamOne.storage or _Lib_Battle_Info.TeamTwo.storage, -1)
        end
        doBroadcastMessage("Evento não pode ser iniciado por falta de jogadores.")
        setGlobalStorageValue(_Lib_Battle_Info.storage_count, 0)
        resetBattle()
        removeBattleTp()
    end
    addEvent(CheckEvent, 60000, delay-1)
end

---------------------

creaturescript

 

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 isCreature(cid) then
if getPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage) >= 1 then
setPlayerStorageValue(cid, _Lib_Battle_Info.TeamOne.storage, -1)
db.executeQuery('UPDATE accounts SET premium_points= premium_points+1 WHERE id= '..getPlayerAccountId(cid))
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)
db.executeQuery('UPDATE accounts SET premium_points= premium_points+1 WHERE id= '..getPlayerAccountId(cid))
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
end
return true
end

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

TINHA COMO COLOKA PRA GANHAR XP NO LUGA DO PREMIUM / TIPO O TIME Q GANHAR GANHAR EXPERIENCIA ?

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo