Postado Maio 28, 2016 9 anos galera eu adicionei o evento de Rouba bandeira (Ctf) no meu servidor, mas só ganha 5% de Experiencia, eu gostaria que o perssonagem ganhasse item no lugar da Experiencia quem aí pode ajudar, Please --[[ Capture The Flag System Author: Maxwell Denisson(MaXwEllDeN) Version: 2.0 Contact: [email protected] ]] CTF_LIB = { waitpos = {x = 1095, y = 54, z =7}, -- Posição da sala de espera tppos = {x = 1004, y = 1003, z =7}, -- Onde o TP vai aparecer days = {1, 2, 3, 4, 5, 6, 7}, -- Dias que o evento vai abrir xp_percent = 0.5, -- Porcentagem de exp que o player vai ganhar timeclose = 1, -- Tempo, em minutos, para iniciar o CTF winp = 5, -- Quantos pontos uma equipe precisa marcar para vencer teams = { ["Vermelho"] = { temple = 2, -- TownID da equipe vermelha outfit = {lookHead = 0, lookBody = 132, lookLegs = 113, lookFeet = 94}, flag = { id = 1435, flag_pos = {x = 1297, y = 195, z =6}, -- Posição onde a bandeira vermelha vai ser criada gnd_pos = {x = 1301, y = 196, z =6}, -- Onde os players da equipe vermelha entregarão a bandeira. }, }, ["Verde"] = { temple = 3, -- TownID da equipe verde outfit = {lookHead = 0, lookBody = 121, lookLegs = 101, lookFeet = 101}, flag = { id = 1437, flag_pos = {x = 1221, y = 227, z =6}, -- Posição onde a bandeira verde vai ser criada gnd_pos = {x = 1217, y = 228, z =6}, -- Onde os players da equipe verde entregarão a bandeira. }, }, }, } local CTF = CTF_LIB function CTF.getMembers() local members = {} for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, 16700) ~= -1 then table.insert(members, cid) end end return members end function CTF.getTeamMembers(team) local members = {} for _, cid in pairs(CTF.getMembers()) do if getPlayerStorageValue(cid, 16700) == team then table.insert(members, cid) end end return members end function CTF.removePlayer(uid) doPlayerSetTown(uid, getPlayerStorageValue(uid, 16701)) doTeleportThing(uid, getTownTemplePosition(getPlayerStorageValue(uid, 16701))) doRemoveCondition(uid, CONDITION_OUTFIT) doCreatureAddHealth(uid, getCreatureMaxHealth(uid)) doCreatureAddMana(uid, getCreatureMaxMana(uid)) setPlayerStorageValue(uid, 16701, -1) setPlayerStorageValue(uid, 16700, -1) return true end function CTF.addPlayer(uid) local team = CTF.getTeamLivre() local n_team = CTF.teams[team] setPlayerStorageValue(uid, 16700, team) setPlayerStorageValue(uid, 16701, getPlayerTown(uid)) doPlayerSetTown(uid, n_team.temple) doTeleportThing(uid, CTF.waitpos) doPlayerSendTextMessage(uid, 22, "Você agora faz parte do time ".. team .. ".") local outfit = getCreatureOutfit(uid) for i, v in pairs(n_team.outfit) do outfit = v end registerCreatureEvent(uid, "CTFLogout") registerCreatureEvent(uid, "CTFAttack") registerCreatureEvent(uid, "CTFCombat") registerCreatureEvent(uid, "CTFDeath") doSetCreatureOutfit(uid, outfit, -1) return true end function CTF.getTeamLivre() local teams = {} for i, _ in pairs(CTF.teams) do table.insert(teams, {i, #CTF.getTeamMembers(i)}) end if (teams[1][2] < teams[2][2]) then return teams[1][1] elseif (teams[1][2] > teams[2][2]) then return teams[2][1] end return teams[math.random(2)][1] end function CTF.broadCast(msg, class) for _, uid in pairs(CTF.getMembers()) do doPlayerSendTextMessage(uid, class or 20, msg) end return true end function CTF.getFlagTeam(flag) for i, v in pairs(CTF.teams) do if v.flag.id == flag then return i end end return "" end local score_sto = {} local a = 0 for i, _ in pairs(CTF.teams) do score_sto = 42314 + a a = a + 1 end function CTF.createFlags() for i, v in pairs(CTF.teams) do local flag = doCreateItem(v.flag.id, 1, v.flag.flag_pos) doItemSetAttribute(flag, "aid", 63218) v.flag.gnd_pos.stackpos = 0 local gnd = getThingFromPos(v.flag.gnd_pos).uid doItemSetAttribute(gnd, "aid", 63200) doItemSetAttribute(gnd, "team", i) setGlobalStorageValue(score_sto, 0) end return true end function CTF.removeFlags() for i, v in pairs(CTF.teams) do local flag = doFindItemInPos({v.flag.id}, v.flag.flag_pos)[1] if flag then doRemoveItem(flag.uid, 1) end v.flag.gnd_pos.stackpos = 0 local gnd = getThingFromPos(v.flag.gnd_pos).uid doItemSetAttribute(gnd, "aid", 0) end return true end function CTF.start() doRemoveItem(doFindItemInPos({1387}, CTF.tppos)[1].uid, 1) setGlobalStorageValue(16705, -1) if #CTF.getMembers() < 4 then doBroadcastMessage("O CTF não pôde ser iniciado por falta de players.") for _, cid in pairs(CTF.getMembers()) do CTF.removePlayer(cid) end return false end CTF.broadCast("O CTF foi iniciado. Bom jogo!") for _, uid in pairs(CTF.getMembers()) do doTeleportThing(uid, getTownTemplePosition(getPlayerTown(uid))) end CTF.createFlags() return true end function CTF.returnFlag(uid, status) local team = getPlayerStorageValue(uid, 16702) if status then local msg = "O player ".. getCreatureName(uid) .. ", estava com a bandeira do time ".. team .. " " if status == 1 then msg = msg .. "e foi eliminado. " elseif status == 2 then msg = "e foi removido do evento. " end msg = msg .. "Portanto a bandeira do time ".. team .. " foi devolvida." CTF.broadCast(msg) end if CTF.teams[team] then local flag = doCreateItem(CTF.teams[team].flag.id, 1, CTF.teams[team].flag.flag_pos) doItemSetAttribute(flag, "aid", 63218) setPlayerStorageValue(uid, 16702, -1) end return true end function CTF.addPoint(uid) local finish local msg = "Capture The Flag:" setGlobalStorageValue(score_sto[getPlayerStorageValue(uid, 16700)], getGlobalStorageValue(score_sto[getPlayerStorageValue(uid, 16700)]) + 1) for i, _ in pairs(CTF.teams) do msg = msg .. "\nTime ".. i .. ": ".. getGlobalStorageValue(score_sto) if getGlobalStorageValue(score_sto) >= CTF.winp then finish = i end end CTF.broadCast(getCreatureName(uid) .. " marcou um ponto para o time ".. getPlayerStorageValue(uid, 16700) .. ".", 22) CTF.broadCast(msg) CTF.returnFlag(uid) if finish then CTF.close(finish) return "close" end return true end function CTF.close(win) if not win then doBroadcastMessage("O CTF acabou sem vencedores.") else CTF.broadCast("O time ".. win .. " marcou ".. CTF.winp .. " ponto(s) e venceu o evento.") end for _, cid in pairs(CTF.getMembers()) do if getPlayerStorageValue(cid, 16700) == win then local xp = math.ceil(getPlayerExperience(cid) * (CTF.xp_percent / 100), 215) doPlayerSendTextMessage(cid, 22, "Parabéns! Você ganhou o evento e obteve ".. CTF.xp_percent .."% de sua experiência total(".. xp ..").") doSendAnimatedText(getThingPos(cid), xp, 215) doPlayerAddExperience(cid, xp) end --[[ if getPlayerStorageValue(cid, 16702) ~= -1 then CTF.returnFlag(cid) end]] CTF.removePlayer(cid) end CTF.removeFlags() for i, _ in pairs(CTF.teams) do setGlobalStorageValue(score_sto, 0) end return true end local function Alert(uid) if (isCreature(uid)) then if getPlayerStorageValue(uid, 16702) == -1 or getPlayerStorageValue(uid, 16700) == -1 then return false end doSendAnimatedText(getThingPos(uid), "Flag!", math.random(50, 200)) local bla = {18, 19, 21, 22, 23, 24} doSendMagicEffect(getThingPos(uid), bla[math.random(#bla)]) if (os.time() - getPlayerStorageValue(uid, 16703) >= 60) then CTF.returnFlag(uid) return setPlayerStorageValue(uid, 16703, -1) end addEvent(Alert, 500, uid) return true end return false end function CTF.stealFlag(uid, team) setPlayerStorageValue(uid, 16702, team) setPlayerStorageValue(uid, 16703, os.time()) CTF.broadCast(getCreatureName(uid) .. " roubou a bandeira do time ".. team .. "!") Alert(uid) return true end function doFindItemInPos(ids, pos) -- By Undead Slayer local results = {} for _ = 0, 255 do local findPos = {x = pos.x, y = pos.y, z = pos.z, stackpos = _} if isInArray(ids, getThingFromPos(findPos).itemid) then table.insert(results, getThingFromPos(findPos)) end end return results end Meu servidor https://www.facebook.com/Heavennoobwar
Postado Maio 31, 2016 9 anos Tenta assim: Spoiler --[[ Capture The Flag System Author: Maxwell Denisson(MaXwEllDeN) Version: 2.0 Contact: [email protected] ]] CTF_LIB = { waitpos = {x = 1095, y = 54, z =7}, -- Posição da sala de espera tppos = {x = 1004, y = 1003, z =7}, -- Onde o TP vai aparecer days = {1, 2, 3, 4, 5, 6, 7}, -- Dias que o evento vai abrir items_id = {2160, 2673}, -- ID da Recompensa timeclose = 1, -- Tempo, em minutos, para iniciar o CTF winp = 5, -- Quantos pontos uma equipe precisa marcar para vencer teams = { ["Vermelho"] = { temple = 2, -- TownID da equipe vermelha outfit = {lookHead = 0, lookBody = 132, lookLegs = 113, lookFeet = 94}, flag = { id = 1435, flag_pos = {x = 1297, y = 195, z =6}, -- Posição onde a bandeira vermelha vai ser criada gnd_pos = {x = 1301, y = 196, z =6}, -- Onde os players da equipe vermelha entregarão a bandeira. }, }, ["Verde"] = { temple = 3, -- TownID da equipe verde outfit = {lookHead = 0, lookBody = 121, lookLegs = 101, lookFeet = 101}, flag = { id = 1437, flag_pos = {x = 1221, y = 227, z =6}, -- Posição onde a bandeira verde vai ser criada gnd_pos = {x = 1217, y = 228, z =6}, -- Onde os players da equipe verde entregarão a bandeira. }, }, }, } local CTF = CTF_LIB function CTF.getMembers() local members = {} for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, 16700) ~= -1 then table.insert(members, cid) end end return members end function CTF.getTeamMembers(team) local members = {} for _, cid in pairs(CTF.getMembers()) do if getPlayerStorageValue(cid, 16700) == team then table.insert(members, cid) end end return members end function CTF.removePlayer(uid) doPlayerSetTown(uid, getPlayerStorageValue(uid, 16701)) doTeleportThing(uid, getTownTemplePosition(getPlayerStorageValue(uid, 16701))) doRemoveCondition(uid, CONDITION_OUTFIT) doCreatureAddHealth(uid, getCreatureMaxHealth(uid)) doCreatureAddMana(uid, getCreatureMaxMana(uid)) setPlayerStorageValue(uid, 16701, -1) setPlayerStorageValue(uid, 16700, -1) return true end function CTF.addPlayer(uid) local team = CTF.getTeamLivre() local n_team = CTF.teams[team] setPlayerStorageValue(uid, 16700, team) setPlayerStorageValue(uid, 16701, getPlayerTown(uid)) doPlayerSetTown(uid, n_team.temple) doTeleportThing(uid, CTF.waitpos) doPlayerSendTextMessage(uid, 22, "Você agora faz parte do time ".. team .. ".") local outfit = getCreatureOutfit(uid) for i, v in pairs(n_team.outfit) do outfit = v end registerCreatureEvent(uid, "CTFLogout") registerCreatureEvent(uid, "CTFAttack") registerCreatureEvent(uid, "CTFCombat") registerCreatureEvent(uid, "CTFDeath") doSetCreatureOutfit(uid, outfit, -1) return true end function CTF.getTeamLivre() local teams = {} for i, _ in pairs(CTF.teams) do table.insert(teams, {i, #CTF.getTeamMembers(i)}) end if (teams[1][2] < teams[2][2]) then return teams[1][1] elseif (teams[1][2] > teams[2][2]) then return teams[2][1] end return teams[math.random(2)][1] end function CTF.broadCast(msg, class) for _, uid in pairs(CTF.getMembers()) do doPlayerSendTextMessage(uid, class or 20, msg) end return true end function CTF.getFlagTeam(flag) for i, v in pairs(CTF.teams) do if v.flag.id == flag then return i end end return "" end local score_sto = {} local a = 0 for i, _ in pairs(CTF.teams) do score_sto = 42314 + a a = a + 1 end function CTF.createFlags() for i, v in pairs(CTF.teams) do local flag = doCreateItem(v.flag.id, 1, v.flag.flag_pos) doItemSetAttribute(flag, "aid", 63218) v.flag.gnd_pos.stackpos = 0 local gnd = getThingFromPos(v.flag.gnd_pos).uid doItemSetAttribute(gnd, "aid", 63200) doItemSetAttribute(gnd, "team", i) setGlobalStorageValue(score_sto, 0) end return true end function CTF.removeFlags() for i, v in pairs(CTF.teams) do local flag = doFindItemInPos({v.flag.id}, v.flag.flag_pos)[1] if flag then doRemoveItem(flag.uid, 1) end v.flag.gnd_pos.stackpos = 0 local gnd = getThingFromPos(v.flag.gnd_pos).uid doItemSetAttribute(gnd, "aid", 0) end return true end function CTF.start() doRemoveItem(doFindItemInPos({1387}, CTF.tppos)[1].uid, 1) setGlobalStorageValue(16705, -1) if #CTF.getMembers() < 4 then doBroadcastMessage("O CTF não pôde ser iniciado por falta de players.") for _, cid in pairs(CTF.getMembers()) do CTF.removePlayer(cid) end return false end CTF.broadCast("O CTF foi iniciado. Bom jogo!") for _, uid in pairs(CTF.getMembers()) do doTeleportThing(uid, getTownTemplePosition(getPlayerTown(uid))) end CTF.createFlags() return true end function CTF.returnFlag(uid, status) local team = getPlayerStorageValue(uid, 16702) if status then local msg = "O player ".. getCreatureName(uid) .. ", estava com a bandeira do time ".. team .. " " if status == 1 then msg = msg .. "e foi eliminado. " elseif status == 2 then msg = "e foi removido do evento. " end msg = msg .. "Portanto a bandeira do time ".. team .. " foi devolvida." CTF.broadCast(msg) end if CTF.teams[team] then local flag = doCreateItem(CTF.teams[team].flag.id, 1, CTF.teams[team].flag.flag_pos) doItemSetAttribute(flag, "aid", 63218) setPlayerStorageValue(uid, 16702, -1) end return true end function CTF.addPoint(uid) local finish local msg = "Capture The Flag:" setGlobalStorageValue(score_sto[getPlayerStorageValue(uid, 16700)], getGlobalStorageValue(score_sto[getPlayerStorageValue(uid, 16700)]) + 1) for i, _ in pairs(CTF.teams) do msg = msg .. "\nTime ".. i .. ": ".. getGlobalStorageValue(score_sto) if getGlobalStorageValue(score_sto) >= CTF.winp then finish = i end end CTF.broadCast(getCreatureName(uid) .. " marcou um ponto para o time ".. getPlayerStorageValue(uid, 16700) .. ".", 22) CTF.broadCast(msg) CTF.returnFlag(uid) if finish then CTF.close(finish) return "close" end return true end function CTF.close(win) if not win then doBroadcastMessage("O CTF acabou sem vencedores.") else CTF.broadCast("O time ".. win .. " marcou ".. CTF.winp .. " ponto(s) e venceu o evento.") end for _, cid in pairs(CTF.getMembers()) do if getPlayerStorageValue(cid, 16700) == win then local random_item = CTF.items_id[math.random(1, #CTF.items_id)] doPlayerSendTextMessage(cid, 22, "Parabéns! Você ganhou o evento e obteve " .. getItemNameById(random_item) .. ".") doPlayerAddItem(cid, CTF.items_id, 1) end --[[ if getPlayerStorageValue(cid, 16702) ~= -1 then CTF.returnFlag(cid) end]] CTF.removePlayer(cid) end CTF.removeFlags() for i, _ in pairs(CTF.teams) do setGlobalStorageValue(score_sto, 0) end return true end local function Alert(uid) if (isCreature(uid)) then if getPlayerStorageValue(uid, 16702) == -1 or getPlayerStorageValue(uid, 16700) == -1 then return false end doSendAnimatedText(getThingPos(uid), "Flag!", math.random(50, 200)) local bla = {18, 19, 21, 22, 23, 24} doSendMagicEffect(getThingPos(uid), bla[math.random(#bla)]) if (os.time() - getPlayerStorageValue(uid, 16703) >= 60) then CTF.returnFlag(uid) return setPlayerStorageValue(uid, 16703, -1) end addEvent(Alert, 500, uid) return true end return false end function CTF.stealFlag(uid, team) setPlayerStorageValue(uid, 16702, team) setPlayerStorageValue(uid, 16703, os.time()) CTF.broadCast(getCreatureName(uid) .. " roubou a bandeira do time ".. team .. "!") Alert(uid) return true end function doFindItemInPos(ids, pos) -- By Undead Slayer local results = {} for _ = 0, 255 do local findPos = {x = pos.x, y = pos.y, z = pos.z, stackpos = _} if isInArray(ids, getThingFromPos(findPos).itemid) then table.insert(results, getThingFromPos(findPos)) end end return results end ╔══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ══════════════════════════╗ Te Ajudei? Rep + e ficamos Quits Precisando de ajuda? Discord: Yan Liima #3702 Programador Júnior de LUA, PHP e JavaScript Juntos somos lendas, separados somos Mitos! ╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝
Postado Junho 1, 2016 9 anos Autor 6 horas atrás, Yan Liima disse: Tenta assim: Ocultar conteúdo --[[ Capture The Flag System Author: Maxwell Denisson(MaXwEllDeN) Version: 2.0 Contact: [email protected] ]] CTF_LIB = { waitpos = {x = 1095, y = 54, z =7}, -- Posição da sala de espera tppos = {x = 1004, y = 1003, z =7}, -- Onde o TP vai aparecer days = {1, 2, 3, 4, 5, 6, 7}, -- Dias que o evento vai abrir items_id = {2160, 2673}, -- ID da Recompensa timeclose = 1, -- Tempo, em minutos, para iniciar o CTF winp = 5, -- Quantos pontos uma equipe precisa marcar para vencer teams = { ["Vermelho"] = { temple = 2, -- TownID da equipe vermelha outfit = {lookHead = 0, lookBody = 132, lookLegs = 113, lookFeet = 94}, flag = { id = 1435, flag_pos = {x = 1297, y = 195, z =6}, -- Posição onde a bandeira vermelha vai ser criada gnd_pos = {x = 1301, y = 196, z =6}, -- Onde os players da equipe vermelha entregarão a bandeira. }, }, ["Verde"] = { temple = 3, -- TownID da equipe verde outfit = {lookHead = 0, lookBody = 121, lookLegs = 101, lookFeet = 101}, flag = { id = 1437, flag_pos = {x = 1221, y = 227, z =6}, -- Posição onde a bandeira verde vai ser criada gnd_pos = {x = 1217, y = 228, z =6}, -- Onde os players da equipe verde entregarão a bandeira. }, }, }, } local CTF = CTF_LIB function CTF.getMembers() local members = {} for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, 16700) ~= -1 then table.insert(members, cid) end end return members end function CTF.getTeamMembers(team) local members = {} for _, cid in pairs(CTF.getMembers()) do if getPlayerStorageValue(cid, 16700) == team then table.insert(members, cid) end end return members end function CTF.removePlayer(uid) doPlayerSetTown(uid, getPlayerStorageValue(uid, 16701)) doTeleportThing(uid, getTownTemplePosition(getPlayerStorageValue(uid, 16701))) doRemoveCondition(uid, CONDITION_OUTFIT) doCreatureAddHealth(uid, getCreatureMaxHealth(uid)) doCreatureAddMana(uid, getCreatureMaxMana(uid)) setPlayerStorageValue(uid, 16701, -1) setPlayerStorageValue(uid, 16700, -1) return true end function CTF.addPlayer(uid) local team = CTF.getTeamLivre() local n_team = CTF.teams[team] setPlayerStorageValue(uid, 16700, team) setPlayerStorageValue(uid, 16701, getPlayerTown(uid)) doPlayerSetTown(uid, n_team.temple) doTeleportThing(uid, CTF.waitpos) doPlayerSendTextMessage(uid, 22, "Você agora faz parte do time ".. team .. ".") local outfit = getCreatureOutfit(uid) for i, v in pairs(n_team.outfit) do outfit = v end registerCreatureEvent(uid, "CTFLogout") registerCreatureEvent(uid, "CTFAttack") registerCreatureEvent(uid, "CTFCombat") registerCreatureEvent(uid, "CTFDeath") doSetCreatureOutfit(uid, outfit, -1) return true end function CTF.getTeamLivre() local teams = {} for i, _ in pairs(CTF.teams) do table.insert(teams, {i, #CTF.getTeamMembers(i)}) end if (teams[1][2] < teams[2][2]) then return teams[1][1] elseif (teams[1][2] > teams[2][2]) then return teams[2][1] end return teams[math.random(2)][1] end function CTF.broadCast(msg, class) for _, uid in pairs(CTF.getMembers()) do doPlayerSendTextMessage(uid, class or 20, msg) end return true end function CTF.getFlagTeam(flag) for i, v in pairs(CTF.teams) do if v.flag.id == flag then return i end end return "" end local score_sto = {} local a = 0 for i, _ in pairs(CTF.teams) do score_sto = 42314 + a a = a + 1 end function CTF.createFlags() for i, v in pairs(CTF.teams) do local flag = doCreateItem(v.flag.id, 1, v.flag.flag_pos) doItemSetAttribute(flag, "aid", 63218) v.flag.gnd_pos.stackpos = 0 local gnd = getThingFromPos(v.flag.gnd_pos).uid doItemSetAttribute(gnd, "aid", 63200) doItemSetAttribute(gnd, "team", i) setGlobalStorageValue(score_sto, 0) end return true end function CTF.removeFlags() for i, v in pairs(CTF.teams) do local flag = doFindItemInPos({v.flag.id}, v.flag.flag_pos)[1] if flag then doRemoveItem(flag.uid, 1) end v.flag.gnd_pos.stackpos = 0 local gnd = getThingFromPos(v.flag.gnd_pos).uid doItemSetAttribute(gnd, "aid", 0) end return true end function CTF.start() doRemoveItem(doFindItemInPos({1387}, CTF.tppos)[1].uid, 1) setGlobalStorageValue(16705, -1) if #CTF.getMembers() < 4 then doBroadcastMessage("O CTF não pôde ser iniciado por falta de players.") for _, cid in pairs(CTF.getMembers()) do CTF.removePlayer(cid) end return false end CTF.broadCast("O CTF foi iniciado. Bom jogo!") for _, uid in pairs(CTF.getMembers()) do doTeleportThing(uid, getTownTemplePosition(getPlayerTown(uid))) end CTF.createFlags() return true end function CTF.returnFlag(uid, status) local team = getPlayerStorageValue(uid, 16702) if status then local msg = "O player ".. getCreatureName(uid) .. ", estava com a bandeira do time ".. team .. " " if status == 1 then msg = msg .. "e foi eliminado. " elseif status == 2 then msg = "e foi removido do evento. " end msg = msg .. "Portanto a bandeira do time ".. team .. " foi devolvida." CTF.broadCast(msg) end if CTF.teams[team] then local flag = doCreateItem(CTF.teams[team].flag.id, 1, CTF.teams[team].flag.flag_pos) doItemSetAttribute(flag, "aid", 63218) setPlayerStorageValue(uid, 16702, -1) end return true end function CTF.addPoint(uid) local finish local msg = "Capture The Flag:" setGlobalStorageValue(score_sto[getPlayerStorageValue(uid, 16700)], getGlobalStorageValue(score_sto[getPlayerStorageValue(uid, 16700)]) + 1) for i, _ in pairs(CTF.teams) do msg = msg .. "\nTime ".. i .. ": ".. getGlobalStorageValue(score_sto) if getGlobalStorageValue(score_sto) >= CTF.winp then finish = i end end CTF.broadCast(getCreatureName(uid) .. " marcou um ponto para o time ".. getPlayerStorageValue(uid, 16700) .. ".", 22) CTF.broadCast(msg) CTF.returnFlag(uid) if finish then CTF.close(finish) return "close" end return true end function CTF.close(win) if not win then doBroadcastMessage("O CTF acabou sem vencedores.") else CTF.broadCast("O time ".. win .. " marcou ".. CTF.winp .. " ponto(s) e venceu o evento.") end for _, cid in pairs(CTF.getMembers()) do if getPlayerStorageValue(cid, 16700) == win then local random_item = CTF.items_id[math.random(1, #CTF.items_id)] doPlayerSendTextMessage(cid, 22, "Parabéns! Você ganhou o evento e obteve " .. getItemNameById(random_item) .. ".") doPlayerAddItem(cid, CTF.items_id, 1) end --[[ if getPlayerStorageValue(cid, 16702) ~= -1 then CTF.returnFlag(cid) end]] CTF.removePlayer(cid) end CTF.removeFlags() for i, _ in pairs(CTF.teams) do setGlobalStorageValue(score_sto, 0) end return true end local function Alert(uid) if (isCreature(uid)) then if getPlayerStorageValue(uid, 16702) == -1 or getPlayerStorageValue(uid, 16700) == -1 then return false end doSendAnimatedText(getThingPos(uid), "Flag!", math.random(50, 200)) local bla = {18, 19, 21, 22, 23, 24} doSendMagicEffect(getThingPos(uid), bla[math.random(#bla)]) if (os.time() - getPlayerStorageValue(uid, 16703) >= 60) then CTF.returnFlag(uid) return setPlayerStorageValue(uid, 16703, -1) end addEvent(Alert, 500, uid) return true end return false end function CTF.stealFlag(uid, team) setPlayerStorageValue(uid, 16702, team) setPlayerStorageValue(uid, 16703, os.time()) CTF.broadCast(getCreatureName(uid) .. " roubou a bandeira do time ".. team .. "!") Alert(uid) return true end function doFindItemInPos(ids, pos) -- By Undead Slayer local results = {} for _ = 0, 255 do local findPos = {x = pos.x, y = pos.y, z = pos.z, stackpos = _} if isInArray(ids, getThingFromPos(findPos).itemid) then table.insert(results, getThingFromPos(findPos)) end end return results end na hora de entregar a bandeira fica bugado Meu servidor https://www.facebook.com/Heavennoobwar
Postado Junho 1, 2016 9 anos Abaixo dessa linha doPlayerAddExperience(cid, xp) Adicione assim doPlayerAddItem(cid, XXXX, 1) XXXX - ID do item 1 - quantidade do item Obs.: Não testei, mas ja tive essa ideia... Testa ai pra mim? xD GitHub: https://github.com/s3kk Conteúdo: [SERVER] Heromassa[GESIOR] Gesior 2012 modificado por Sekk[GESIOR] Shop Addons & Mounts - TFS 1.x[GESIOR] Outfitter para Characters e Rank[SISTEMA] Castle 24h[TALKACTION] Multi Element Wand[ACTION] Multi Elemental Arrow & Shield[PROGRAMAÇÃO] Compilar TFS 0.4 no Linux[PROGRAMAÇÃO] Compilando TFS 0.4 no MSVC(x64 e x32) [INFRAESTRUTURA] Configuração COMPLETA Google VM + Tibia 11.x
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.