Ir para conteúdo

[Encerrado] [Poketibia] Rank para Duel.


atakashi

Posts Recomendados

Pessoal,

boa noite, alguem pode me ajudar a por um rank de duel, e tipo adicionar no meu script uma storage para quem ganha o duel e uma para quem perde, e o ranking eu queria por no ranking do site, vo passa o script do ranking junto, tipo eu qero assim que apareça o nome da pessoa, ai de verde as vitórias e de vermelho as derrotas.

Tipo assim.

 

Xtibia 50 / 1

 

Aqui meu script de duel.

 

 


storagesDuel = {52480, 52481, 52482, 52482, 52483, 52484, 52485, 6598754}
storageswinner = {52480, 52481, 52482, 52482, 52483, 52484, 52485, 6598754}
--[[ Lista das storages Duel!
52480 = sto de duelo e do modo de duel;
52481 = sto de pokes no duel;
52482 = sto do seu time;
52483 = sto do time adversario;
52484 = sto de aceitaçao de duel e do começo do duel;
52485 = sto do nome do 'invitador';
6598754 = sto do canAttackOther;
]]

function beginDuel(cid, n)
if getPlayerStorageValue(cid, 52482) == -1 or getPlayerStorageValue(cid, 52483) == -1 then
return true
end
local t1 = string.explode(getPlayerStorageValue(cid, 52482), ",")
local t2 = string.explode(getPlayerStorageValue(cid, 52483), ",")
local sto2, sto3 = getPlayerStorageValue(cid, 52482), getPlayerStorageValue(cid, 52483)

if n == 0 then
for i = 1, #t1 do
local pid, sid = getPlayerByName(t1), getPlayerByName(t2)
if isCreature(pid) and getPlayerStorageValue(pid, 52480) >= 1 then
setPlayerStorageValue(pid, 6598754, 5)
setPlayerStorageValue(pid, 52482, sto2)
setPlayerStorageValue(pid, 52483, sto3)
setPlayerStorageValue(pid, 52484, 10)
end
---
if isCreature(sid) and getPlayerStorageValue(sid, 52480) >= 1 then
setPlayerStorageValue(sid, 6598754, 10)
setPlayerStorageValue(sid, 52482, sto2)
setPlayerStorageValue(sid, 52483, sto3)
setPlayerStorageValue(sid, 52484, 10)
end
---
doSendAnimatedText(getThingPosWithDebug(pid), "START", 215)
doSendAnimatedText(getThingPosWithDebug(sid), "START", 215)
end
return true
else
for i = 1, #t1 do
local pid, sid = getPlayerByName(t1), getPlayerByName(t2)
if isCreature(pid) and getPlayerStorageValue(pid, 52480) >= 1 then
doSendAnimatedText(getThingPosWithDebug(pid), (n == 6 and "" or ""..n.."!"), 215)
end
if isCreature(sid) and getPlayerStorageValue(sid, 52480) >= 1 then
doSendAnimatedText(getThingPosWithDebug(sid), (n == 6 and "" or ""..n.."!"), 215)
end
end
n = n-1
end
addEvent(beginDuel, 1000, cid, n)
end


function removeFromTableDuel(cid, value)
if not isCreature(cid) then return true end
local t1 = string.explode(getPlayerStorageValue(cid, 52482), ",")
local t2 = string.explode(getPlayerStorageValue(cid, 52483), ",")

table.remove(t1, table.find(t1, value) or -1)
table.remove(t2, table.find(t2, value) or -1)
---
local str1, str2 = "", ""
for i = 1, 3 do
if t1 then str1 = str1..(t1 or "").."," end
if t2 then str2 = str2..(t2 or "").."," end
end
setPlayerStorageValue(cid, 52482, str1)
setPlayerStorageValue(cid, 52483, str2)
return true
end

function isDuelingAgainst(cid, pid)
if not isCreature(cid) or not isCreature(pid) then return false end
-----
local t1 = string.explode(getPlayerStorageValue(cid, 52482), ",")
local t2 = string.explode(getPlayerStorageValue(cid, 52483), ",")
-----
local name1, name2 = getCreatureName(cid), getCreatureName(pid)
-----
if table.find(t1, name1) ~= nil and table.find(t2, name2) ~= nil then
return true
elseif table.find(t2, name1) ~= nil and table.find(t1, name2) ~= nil then
return true
end
return false
end

