Reset System sem Logout

Suporte Chaitosoft

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 31/01/16Posts: 10

Olá pessoal do XTibia, tudo na boa? Após pesquisar muito não consegui encontrar um sistema de reset para usar no servidor de nosso cliente Demolidores então decidi fazer a junção de alguns sistemas e montei também um ranking para Gesior.

 

Chega de blá blá blá e vamos direto ao script.

 

 

1°- Adicione a tag em seu "talkactions.xml";

<talkaction words="!resetar;!reset" event="script" value="reseting.lua"/>

2°- Adicione o arquivo "reseting.lua" ao diretório "/data/talkactions/scripts/";

function onSay(cid, words, param, channel)

config = {
RemainingLvl=8,
exper=4200,
pid=getPlayerGUID(cid),
batle="yes"
}

function getPlayerResets(cid)
resets = getPlayerStorageValue(cid,1021)
if resets < 0 then
resets = 0
end
return resets
end

if (config.batle == "yes") and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then
doPlayerSendTextMessage(cid,22,"Você Precisa estar sem Battle para Resetar.")      
return TRUE
end

if (getPlayerStorageValue(cid, 11548) >= os.time()) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"Por medidas de segurança você só pode utilizar este comando em " .. (getPlayerStorageValue(cid, 11548)-os.time()+(0)) .. " segundos.")
return TRUE
end

local healthMax, manaMax = getCreatureMaxHealth(cid), getCreatureMaxMana(cid)
----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 85 and getPlayerResets(cid) == 15 then
if getPlayerLevel(cid) >= 16000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 16000 ou mais para poder resetar.") 
end
end
----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 80 and getPlayerResets(cid) == 14 then
if getPlayerLevel(cid) >= 15000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 15000 ou mais para poder resetar.") 
end
end

----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 70 and getPlayerResets(cid) == 13 then
if getPlayerLevel(cid) >= 14000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 14000 ou mais para poder resetar.") 
end
end

----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 65 and getPlayerResets(cid) == 12 then
if getPlayerLevel(cid) >= 13000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 13000 ou mais para poder resetar.") 
end
end

----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 60 and getPlayerResets(cid) == 11 then
if getPlayerLevel(cid) >= 12000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 12000 ou mais para poder resetar.") 
end
end

----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 55 and getPlayerResets(cid) == 10 then
if getPlayerLevel(cid) >= 11000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 11000 ou mais para poder resetar.") 
end
end

----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 50 and getPlayerResets(cid) == 9 then
if getPlayerLevel(cid) >= 10000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 10000 ou mais para poder resetar.") 
end
end

----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 45 and getPlayerResets(cid) == 8 then
if getPlayerLevel(cid) >= 9000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 9000 ou mais para poder resetar.") 
end
end

----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 40 and getPlayerResets(cid) == 7 then
if getPlayerLevel(cid) >= 8000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 8000 ou mais para poder resetar.") 
end
end

----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 35 and getPlayerResets(cid) == 6 then
if getPlayerLevel(cid) >= 7000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 7000 ou mais para poder resetar.") 
end
end

----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 30 and getPlayerResets(cid) == 5 then
if getPlayerLevel(cid) >= 6000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 6000 ou mais para poder resetar.") 
end
end

----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 25 and getPlayerResets(cid) == 4 then
if getPlayerLevel(cid) >= 5000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 5000 ou mais para poder resetar.") 
end
end

----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 20 and getPlayerResets(cid) == 3 then
if getPlayerLevel(cid) >= 4000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 4000 ou mais para poder resetar.") 
end
end
----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 15 and getPlayerResets(cid) == 2 then
if getPlayerLevel(cid) >= 3000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 3000 ou mais para poder resetar.") 
end
end

----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 10 and getPlayerResets(cid) == 1 then
if getPlayerLevel(cid) >= 2000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 2000 ou mais para poder resetar.") 
end
end
----------------------------------------------------------------------------------------------------------------------------------------
if getPlayerStorageValue(cid,1021) < 5 and getPlayerResets(cid) == 0 then
if getPlayerLevel(cid) >= 1000 then 
setPlayerStorageValue(cid,1021,getPlayerResets(cid)+1) 
setPlayerStorageValue(cid,11548,os.time()+30)
doPlayerAddLevel(cid, config.RemainingLvl)
setCreatureMaxHealth(cid, healthMax)
setCreatureMaxMana(cid, manaMax)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
db.executeQuery("UPDATE `players` SET `reset` = `reset` + 1 WHERE `id` = "..config.pid)
else 
doPlayerSendCancel(cid,"Você precisa ter level 1000 ou mais para poder resetar.") 
end
end


return true
end

3°- Execute a query SQL para criar a coluna "reset" no banco de dados Mysql;

ALTER TABLE `players` ADD `reset` BIGINT(255) NOT NULL DEFAULT '0';

4°- Configure o "index.php" do seu Gesior para receber a página PHP;

<?php
	$limitt = 100; 
	$zap = $SQL->query('SELECT `name`,`level`, `reset`  FROM `players` WHERE `group_id` < '.$config['site']['players_group_id_block'].' AND `name` != "Account Manager" ORDER BY `reset` DESC, `level` DESC LIMIT 100;'); 
	$number_of_rows = 0; 
	$main_content .= '
		<center><h2>Reset Ranking</h2></center>
		<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%>
	<tr bgcolor="#af2126">
		<td><font color="white">Nome</font></td>
		<td><font color="white">Reset</font></td>
		<td><font color="white">Level</font></td>
	</tr>
	';	
	foreach($zap as $wynik) { 
	if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; }
		$number_of_rows++; 
	$main_content .= '
	<tr bgcolor="'.$bgcolor.'">
		<td>
			<a href="index.php?subtopic=characters&name='.urlencode($wynik['name']).'">
			<b> '.$wynik['name'].' </b></a>
		</td>
		<td>
			'.$wynik['reset'].'
		</td>
		<td>
			'.$wynik['level'].'
		</td>
	</tr>
		';
	}
	$main_content .= '
		</tr>	
	</table>';

?>

Seria basicamente isto, espero que possa ter contribuído com alguém. Para alterar o numero de resets permitidos é só remover ou adicionar as linhas.

Administrador

xTibia 2017
avatar
Administrador
Administrador

INFOS

Grupo: AdministradorRegistrado: 09/07/05Posts: 5780Gênero: Outro

Ótimo script, bem organizado também.

Obrigado por compartilhar conosco ^^

DICA

Utilize botão @UP, no início de seu tópico, para atualizar o destaque de seu tópico em "Tópicos Recentes" na index, fará com que mais pessoas o vejam.