Ir para conteúdo

Anderson Sacani

Membro
  • Registro em

  • Última visita

Tudo que Anderson Sacani postou

  1. function onSay(player, words, param) if ((player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT)) or (player:isPzLocked())) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: you must be not with pzlock.") return false end local split = param:split(",") local balance = player:getBankBalance() if split[1] == nil then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: the commands are:\n !bank balance.\n !bank deposit, XXXX.\n!bank depositall.\n!bank transfer, amount, toPlayer.") return end --------------------------- Balance --------------------------- if split[1] == 'balance' then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Your account balance is " .. balance .. ".") --------------------------- Deposit --------------------------- elseif split[1] == 'deposit' then local amount = tonumber(split[2]) if not amount then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount of money to add.") return false end local amount = math.abs(amount) if amount > 0 and amount <= player:getMoney() then player:deposit(amount) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You added " .. amount .. " to your account, You can withdraw your money anytime you want to.\nYour account balance is " .. player:getBankBalance() .. ".") else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money to deposit.") end --------------------------- Depositall --------------------------- elseif split[1] == 'depositall' then local amount = player:getMoney() local amount = math.abs(amount) if amount > 0 and amount == player:getMoney() then player:deposit(amount) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You added " .. amount .. " to your account, You can withdraw your money anytime you want to.\nYour account balance is " .. player:getBankBalance() .. ".") else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money to deposit.") end --------------------------- Withdraw --------------------------- elseif split[1] == 'withdraw' then local amount = tonumber(split[2]) if not amount then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount of money to withdraw.") return false end local amount = math.abs(amount) if amount > 0 and amount <= player:getBankBalance() then player:withdraw(amount) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Here you are " .. amount .. " of your account, You can deposit your money anytime you want.\nYour account balance is " .. player:getBankBalance() .. ".") else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money on your bank account.") end --------------------------- Withdrawall --------------------------- elseif split[1] == 'withdrawall' then local amount = player:getBankBalance() local amount = math.abs(amount) if amount > 0 and amount <= player:getBankBalance() then player:withdraw(amount) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Here you are all your money on your account, You can deposit your money anytime you want.\nYour account balance is " .. player:getBankBalance() .. ".") else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money on your bank account.") end --------------------------- Transfer --------------------------- elseif split[1] == 'transfer' then local data = param local s = data:split(", ") if s[2] == nil then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount of money") return false else if not tonumber(s[2]) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount in numbers only.") return end end if s[3] == nill then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the player name") return false end local a = tonumber(s[2]) local amount = math.abs(a) local getPlayer = Player(s[3]) if getPlayer then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You seccesfully transferred " .. s[2] .. "\n to " .. s[3] .. " bank account.") player:transferMoneyTo(s[3], amount) getPlayer:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("[BankSystem]: player %s transferred %sgps yo your bank account. Your account balance is now: %d." , player:getName(), s[2], getPlayer:getBankBalance())) else if not playerExists(s[3]) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: A player with name: " .. s[3] .. " does not exists.") return false end if playerExists(s[3]) and player:transferMoneyTo(s[3], amount) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You seccesfully transferred " .. s[2] .. "\n to " .. s[3] .. " bank account.") end end else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Invalid param.") end return false end
  2. O ID 3061 não é para ter decay, e sim, tem como mover ele.
  3. Infelizmente não poderei ajudar, porque não respondeu a minha pergunta. Eu ainda não sei o que esse reset faz.
  4. Recomendo remover do mapa, pois não existe uma função que cria um item abaixo de outro. Teria que implementar nas sources, mas é muito mais simples remover o corpo do mapa. Da maneira que te mostrei, o script criará um loop criando os itens exatamente na sequencia que colocar dentro da tabela.
  5. local items = { [1] = { id = 2487, price = 100000 }, [2] = { id = 2488, price = 110000 }, [3] = { id = 2514, price = 110000 }, } function onUse(cid, item, fromPosition, itemEx, toPosition) for i = 1, #items do if itemEx.itemid == items[i].id then doRemoveItem(itemEx.uid) doPlayerAddMoney(cid, items[i].price) else doPlayerSendTextMessage(cid, 25, "Impossivel vender isto.") end end return true end
  6. O corpo já está no mapa? Se não, basta fazer um script que crie primeiramente este item específico e logo em seguida crie o corpo, exatamante nesta ordem. local items = { [1] = { itemId = 2393, itemAmount = 1, itemPos = { x = 100, y = 100, z = 7 } }, -- Giant Sword [2] = { itemId = 3061, itemAmount = 1, itemPos = { x = 100, y = 100, z = 7 } }, -- Dead Human } for i = 1, #items do Game.createItem(items[i].itemId, items[i].itemAmount, items[i].itemPos) end
  7. function onSay(player, words, param) if ((player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT)) or (player:isPzLocked())) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: you must be not with pzlock.") return false end local split = param:split(",") local balance = player:getBankBalance() if split[1] == nil then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: the commands are:\n !bank balance.\n !bank deposit, XXXX.\n!bank depositall.\n!bank transfer, amount, toPlayer.") return end --------------------------- Balance --------------------------- if split[1] == 'balance' then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Your account balance is " .. balance .. ".") --------------------------- Deposit --------------------------- elseif split[1] == 'deposit' then local amount = tonumber(split[2]) if not amount then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount of money to add.") return false end local amount = math.abs(amount) if amount > 0 and amount <= player:getMoney() then player:deposit(amount) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You added " .. amount .. " to your account, You can withdraw your money anytime you want to.\nYour account balance is " .. player:getBankBalance() .. ".") else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money to deposit.") end --------------------------- Depositall --------------------------- elseif split[1] == 'depositall' then local amount = player:getMoney() local amount = math.abs(amount) if amount > 0 and amount == player:getMoney() then player:deposit(amount) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You added " .. amount .. " to your account, You can withdraw your money anytime you want to.\nYour account balance is " .. player:getBankBalance() .. ".") else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money to deposit.") end --------------------------- Withdraw --------------------------- elseif split[1] == 'withdraw' then local amount = tonumber(split[2]) if not amount then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount of money to withdraw.") return false end local amount = math.abs(amount) if amount > 0 and amount <= player:getBankBalance() then player:withdraw(amount) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Here you are " .. amount .. " of your account, You can deposit your money anytime you want.\nYour account balance is " .. player:getBankBalance() .. ".") else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money on your bank account.") end --------------------------- Withdrawall --------------------------- elseif split[1] == 'withdrawall' then local amount = player:getBankBalance() local amount = math.abs(amount) if amount > 0 and amount <= player:getBankBalance() then player:withdraw(amount) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Here you are all your money on your account, You can deposit your money anytime you want.\nYour account balance is " .. player:getBankBalance() .. ".") else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money on your bank account.") end --------------------------- Transfer --------------------------- elseif split[1] == 'transfer' then local data = param local s = data:split(", ") if s[2] == nil then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount of money") return false else if not tonumber(s[2]) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount in numbers only.") return end end if s[3] == nill then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the player name") return false end local a = tonumber(s[2]) local amount = math.abs(a) local getPlayer = Player(s[3]) if getPlayer then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You seccesfully transferred " .. s[2] .. "\n to " .. s[3] .. " bank account.") player:transferMoneyTo(s[3], amount) getPlayer:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("[BankSystem]: player %s transferred %sgps yo your bank account.", player:getName(), s[2])) addEvent(function() if getPlayer:isPlayer() then getPlayer:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("[BankSystem]: Your account balance is now: %d.", getPlayer:getBankBalance())) end end, 1500) else if not playerExists(s[3]) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: A player with name: " .. s[3] .. " does not exists.") return false end if playerExists(s[3]) and player:transferMoneyTo(s[3], amount) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You seccesfully transferred " .. s[2] .. "\n to " .. s[3] .. " bank account.") end end else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Invalid param.") end return false end
  8. O que é um script de reset? Se puder me explicar o que faz, eu consigo fazer.
  9. O que acontece é o seguinte: Agora que tu mudou o all_ready para maior que 0, ele vai fazer um loop e alterar o valor da storage para todos os players da tabela nomeada player, mesmo que não tenha todos os players, por tanto acontece este erro. Para arrumar isso, basta adicionar uma verificação de isPlayer dentro do loop, como isto: -- CONFIG -- local playersOnly = "no" local questLevel = 1 local STORAGE_BOSS_CD = 17457 local cdtime = 1 * 1 * 1 -- exhaust in seconds local room = { -- boss room fromX = 1802, fromY = 675, fromZ = 7, -------------- toX = 1868, toY = 724, toZ = 7 } local monster_pos = { [1] = { pos = { 1837, 716, 7 }, monster = "Cursed Prospector Soul" } } local players_pos = { { x = 1834, y = 702, z = 6, stackpos = 253 }, { x = 1834, y = 701, z = 6, stackpos = 253 }, { x = 1835, y = 701, z = 6, stackpos = 253 }, { x = 1836, y = 701, z = 6, stackpos = 253 }, { x = 1837, y = 701, z = 6, stackpos = 253 }, { x = 1838, y = 701, z = 6, stackpos = 253 }, { x = 1837, y = 702, z = 6, stackpos = 253 }, { x = 1836, y = 702, z = 6, stackpos = 253 }, { x = 1835, y = 702, z = 6, stackpos = 253 }, { x = 1838, y = 702, z = 6, stackpos = 253 } } local new_player_pos = { { x = 1830, y = 715, z = 7 }, { x = 1842, y = 715, z = 7 }, { x = 1836, y = 720, z = 7 }, { x = 1836, y = 710, z = 7 }, { x = 1836, y = 715, z = 7 }, { x = 1836, y = 715, z = 7 }, { x = 1835, y = 713, z = 7 }, { x = 1833, y = 721, z = 7 }, { x = 1838, y = 718, z = 7 }, { x = 1837, y = 718, z = 7 } } -- CONFIG END -- function onUse(cid, item, fromPosition, itemEx, toPosition) local all_ready, monsters, player, level = 0, 0, {}, 0 if item.itemid == 9826 then for i = 1, #players_pos do table.insert(player, 0) end for i = 1, #players_pos do player[i] = getThingfromPos(players_pos[i]) if player[i].itemid > 0 then if string.lower(playersOnly) == "yes" then if isPlayer(player[i].uid) == true then all_ready = all_ready + 1 else monsters = monsters + 1 end else all_ready = all_ready + 1 end end end if all_ready > 0 then for i = 1, #players_pos do player[i] = getThingfromPos(players_pos[i]) if isPlayer(player[i].uid) == true then if getPlayerStorageValue(player[i].uid, STORAGE_BOSS_CD) > os.time() then doPlayerSendCancel(cid, "Acesso so liberado a cada 20h.") return false end if getPlayerLevel(player[i].uid) >= questLevel then level = level + 1 end else level = level + 1 end end if level == #players_pos then if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then for _, area in pairs(monster_pos) do doSummonCreature(area.monster, { x = area.pos[1], y = area.pos[2], z = area.pos[3] }) end for i = 1, #players_pos do if isPlayer(player[i].uid) then doSendMagicEffect(players_pos[i], CONST_ME_POFF) doTeleportThing(player[i].uid, new_player_pos[i]) doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA) setPlayerStorageValue(player[i].uid, STORAGE_BOSS_CD, os.time() + cdtime) end end doTransformItem(item.uid, 9825) else doPlayerSendTextMessage(cid, 19, "Only players can do this quest.") return false end else doPlayerSendTextMessage(cid, 19, "All Players have to be level " .. questLevel .. " to do this quest.") return false end else doPlayerSendCancel(cid, "You need " .. table.getn(players_pos) .. " players to do this quest.") return false end elseif item.itemid == 9825 then local player_room = 0 for x = room.fromX, room.toX do for y = room.fromY, room.toY do for z = room.fromZ, room.toZ do local pos = { x = x, y = y, z = z, stackpos = 253 } local thing = getThingfromPos(pos) if thing.itemid > 0 then if isPlayer(thing.uid) == true then player_room = player_room + 1 end end end end end if player_room >= 1 then doPlayerSendTextMessage(cid, 19, "There is already a team in the quest room.") return false elseif player_room == 0 then for x = room.fromX, room.toX do for y = room.fromY, room.toY do for z = room.fromZ, room.toZ do local pos = { x = x, y = y, z = z, stackpos = 253 } local thing = getThingfromPos(pos) if thing.itemid > 0 then doRemoveCreature(thing.uid) end end end end doTransformItem(item.uid, 9826) end end return true end

Informação Importante

Confirmação de Termo