function doEndDuel(cid, desisto)
if isCreature(cid) then
if getPlayerStorageValue(cid, 52482) ~= -1 then
t1 = string.explode(getPlayerStorageValue(cid, 52482), ",")
t2 = string.explode(getPlayerStorageValue(cid, 52483), ",")
end

local invit = getPlayerByName(getPlayerStorageValue(cid, 52485))
if isCreature(invit) then
table1 = string.explode(getPlayerStorageValue(invit, 52482), ",")
table2 = string.explode(getPlayerStorageValue(invit, 52483), ",")
end

if getPlayerStorageValue(cid, 52484) ~= 10 then
if getPlayerStorageValue(cid, 52482) ~= -1 then
for a = 1, 3 do
local pid, sid = getPlayerByName(t1[a]), getPlayerByName(t2[a])
if isCreature(pid) then doCreatureSetSkullType(pid, 0) doRemoveCondition(pid, CONDITION_INFIGHT) end
if isCreature(sid) then doCreatureSetSkullType(sid, 0) doRemoveCondition(sid, CONDITION_INFIGHT) end
for i = 1, #storagesDuel do
if isCreature(pid) then setPlayerStorageValue(pid, storagesDuel, -1) end
if isCreature(sid) then setPlayerStorageValue(sid, storagesDuel, -1) end
end
end
else
for i = 1, #storagesDuel do
setPlayerStorageValue(cid, storagesDuel, -1)
end
doCreatureSetSkullType(cid, 0)
doRemoveCondition(cid, CONDITION_INFIGHT)
---------------------------------
if table2 then
local numero = 0
for i = 1, #table2 do
local ppid = getPlayerByName(table2)
if not isCreature(ppid) or getPlayerStorageValue(ppid, 52480) ~= -1 then
numero = numero+1
end
end
if numero == 0 then doEndDuel(invit) sendMsgToPlayer(invit, 20, "The opponents are give up! Duel is canceled!") end
end
--------------------------------
end
if desisto then doSendAnimatedText(getThingPosWithDebug(cid), "GIVE UP", COLOR_BLUE) end
return true
end

for a = 1, #t1 do
local pid, sid = getPlayerByName(t1[a]), getPlayerByName(t2[a])
removeFromTableDuel(pid, getCreatureName(cid))
removeFromTableDuel(sid, getCreatureName(cid))
end

