Líderes
Conteúdo Popular
Exibindo conteúdo com a maior reputação em 07/07/10 em todas áreas
-
Vip System by Account 1.0 By Kydrai Este é um vip system por account, ou seja, um sistema de vip válido para todos os characters de uma determinada conta. O script foi testado no TFS 0.3.6 - 8.54. E no site Gesior 0.3.4 beta4. Em caso de erros ou dúvidas é só postar. Funções do Script Função necessária para começar a usar o script: installVip() -> Cria a coluna no banco de dados para usar o sistema de vip (testei somente em sqlite, mas acredito que funcione em mysql) Funções que utilizam o account id: doTeleportPlayersByAccount(acc, topos) -> Teleporta todos os players da account getVipTimeByAccount(acc) -> Pega o tempo de vip setVipTimeByAccount(acc, time) -> Edita o tempo de vip getVipDaysByAccount(acc) -> Pega o tempo de vip em dias isVipAccount(acc) -> Verifica se é vip addVipDaysByAccount(acc, days) -> Adiciona dias de vip doRemoveVipDaysByAccount(acc, days) -> Remove dias de vip getVipDateByAccount(acc) -> Pega a data e hora que irá terminar a vip Funções que utilizam o creature id (cid): doTeleportPlayers(cid, topos) -> Teleporta todos os players da account getVipTime(cid) -> Pega o tempo de vip setVipTime(cid, time) -> Edita o tempo de vip getVipDays(cid) -> Pega o tempo de vip em dias isVip(cid) -> Verifica se é vip addVipDays(cid, days) -> Adiciona dias de vip doRemoveVipDays(cid, days) -> Remove dias de vip getVipDate(cid) -> Pega a data e hora que irá terminar a vip Inserindo as funções Abra a pasta data/lib, crie um arquivo lua e coloque: vipAccount.lua --[[ Name: Vip System by Account Version: 1.0 Author: Kydrai Forum: http://www.xtibia.com/forum/topic/136543-vip-system-by-account-v10/ [Functions] -- Install installVip() -- By Account doTeleportPlayersByAccount(acc, topos) getVipTimeByAccount(acc) setVipTimeByAccount(acc, time) getVipDaysByAccount(acc) isVipAccount(acc) addVipDaysByAccount(acc, days) doRemoveVipDaysByAccount(acc, days) getVipDateByAccount(acc) -- By Player doTeleportPlayers(cid, topos) getVipTime(cid) setVipTime(cid, time) getVipDays(cid) isVip(cid) addVipDays(cid, days) doRemoveVipDays(cid, days) getVipDate(cid) ]]-- -- Install function installVip() if db.executeQuery("ALTER TABLE `accounts` ADD viptime INT(15) NOT NULL DEFAULT 0;") then print("[Vip System] Vip System instalado com sucesso!") return TRUE end print("[Vip System] Não foi possível instalar o Vip System!") return FALSE end -- By Account function doTeleportPlayersByAccount(acc, topos) if db.executeQuery("UPDATE `players` SET `posx` = "..topos.x..", `posy` = "..topos.y..", `posz` = "..topos.z.." WHERE `account_id` = "..acc..";") then return TRUE end return FALSE end function getVipTimeByAccount(acc) local vip = db.getResult("SELECT `viptime` FROM `accounts` WHERE `id` = "..acc..";") if vip:getID() == -1 then print("[Vip System] Account not found!") return FALSE end return vip:getDataInt("viptime") end function setVipTimeByAccount(acc, time) if db.executeQuery("UPDATE `accounts` SET `viptime` = "..time.." WHERE `id` = "..acc..";") then return TRUE end return FALSE end function getVipDaysByAccount(acc) local vipTime = getVipTimeByAccount(acc) local timeNow = os.time() local days = math.ceil((vipTime - timeNow)/(24 * 60 * 60)) return days <= 0 and 0 or days end function isVipAccount(acc) return getVipDaysByAccount(acc) > 0 and TRUE or FALSE end function addVipDaysByAccount(acc, days) if days > 0 then local daysValue = days * 24 * 60 * 60 local vipTime = getVipTimeByAccount(acc) local timeNow = os.time() local time = getVipDaysByAccount(acc) == 0 and (timeNow + daysValue) or (vipTime + daysValue) setVipTimeByAccount(acc, time) return TRUE end return FALSE end function doRemoveVipDaysByAccount(acc, days) if days > 0 then local daysValue = days * 24 * 60 * 60 local vipTime = getVipTimeByAccount(acc) local time = vipTime - daysValue setVipTimeByAccount(acc, (time <= 0 and 1 or time)) return TRUE end return FALSE end function getVipDateByAccount(acc) if isVipAccount(acc) then local vipTime = getVipTimeByAccount(acc) return os.date("%d/%m/%y %X", vipTime) end return FALSE end -- By Player function doTeleportPlayers(cid, topos) doTeleportPlayersByAccount(getPlayerAccountId(cid), topos) end function getVipTime(cid) return getVipTimeByAccount(getPlayerAccountId(cid)) end function setVipTime(cid, time) return setVipTimeByAccount(getPlayerAccountId(cid), time) end function getVipDays(cid) return getVipDaysByAccount(getPlayerAccountId(cid)) end function isVip(cid) return isVipAccount(getPlayerAccountId(cid)) end function addVipDays(cid, days) return addVipDaysByAccount(getPlayerAccountId(cid), days) end function doRemoveVipDays(cid, days) return doRemoveVipDaysByAccount(getPlayerAccountId(cid), days) end function getVipDate(cid) return getVipDateByAccount(getPlayerAccountId(cid)) end Exemplos de uso Talkaction GOD: /installvip /addvip name, days /removevip name, days /checkvip name Player: /buyvip /vipdays talkactions.xml: <talkaction log="yes" access="5" words="/installvip;/addvip;/removevip;/checkvip" event="script" value="vipaccgod.lua"/> <talkaction words="/buyvip;/vipdays" event="script" value="vipaccplayer.lua"/> vipaccgod.lua: function onSay(cid, words, param, channel) local t = param:explode(",") local name, days = t[1], tonumber(t[2]) if words == "/installvip" then if installVip() then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Vip System instalado com sucesso!") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não foi possível instalar o Vip System!") end elseif words == "/addvip" then if name then if days then local acc = getAccountIdByName(name) if acc ~= 0 then addVipDaysByAccount(acc, days) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você adicionou "..days.." dia(s) de vip ao "..name..", agora ele possui "..getVipDaysByAccount(acc).." dia(s) de vip.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este player não existe.") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode adicionar essa quantidade de dia(s) de vip.") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode adicionar dia(s) de vip a este player.") end elseif words == "/removevip" then if name then if days then local acc = getAccountIdByName(name) if acc ~= 0 then doRemoveVipDaysByAccount(acc, days) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você retirou "..days.." dia(s) de vip do "..name..", agora ele possui "..getVipDaysByAccount(acc).." dia(s) de vip.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este player não existe.") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode retirar essa quantidade de dia(s) de vip.") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode retirar dia(s) de vip a este player.") end elseif words == "/checkvip" then if name then local acc = getAccountIdByName(name) if acc ~= 0 then local duration = getVipDateByAccount(acc) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O "..name.." possui "..getVipDaysByAccount(acc).." dias de vip."..(duration and (" Ela irá durar até "..duration..".") or "")) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este player não existe.") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode visualizar os dias de vip a este player.") end end return TRUE end vipaccplayer.lua: function onSay(cid, words, param, channel) if words == "/buyvip" then local price = 1000000 local days = 30 if doPlayerRemoveMoney(cid, price) then addVipDays(cid, days) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você adicionou "..days.." dia(s) de vip, agora você possui "..getVipDays(cid).." dia(s) de vip.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa de "..price.." para adicionar "..days.." dia(s) de vip.") end elseif words == "/vipdays" then local duration = getVipDate(cid) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você possui "..getVipDays(cid).." dia(s) de vip."..(duration and (" Ela irá durar até "..duration..".") or "")) end return TRUE end Movement (Tile) Coloque actionid 15000 em um tile onde somente os vips poderão passar. movements.xml: <movevent type="StepIn" actionid="15000" event="script" value="viptile.lua"/> viptile.lua: function onStepIn(cid, item, position, fromPosition) if isVip(cid) == FALSE then doTeleportThing(cid, fromPosition, false) doSendMagicEffect(position, CONST_ME_MAGIC_BLUE) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente players vip podem passar.") end return TRUE end Creaturescript (Login) Quando player logar irá verificar se a vip do player acabou, se sim então irá teleportar todos os players da account para o templo, se não irá mostrar o tempo da vip. creaturescripts.xml: <event type="login" name="viplogin" script="viplogin.lua"/> viplogin.lua: function onLogin(cid) local vip = isVip(cid) if getVipTime(cid) > 0 and vip == FALSE then local townid = 1 doPlayerSetTown(cid, townid) local templePos = getTownTemplePosition(getPlayerTown(cid)) doTeleportThing(cid, templePos, false) setVipTime(cid, 0) doTeleportPlayers(cid, templePos) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua Vip acabou!") elseif vip == TRUE then local duration = getVipDate(cid) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você possui "..getVipDays(cid).." dia(s) de vip."..(duration and (" Ela irá durar até "..duration..".") or "")) end return TRUE end Action (Door) Coloque actionid 15001 na door onde somente os vips poderão passar. Use a porta gate of expertise (id: 1227) actions.xml: <action actionid="15001" script="vipdoor.lua"/> vipdoor.lua: function onUse(cid, item, fromPosition, itemEx, toPosition) if isVip(cid) == FALSE then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Somente players vip podem passar.") elseif item.itemid == 1227 then doTransformItem(item.uid, item.itemid + 1) doTeleportThing(cid, toPosition) end return TRUE end NPC (Vendedor de VIP) vipnpc.xml: <?xml version="1.0" encoding="UTF-8"?> <npc name="Vendedor de VIP" script="vipnpc.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="128" head="17" body="54" legs="114" feet="0" addons="2"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|, I sell {vip} days."/> </parameters> </npc> vipnpc.lua: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function buyVip(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if doPlayerRemoveMoney(cid, parameters.price) then addVipDays(cid, parameters.days) npcHandler:say('Thanks, you buy '..parameters.days..' vip days. You have '..getVipDays(cid)..' vip days.', cid) else npcHandler:say('Sorry, you don\'t have enough money.', cid) end npcHandler:resetNpc() return true end local node1 = keywordHandler:addKeyword({'vip'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy 30 vip days for 1000000 gp\'s?'}) node1:addChildKeyword({'yes'}, buyVip, {price = 1000000, days = 30}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true}) npcHandler:addModule(FocusModule:new()) Erros e Soluções Configurando o Gesior Com essa configuração irá aparecer o vip status do player no site e será possível vender vip pelo site. Se eu esqueci de alguma coisa é só avisar. accountmanagement.php Depois de: if(!$account_logged->isPremium()) $account_status = '<b><font color="red">Free Account</font></b>'; else $account_status = '<b><font color="green">Premium Account, '.$account_logged->getPremDays().' days left</font></b>'; Adicione: if(!$account_logged->isVip()) $account_vip_status = '<b><font color="red">Not Vip Account</font></b>'; else $account_vip_status = '<b><font color="green">Vip Account, '.$account_logged->getVipDays().' days left</font></b>'; Depois de: <td class="LabelV" >Account Status:</td><td>'.$account_status.'</td></tr><tr style="background-color:'.$config['site']['darkborder'].';" > Adicione: <td class="LabelV" >Account Vip Status:</td><td>'.$account_vip_status.'</td></tr><tr style="background-color:'.$config['site']['darkborder'].';" > pot/OTS_Account.php Substitua: private $data = array('email' => '', 'blocked' => false, 'rlname' => '','location' => '','page_access' => 0,'lastday' => 0,'premdays' => 0, 'created' => 0); Por: private $data = array('email' => '', 'blocked' => false, 'rlname' => '','location' => '','page_access' => 0,'lastday' => 0,'premdays' => 0, 'created' => 0, 'viptime' => 0); Substitua: $this->data = $this->db->query('SELECT ' . $this->db->fieldName('id') . ', ' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('password') . ', ' . $this->db->fieldName('email') . ', ' . $this->db->fieldName('blocked') . ', ' . $this->db->fieldName('rlname') . ', ' . $this->db->fieldName('location') . ', ' . $this->db->fieldName('page_access') . ', ' . $this->db->fieldName('premdays') . ', ' . $this->db->fieldName('lastday') . ', ' . $this->db->fieldName('created') . ' FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . (int) $id)->fetch(); Por: $this->data = $this->db->query('SELECT ' . $this->db->fieldName('id') . ', ' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('password') . ', ' . $this->db->fieldName('email') . ', ' . $this->db->fieldName('blocked') . ', ' . $this->db->fieldName('rlname') . ', ' . $this->db->fieldName('location') . ', ' . $this->db->fieldName('page_access') . ', ' . $this->db->fieldName('premdays') . ', ' . $this->db->fieldName('viptime') . ', ' . $this->db->fieldName('lastday') . ', ' . $this->db->fieldName('created') . ' FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . (int) $id)->fetch(); Substitua: $this->db->query('UPDATE ' . $this->db->tableName('accounts') . ' SET ' . $this->db->fieldName('password') . ' = ' . $this->db->quote($this->data['password']) . ', ' . $this->db->fieldName('email') . ' = ' . $this->db->quote($this->data['email']) . ', ' . $this->db->fieldName('blocked') . ' = ' . (int) $this->data['blocked'] . ', ' . $this->db->fieldName('rlname') . ' = ' . $this->db->quote($this->data['rlname']) . ', ' . $this->db->fieldName('location') . ' = ' . $this->db->quote($this->data['location']) . ', ' . $this->db->fieldName('page_access') . ' = ' . (int) $this->data['page_access'] . ', ' . $this->db->fieldName('premdays') . ' = ' . (int) $this->data['premdays'] . ', ' . $this->db->fieldName('lastday') . ' = ' . (int) $this->data['lastday'] . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']); Por: $this->db->query('UPDATE ' . $this->db->tableName('accounts') . ' SET ' . $this->db->fieldName('password') . ' = ' . $this->db->quote($this->data['password']) . ', ' . $this->db->fieldName('email') . ' = ' . $this->db->quote($this->data['email']) . ', ' . $this->db->fieldName('blocked') . ' = ' . (int) $this->data['blocked'] . ', ' . $this->db->fieldName('rlname') . ' = ' . $this->db->quote($this->data['rlname']) . ', ' . $this->db->fieldName('location') . ' = ' . $this->db->quote($this->data['location']) . ', ' . $this->db->fieldName('page_access') . ' = ' . (int) $this->data['page_access'] . ', ' . $this->db->fieldName('premdays') . ' = ' . (int) $this->data['premdays'] . ', ' . $this->db->fieldName('viptime') . ' = ' . (int) $this->data['viptime'] . ', ' . $this->db->fieldName('lastday') . ' = ' . (int) $this->data['lastday'] . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']); Depois de: public function getPremDays() { if( !isset($this->data['premdays']) || !isset($this->data['lastday']) ) { throw new E_OTS_NotLoaded(); } return $this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday'])); } Adicione: public function getVipDays() { if( !isset($this->data['viptime']) || !isset($this->data['lastday']) ) { throw new E_OTS_NotLoaded(); } return ceil(($this->data['viptime'] - time()) / (24*60*60)); } Depois de: public function isPremium() { return ($this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday'])) > 0); } Adicione: public function isVip() { return ceil(($this->data['viptime'] - time()) / (24*60*60)) > 0; } characters.php Substitua: if($config['site']['show_vip_status']) { $id = $player->getCustomField("id"); 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 WIDTH=10%>Vip Status:</TD>'; $vip = $SQL->query('SELECT * FROM player_storage WHERE player_id = '.$id.' AND `key` = '.$config['site']['show_vip_storage'].';')->fetch(); if($vip == false) { $main_content .= '<TD><span class="red"><B>NOT VIP</B></TD></TR>'; } else { $main_content .= '<TD><span class="green"><B>VIP</B></TD></TR>'; } $comment = $player->getComment(); $newlines = array("\r\n", "\n", "\r"); $comment_with_lines = str_replace($newlines, '<br />', $comment, $count); if($count < 50) $comment = $comment_with_lines; if(!empty($comment)) { 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 VALIGN=top>Comment:</TD><TD>'.$comment.'</TD></TR>'; } } Por: if($config['site']['show_vip_status']) { $id = $player->getCustomField("id"); 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 WIDTH=10%>Account Vip Status:</TD>'; if(!$account->isVip()) { $main_content .= '<TD><span class="red"><B>NOT VIP</B></TD></TR>'; } else { $main_content .= '<TD><span class="green"><B>VIP</B></TD></TR>'; } $comment = $player->getComment(); $newlines = array("\r\n", "\n", "\r"); $comment_with_lines = str_replace($newlines, '<br />', $comment, $count); if($count < 50) $comment = $comment_with_lines; if(!empty($comment)) { 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 VALIGN=top>Comment:</TD><TD>'.$comment.'</TD></TR>'; } } shopsystem.php (+Créditos ao GM Bekman) Substitua: if($buy_offer['type'] == 'pacc') { $player_premdays = $buy_player_account->getCustomField('premdays'); $player_lastlogin = $buy_player_account->getCustomField('lastday'); $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_pacc').' (id, to_name, to_account, from_nick, from_account, price, pacc_days, trans_state, trans_start, trans_real) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['days']).', \'realized\', '.$SQL->quote(time()).', '.$SQL->quote(time()).');'; $SQL->query($save_transaction); $buy_player_account->setCustomField('premdays', $player_premdays+$buy_offer['days']); $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']); $user_premium_points = $user_premium_points - $buy_offer['points']; if($player_premdays == 0) { $buy_player_account->setCustomField('lastday', time()); } $main_content .= '<h2>PACC added!</h2><b>'.$buy_offer['days'].' days</b> of Premium Account added to account of player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br /><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a>'; } Por: if($buy_offer['type'] == 'pacc') { $player_viptime = $buy_player_account->getCustomField('viptime'); $player_lastlogin = $buy_player_account->getCustomField('lastday'); $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_pacc').' (id, to_name, to_account, from_nick, from_account, price, pacc_days, trans_state, trans_start, trans_real) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['days']).', \'realized\', '.$SQL->quote(time()).', '.$SQL->quote(time()).');'; $SQL->query($save_transaction); if($player_viptime > 0) $buy_player_account->setCustomField('viptime', $player_viptime + ($buy_offer['days'] * 24 * 60 * 60)); else $buy_player_account->setCustomField('viptime', time() + ($buy_offer['days'] * 24 * 60 * 60)); $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']); $user_premium_points = $user_premium_points - $buy_offer['points']; if($player_viptime == 0) { $buy_player_account->setCustomField('lastday', time()); } $main_content .= '<h2>VIP Days added!</h2><b>'.$buy_offer['days'].' days</b> of Vip Account added to account of player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br /><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a>'; } Links Úteis 01- [Gesior Acc] Vendedo Vip Pelo Pacc Créditos: GM Bekman 02- Double Exp Para Vip Créditos: Vodkart 03- Outfits Só Para Jogadores Vips Créditos: Vodkart2 pontos
-
PokeBall System! Ola Xtibianos, Vim hoje postar um Famoso Script de Pokeball System feito pelo Genioso Nahruto, claro pedi a autorização dele para postar. A Todos que forem pegar Scripts de outras Pessoas, lembre-se de sempre pedir autorização e claro colocar os creditos. Para Tfs: 0.34 , 0.35 e 0.36 Essas Forao Testadas E Funfo. Versoes: 8.42 - 8.50 - 8.52 - 8.54 - 8.6. Ots Testados: Snowz Yurots - Alissow Server - Styller Yurots Primeiramente Vamos Fuçar em Function.lua, se voce nao Sabe onde fica vá em: Data>Lib>Function.lua Abra e Coloque Isto: _warpzone = 2147483648 -- start storing strings here (THIS IS THE ABSOLUTE MAXIMUM VALUE FOR THIS) _maxlength = 1024 -- multiply by 3 to get the true length. setPlayerStorageInteger = setPlayerStorageValue getPlayerStorageInteger = getPlayerStorageValue function setPlayerStorageString(cid, key, value) if #value > (_maxlength-1) * 3 - 1 then -- Last word is reserved for 0 termination of the string. error("Storage string is too long") end if key > _warpzone / _maxlength then error("Storage string key is too large (" .. key .. ")") end key = _warpzone + key * _maxlength local word = 0 local wordwrap = 0 local wordcount = 0 local i = 1 while i <= #value do local byte = string.byte(string.sub(value, i, i)) word = bit.bor(word, bit.lshift(byte, wordwrap)) wordwrap = wordwrap + 8 if wordwrap == 24 then --[[ In the ideal world we would be able to store 4 characters per word, however, as the default return value for getPlayerStorageValue is -1, we cant use the last bit. ]]-- setPlayerStorageInteger(cid, key + wordcount, word) word = 0 wordwrap = 0 wordcount = wordcount + 1 end i = i + 1 end -- store the last word setPlayerStorageInteger(cid, key + wordcount, word) end function getPlayerStorageString(cid, key) if key > _warpzone / _maxlength then error("Storage string key is too large (" .. key .. ")") end key = _warpzone + key * _maxlength local wordcount = 0 local str = "" while true do if wordcount >= _maxlength then break end local word = getPlayerStorageInteger(cid, key + wordcount) if word == -1 then -- end of string break else -- Extract the 3 characters from the value byte = bit.band(word, 255) if byte == 0 then break else str = str .. string.char(byte) end byte = bit.rshift(bit.band(word, 65280), 8) if byte == 0 then break else str = str .. string.char(byte) end byte = bit.rshift(bit.band(word, 16711680), 16) if byte == 0 then break else str = str .. string.char(byte) end end wordcount = wordcount + 1 end return str end E Isso! function doConvinceSummon(cid, creature, amount, pos) summonplayerpos = {x=pos.x, y=pos.y, z=pos.z, stackpos=253} summonplayer = getThingfromPos(summonplayerpos) if(summonplayer ~= nil and summonplayer.itemid > 0) then doPlayerSendCancel(cid,"There is not enough room to summon here.") ret = 0 else convince = doSummonCreature(creature, pos) doConvinceCreature(cid, convince) ret = 1 end return ret end Agora Vamos Fazer o Script Vá em Pasta do Seu Ot > Data > Actions > Scripts Crie uma Pasta chamada pokeball.lua e bote isso dentro local notAllowed = {"Ferumbras", "Demon"} local storage = { status = 25650, pokeName = 25651 } local actionid_used = 7510 function onUse(cid, item, fromPos, item2, toPos) local pokeballStatus = getPlayerStorageValue(cid, storage.status) local pokeName = getPlayerStorageString(cid, storage.pokeName) pos = getPlayerPosition(cid) pos.stackpos = 0 if pokeballStatus == -1 then toPos.stackpos = 253 local pokeThing = getThingfromPos(toPos) if isCreature(pokeThing.uid) == TRUE then if isPlayer(pokeThing.uid) == FALSE then local pokename_ = getCreatureName(pokeThing.uid) if item.actionid ~= actionid_used then -- local maxHealth = 400 -- local creatureHealth = getCreatureHealth(pokeThing.uid) -- local divNum = (string.len(maxHealth)-1)^2 -- local result = math.floor((creatureHealth/divNum)/10) -- local chance = math.random(1, math.random(4, math.random(7, math.max(result, 7)))) -- if chance == result then if isInTable(notAllowed, pokename_) == TRUE then doPlayerSendCancel(cid, "You cannot catch this creature") else setPlayerStorageString(cid, storage.pokeName, pokename_) doRemoveCreature(pokeThing.uid) doSendDistanceShoot(fromPos, toPos, 37) setPlayerStorageValue(cid, storage.status, 1) doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".") doSetItemActionId(item.uid, actionid_used) end -- else -- doSendMagicEffect(fromPos, 2) -- doPlayerSendCancel(cid, "The Pokemom Escaped") -- end elseif item.actionid == actionid_used and pokename_ == pokeName then doPlayerSay(cid, pokeName .. " Back!!", TALKTYPE_SAY) doRemoveCreature(pokeThing.uid) doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".") setPlayerStorageValue(cid, storage.status, 1) doSendDistanceShoot(fromPos, toPos, 37) else doSendMagicEffect(fromPos, 2) doPlayerSendCancel(cid, "This pokeball is already used") end else doPlayerSendCancel(cid, "You cannot catch this creature") end else doPlayerSendCancel(cid, "Creature not found") end elseif pokeballStatus == 1 then summons = getCreatureSummons(cid) -- if #summons >= 2 then -- doPlayerSendCancel(cid, "You cannot call more pokemons") -- else doConvinceSummon(cid, pokeName, 0, toPos) doSendDistanceShoot(fromPos, toPos, 37) doPlayerSay(cid, pokeName .. " Go!!", TALKTYPE_SAY) setPlayerStorageValue(cid, storage.status, -1) doSetItemSpecialDescription(item.uid, "it is empty.") -- end end else return 1 end function isInTable(t, val) for _, v in pairs(t) do if v == val then return TRUE end end return LUA_ERROR end para TFS local notAllowed = {"Ferumbras", "Demon"} local storage = { status = 15244, pokeName = 15212 } local actionid_used = 7510 function onUse(cid, item, fromPos, item2, toPos) local pokeballStatus = getPlayerStorageValue(cid, storage.status) local pokeName = getPlayerStorageString(cid, storage.pokeName) pos = getPlayerPosition(cid) pos.stackpos = 0 if pokeballStatus <= 0 then toPos.stackpos = 253 local pokeThing = getThingfromPos(toPos) if isCreature(pokeThing.uid) == TRUE then if isPlayer(pokeThing.uid) == FALSE then local pokename_ = getCreatureName(pokeThing.uid) if item.actionid ~= actionid_used then -- local maxHealth = 400 -- local creatureHealth = getCreatureHealth(pokeThing.uid) -- local divNum = (string.len(maxHealth)-1)^2 -- local result = math.floor((creatureHealth/divNum)/10) -- local chance = math.random(1, math.random(4, math.random(7, math.max(result, 7)))) -- if chance == result then if isInTable(notAllowed, pokename_) == TRUE then doPlayerSendCancel(cid, "You cannot catch this creature") else setPlayerStorageString(cid, storage.pokeName, pokename_) doRemoveCreature(pokeThing.uid) doSendDistanceShoot(fromPos, toPos, 37) setPlayerStorageValue(cid, storage.status, 1) doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".") doSetItemActionId(item.uid, actionid_used) end -- else -- doSendMagicEffect(fromPos, 2) -- doPlayerSendCancel(cid, "The Pokemom Escaped") -- end elseif item.actionid == actionid_used and pokename_ == pokeName then doCreatureSay(cid, pokeName .. " Back!!", TALKTYPE_SAY) doRemoveCreature(pokeThing.uid) doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".") setPlayerStorageValue(cid, storage.status, 1) doSendDistanceShoot(fromPos, toPos, 37) else doSendMagicEffect(fromPos, 2) doPlayerSendCancel(cid, "This pokeball is already used") end else doPlayerSendCancel(cid, "You cannot catch this creature") end else doPlayerSendCancel(cid, "Creature not found") end elseif pokeballStatus == 1 then -- summons = doCreatureSummons(cid) -- if #summons >= 2 then -- doPlayerSendCancel(cid, "You cannot call more pokemons") -- else doConvinceSummon(cid, pokeName, 0, toPos) doSendDistanceShoot(fromPos, toPos, 37) doCreatureSay(cid, pokeName .. " Go!!", TALKTYPE_SAY) setPlayerStorageValue(cid, storage.status, 0) doSetItemSpecialDescription(item.uid, "it is empty.") -- end end return 1 end function isInTable(t, val) for _, v in pairs(t) do if v == val then return TRUE end end return LUA_ERROR end Agora Vamos Adicionar as Tags, vá em Data>Actions.xml e Adicione as Tags Corretas´ <action itemid="xxxx" script="pokeball.lua" allowfaruse="1" blockwalls="1" /> [font-"Georgia"]em <action itemid="xxxx" nos 4 X voce coloca o Number Id Do seu Item que Será como uma "Pokeball"[/font] Oque o Script Faz Realmente: - Guarda monstros dentro de objetos e salva seu status, você pode colocar pra salvar em qlqr objeto.. seria ótimo para projetos pokemons.. Creditos: Nahruto Print Screen's: Snorlax Saindo da Pokeball: Snorlax Voltando para a Pokeball Look da Pokeball ( o Player so Ve assim You See a Pokeball , Have Snorlax )] Lembrando que eu nao Adicionei o Efeito da Pokeball Abrindo e Jogando o Monstro. Para fazer este Tipo de efeito voce vai ter que saber direitinho o LookType da Pokeball Fechando e Saindo, e transformar para um efeito e depois modificar no Script, aqui no xtibia Existe varios Tutoriais explicando isto, é so procurar! Gostou? Clica no Ali em Baicho para me Ajudar! Abraços..1 ponto
-
iurygoncalves, Como isso é uma função usada em creaturescripts, Você certificou-se de registrar esse evento no arquivo login.lua* e em creaturescripts.xml? E retire aquele else * - '/creaturescripts/scripts' registerCreatureEvent(cid, "Mesmo nome dado em creaturescripts.xml") Cya1 ponto
-
Olá galera, eu gostaria de saber como faço pra retirar o novo fundo do tibia (ou melhor se vocês já tem retirado) e colocar no meu website (que tem o antigo fundo) Me ajudem porfavor!1 ponto
-
[Moveevent] Wandering Boots
Fir3element reagiu a caarolina12 por um tópico no fórum
Nome: Wandering Boots Versão testada: 0.3.6pl1 Explicação: Bota que adiciona o addon da mochila do citizen. Créditos: jestemPolakiem data/movements/movements.xml <movevent itemid="7457" slot="feet" override="yes" type="Equip" event="buffer" value="return doPlayerAddOutfit(cid, 136, 1) and doPlayerAddOutfit(cid, 128, 1) and doPlayerSendOutfitWindow(cid)"/> <movevent itemid="7457" slot="feet" override="yes" type="DeEquip" event="buffer" value="return doPlayerRemOutfit(cid, 136, 1) and doPlayerRemOutfit(cid, 128, 1) and doPlayerSendOutfitWindow(cid)"/> data/items/items.xml <item id="7457" override="yes" article="a" name="wandering boots"> <attribute key="description" value="Wandering shoes you add a new addition to the outfit as well as the speed."/> <attribute key="speed" value="40"/> <attribute key="weight" value="800"/> <attribute key="armor" value="2"/> <attribute key="slotType" value="feet"/> </item> Preview Enjoy =)1 ponto -
Peça Um Tutorial
Benjamin789 reagiu a Oneshot por um tópico no fórum
Pedido 1 Atendido! Clique no link para ver-lo. Bibliotecas1 ponto -
[Encerrado] Ajudinha :d
caio1523 reagiu a PedrinhuHenrique por um tópico no fórum
Só avisando que com internet wireless não tem como ligar um servidor "padrão", só usando o hamachi. Tutoriais do Hamachi podem ser encontrados aqui no XTibia. Se você queira mesmo ligar um ot com hamachi (quase ninguem entra) e não conseguir com tutoriais daqui, poste no tópico para que eu tente ensinar. (nunca usei hamachi)1 ponto -
Duvida Com Action De Alavanca
MarcelloMendes reagiu a Kydrai por uma questão
O erro é que vc n ta usando variáveis locais. Ai vc acaba mudando o valor das variáveis nos 2 scripts. O certo seria: local pedrapos = {x=2204, y=39, z=7} --[[Posição inicial do bloqueio]] . . . De qualquer forma ja respondi pelo msn1 ponto -
[Encerrado] Item Editor
crusheralpha reagiu a Ardemax por um tópico no fórum
Há sim. Esse programa é criado por SimOne. Muito gente procura esse programa e é muito útil. ah, Para usar basta extrair na pasta do servidor, coloque o tibia.dat e o tibia.spr junto também. Download Scan Obrigado, espero tenho aproveite! ;]1 ponto