local t3 = string.explode(getPlayerStorageValue(cid, 52482), ",")
local t4 = string.explode(getPlayerStorageValue(cid, 52483), ",")
if (#t3 == 0 and #t4 >= 1) or (#t4 == 0 and #t3 >= 1) then

for j = 1, (#t3 > 0 and #t3 or #t4) do
local winner = #t3 > 0 and getPlayerByName(t3[j]) or getPlayerByName(t4[j])
if isCreature(winner) then
addEvent(doSendAnimatedText, 500, getThingPosWithDebug(winner), "WIN", COLOR_ELECTRIC)
for i = 1, #storagesDuel do
setPlayerStorageValue(winner, storagesDuel, -1)
end
doCreatureSetSkullType(winner, 0)
doRemoveCondition(winner, CONDITION_INFIGHT)
end
end
addEvent(doSendAnimatedText, 500, getThingPosWithDebug(cid), "LOSE", COLOR_BURN)
for i = 1, #storagesDuel do
setPlayerStorageValue(cid, storagesDuel, -1)
setPlayerStorageValue(cid, 60001, (getPlayerStorageValue(cid, 60001)+1))
end
doCreatureSetSkullType(cid, 0)
doRemoveCondition(cid, CONDITION_INFIGHT)

else
for i = 1, #storagesDuel do
setPlayerStorageValue(cid, storagesDuel, -1)
end
doCreatureSetSkullType(cid, 0)
doRemoveCondition(cid, CONDITION_INFIGHT)
if desisto then
doSendAnimatedText(getThingPosWithDebug(cid), "GIVE UP", COLOR_BLUE)
else
addEvent(doSendAnimatedText, 500, getThingPosWithDebug(cid), "LOSE", COLOR_BURN)
setPlayerStorageValue(cid, 60002, (getPlayerStorageValue(cid, 60002)+1))
end
end
end
end

function checkDuel(cid)
if getPlayerStorageValue(cid, 52484) ~= 10 then return true end
if getPlayerStorageValue(cid, 52481) >= 1 then
setPlayerStorageValue(cid, 52481, getPlayerStorageValue(cid, 52481)-1)
doSendAnimatedText(getThingPosWithDebug(cid), "POKE DOWN", 65)
end
if getPlayerStorageValue(cid, 52481) == 0 then
doEndDuel(cid)
end
end
--/////////////////////////////////////////////////////////////////////////////////////////////--

 

 

Script do ranking do site.

 

 


<!-- Modificado e Editado por Nibelins [WebSite PokeTibia]-->
<div style='position:absolute; float:left; margin-top:-65px; margin-left:475px;'>
<font face="Cambria" size="5" color="#FFCC33"><b>RANKING</b></font></div>
<?php
require("config.php");
$ide = new IDE;
try {$ide->loadInjections("highscores");} catch(Exception $e) {error($e->getMessage()); }
echo form_open('highscores');
$uri = $this->uri->segment(5) ? $this->uri->segment(5) : 0;

if(count($config['worlds']) > 1) {
echo "<b>World</b>  ";
echo "<select name='world'>";
foreach($config['worlds'] as $id=>$name) {
if($_POST['world'] == $id)
echo "<option selected='true' value='$id'>$name</option>";
else
echo "<option value='$id'>$name</option>";
}
echo "</select>";
}

echo "  <b>Rank de</b>  ";
echo "<select name='skill'>";
echo "<option class='skill' ".set_select('skill', 1, true)." value='level'>Level</option>";
echo "<option class='skill' ".set_select('skill', 8)." value='7'>Fishing</option>";
echo "</select>";
echo " <input type='submit' value='Mostrar'>";

echo "</form>";

echo "<h2><center>Ranking de ". (is_numeric($type) ? $skills[$type] : $type) ." em ".$config['worlds'][$world]."</center></h2>";

$i = 1 + $uri;
echo "<table width='100%'>";
if(is_numeric($type)) {

echo "<tr><td width='5%'><b><center>Rank</center></b></td><td width='40%'><center><b>Nome</b></center></td><td width='5%'><center><b>Skill</b></center></td></tr>";
foreach($players as $player) {
if(in_array($player['name'], $config['newchar_vocations'][0])) continue;
echo '<tr><td width="5%" align="center">'.$i.'</center></td><td width="40%" align="center"><a href="'.WEBSITE.'/index.php/character/view/'.$player['name'].'" class="'. ($player['online'] ? 'green' : 'red') .'">'.$player['name'].'</a></td><td width="5%" align="center">'.$player['value'].'</td></tr>';
$i++;
}
}else{
switch($type) {
case 'level':
echo "<tr><td width='5%'><b><center>Rank</center></b></td><td width='40%'><center><b>Nome</b></center></td><td width='10%'><center><b>Experiência</b></center></td><td width='5%'><center><b>Level</b></center></td></tr>";
foreach($players as $player) {
if(in_array($player['name'], $config['newchar_vocations'][0])) continue;
echo '<tr><td width="5%" align="center">'.$i.'</td><td width="40%" align="center"><a href="'.WEBSITE.'/index.php/character/view/'.$player['name'].'" class="'. ($player['online'] ? 'green' : 'red') .'">'.$player['name'].'</a></td><td width="10%" align="center">'.$player['experience'].'</td><td width="5%" align="center">'.$player['level'].'</td></tr>';
$i++;
}
break;
case 'magic':
echo "<tr><td width='5%'><b><center>*</center></b></td><td width='40%'><center><b>Name</b></center></td><td width='5%'><center><b>Level</b></center></td></tr>";
foreach($players as $player) {
if(in_array($player['name'], $config['newchar_vocations'][0])) continue;
echo '<tr><td width="5%" align="center">'.$i.'</td><td width="40%" align="center"><a href="'.WEBSITE.'/index.php/character/view/'.$player['name'].'" class="'. ($player['online'] ? 'green' : 'red') .'">'.$player['name'].'</a></td><td width="5%" align="center">'. $player['maglevel'] .'</td></tr>';
$i++;
}
break;
}
}
echo "</table>";
echo $this->pagination->create_links();
?>
</div></div>

 

 

Alguem ajuda ai,

vo da rep :D.

 

 

Obs: administração deletem meus topicos na area de website errei e caiu a net ai saiu double, desculpe-me.

Link para o comentário
Compartilhar em outros sites

 

storagesDuel = {52480, 52481, 52482, 52482, 52483, 52484, 52485, 6598754}
storageswinner = {52480, 52481, 52482, 52482, 52483, 52484, 52485, 6598754}
--[[ Lista das storages Duel!
52480 = sto de duelo e do modo de duel;
52481 = sto de pokes no duel;
52482 = sto do seu time;
52483 = sto do time adversario;
52484 = sto de aceitaçao de duel e do começo do duel;
52485 = sto do nome do 'invitador';
6598754 = sto do canAttackOther;
]]

function beginDuel(cid, n)
if getPlayerStorageValue(cid, 52482) == -1 or getPlayerStorageValue(cid, 52483) == -1 then
return true
end
local t1 = string.explode(getPlayerStorageValue(cid, 52482), ",")
local t2 = string.explode(getPlayerStorageValue(cid, 52483), ",")
local sto2, sto3 = getPlayerStorageValue(cid, 52482), getPlayerStorageValue(cid, 52483)

if n == 0 then
for i = 1, #t1 do
local pid, sid = getPlayerByName(t1), getPlayerByName(t2)
if isCreature(pid) and getPlayerStorageValue(pid, 52480) >= 1 then
setPlayerStorageValue(pid, 6598754, 5)
setPlayerStorageValue(pid, 52482, sto2)
setPlayerStorageValue(pid, 52483, sto3)
setPlayerStorageValue(pid, 52484, 10)
end
---
if isCreature(sid) and getPlayerStorageValue(sid, 52480) >= 1 then
setPlayerStorageValue(sid, 6598754, 10)
setPlayerStorageValue(sid, 52482, sto2)
setPlayerStorageValue(sid, 52483, sto3)
setPlayerStorageValue(sid, 52484, 10)
end
---
doSendAnimatedText(getThingPosWithDebug(pid), "START", 215)
doSendAnimatedText(getThingPosWithDebug(sid), "START", 215)
end
return true
else
for i = 1, #t1 do
local pid, sid = getPlayerByName(t1), getPlayerByName(t2)
if isCreature(pid) and getPlayerStorageValue(pid, 52480) >= 1 then
doSendAnimatedText(getThingPosWithDebug(pid), (n == 6 and "" or ""..n.."!"), 215)
end
if isCreature(sid) and getPlayerStorageValue(sid, 52480) >= 1 then
doSendAnimatedText(getThingPosWithDebug(sid), (n == 6 and "" or ""..n.."!"), 215)
end
end
n = n-1
end
addEvent(beginDuel, 1000, cid, n)
end


function removeFromTableDuel(cid, value)
if not isCreature(cid) then return true end
local t1 = string.explode(getPlayerStorageValue(cid, 52482), ",")
local t2 = string.explode(getPlayerStorageValue(cid, 52483), ",")

table.remove(t1, table.find(t1, value) or -1)
table.remove(t2, table.find(t2, value) or -1)
---
local str1, str2 = "", ""
for i = 1, 3 do
if t1 then str1 = str1..(t1 or "").."," end
if t2 then str2 = str2..(t2 or "").."," end
end
setPlayerStorageValue(cid, 52482, str1)
setPlayerStorageValue(cid, 52483, str2)
return true
end

function isDuelingAgainst(cid, pid)
if not isCreature(cid) or not isCreature(pid) then return false end
-----
local t1 = string.explode(getPlayerStorageValue(cid, 52482), ",")
local t2 = string.explode(getPlayerStorageValue(cid, 52483), ",")
-----
local name1, name2 = getCreatureName(cid), getCreatureName(pid)
-----
if table.find(t1, name1) ~= nil and table.find(t2, name2) ~= nil then
return true
elseif table.find(t2, name1) ~= nil and table.find(t1, name2) ~= nil then
return true
end
return false
end

function doEndDuel(cid, desisto)
if isCreature(cid) then
if getPlayerStorageValue(cid, 52482) ~= -1 then
t1 = string.explode(getPlayerStorageValue(cid, 52482), ",")
t2 = string.explode(getPlayerStorageValue(cid, 52483), ",")
end

local invit = getPlayerByName(getPlayerStorageValue(cid, 52485))
if isCreature(invit) then
table1 = string.explode(getPlayerStorageValue(invit, 52482), ",")
table2 = string.explode(getPlayerStorageValue(invit, 52483), ",")
end

if getPlayerStorageValue(cid, 52484) ~= 10 then
if getPlayerStorageValue(cid, 52482) ~= -1 then
for a = 1, 3 do
local pid, sid = getPlayerByName(t1[a]), getPlayerByName(t2[a])
if isCreature(pid) then doCreatureSetSkullType(pid, 0) doRemoveCondition(pid, CONDITION_INFIGHT) end
if isCreature(sid) then doCreatureSetSkullType(sid, 0) doRemoveCondition(sid, CONDITION_INFIGHT) end
for i = 1, #storagesDuel do
if isCreature(pid) then setPlayerStorageValue(pid, storagesDuel, -1) end
if isCreature(sid) then setPlayerStorageValue(sid, storagesDuel, -1) end
end
end
else
for i = 1, #storagesDuel do
setPlayerStorageValue(cid, storagesDuel, -1)
end
doCreatureSetSkullType(cid, 0)
doRemoveCondition(cid, CONDITION_INFIGHT)
---------------------------------
if table2 then
local numero = 0
for i = 1, #table2 do
local ppid = getPlayerByName(table2)
if not isCreature(ppid) or getPlayerStorageValue(ppid, 52480) ~= -1 then
numero = numero+1
end
end
if numero == 0 then doEndDuel(invit) sendMsgToPlayer(invit, 20, "The opponents are give up! Duel is canceled!") end
end
--------------------------------
end
if desisto then doSendAnimatedText(getThingPosWithDebug(cid), "GIVE UP", COLOR_BLUE) end
return true
end

for a = 1, #t1 do
local pid, sid = getPlayerByName(t1[a]), getPlayerByName(t2[a])
removeFromTableDuel(pid, getCreatureName(cid))
removeFromTableDuel(sid, getCreatureName(cid))
end

local t3 = string.explode(getPlayerStorageValue(cid, 52482), ",")
local t4 = string.explode(getPlayerStorageValue(cid, 52483), ",")
if (#t3 == 0 and #t4 >= 1) or (#t4 == 0 and #t3 >= 1) then

for j = 1, (#t3 > 0 and #t3 or #t4) do
local winner = #t3 > 0 and getPlayerByName(t3[j]) or getPlayerByName(t4[j])
if isCreature(winner) then
doPlayerAddSkillTry(cid, 5, 1)
addEvent(doSendAnimatedText, 500, getThingPosWithDebug(winner), "WIN", COLOR_ELECTRIC)
for i = 1, #storagesDuel do
setPlayerStorageValue(winner, storagesDuel, -1)
end
doCreatureSetSkullType(winner, 0)
doRemoveCondition(winner, CONDITION_INFIGHT)
end
end
addEvent(doSendAnimatedText, 500, getThingPosWithDebug(cid), "LOSE", COLOR_BURN)
for i = 1, #storagesDuel do
setPlayerStorageValue(cid, storagesDuel, -1)
setPlayerStorageValue(cid, 60001, (getPlayerStorageValue(cid, 60001)+1))
end
doCreatureSetSkullType(cid, 0)
doRemoveCondition(cid, CONDITION_INFIGHT)

else
for i = 1, #storagesDuel do
setPlayerStorageValue(cid, storagesDuel, -1)
end
doCreatureSetSkullType(cid, 0)
doRemoveCondition(cid, CONDITION_INFIGHT)
if desisto then
doSendAnimatedText(getThingPosWithDebug(cid), "GIVE UP", COLOR_BLUE)
else
addEvent(doSendAnimatedText, 500, getThingPosWithDebug(cid), "LOSE", COLOR_BURN)
setPlayerStorageValue(cid, 60002, (getPlayerStorageValue(cid, 60002)+1))
end
end
end
end

function checkDuel(cid)
if getPlayerStorageValue(cid, 52484) ~= 10 then return true end
if getPlayerStorageValue(cid, 52481) >= 1 then
setPlayerStorageValue(cid, 52481, getPlayerStorageValue(cid, 52481)-1)
doSendAnimatedText(getThingPosWithDebug(cid), "POKE DOWN", 65)
doPlayerAddSkillTry(cid, 6, 1)
end
if getPlayerStorageValue(cid, 52481) == 0 then
doEndDuel(cid)
end
end

 

 

Esse script de rank seu pelo site é rank magic,dista,sword,axe,fish,club? se for vc adiciona essa funçao doPlayerAddSkillTry(cid, 5, 1) e tambem essa doPlayerAddSkillTry(cid, 6, 1) eu adicionei ve se da certo!

 

obs: eu coloquei quando perder ganha skill e ganhar ganha skill tambem ai tem o rank de skill no site

obs²: testa o duel com meu script e ve se ganha algum skill ai e so muda nome do skill no site para duel win e duel lose

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

  • 4 years later...
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...