Postado Setembro 24, 2016 8 anos Pessoal, esse é um script de um evento de sobrevivência, porém, essa parte dele(creaturescripts) da um erro geral nos players, quando eu boto ele pra funcionar os players do serv inteiro n morrem mais, n sei se é pq ta faltando a função nele, enfim, é mt complexo pra mim, se alguém puder ajudar... minha tfs é 1.0 Mostrar conteúdo oculto function onStatsChange(cid, attacker, type, combat, value) if type == STATSCHANGE_HEALTHLOSS then if isPlayer(cid) then if value >= getCreatureHealth(cid) then if getPlayerStorageValue(cid, OL_playerStorage) > 0 then if getGlobalStorageValue(OL_playerCount) > (OL_winnerscount) then doBroadcastMessage(getPlayerName(cid) .. " have been died!", MESSAGE_STATUS_CONSOLE_RED) local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) doCreatureAddHealth(cid,getCreatureMaxHealth(cid) - getCreatureHealth(cid)) doSetStorage(OL_playerCount, getGlobalStorageValue(OL_playerCount)-1) setPlayerStorageValue(cid, OL_playerStorage, 0) elseif getGlobalStorageValue(OL_playerCount) <= (OL_winnerscount) then if (OL_winnerscount) > 1 then doBroadcastMessage(getPlayerName(cid) .. " is one of " .. (OL_winnerscount) .. " winners of One Left event! Congratulations!", MESSAGE_STATUS_WARNING) doPlayerSendTextMessage(cid,22,"Congratulations! You are one of the winners of One Left Event.") else doBroadcastMessage(getPlayerName(cid) .. " is the winner of One Left event! Congratulations!", MESSAGE_STATUS_WARNING) doPlayerSendTextMessage(cid,22,"Congratulations! You are the winner of One Left Event.") end if OL_goblet[1] == true then local wgoblet = doPlayerAddItem(cid, OL_goblet[2]) doItemSetAttribute(wgoblet, "description", "Awarded to " .. getPlayerName(cid) .. " for winning the One Left event.") doItemSetAttribute(wgoblet, "text", "Awarded to " .. getPlayerName(cid) .. " for winning the One Left event.") end if OL_PPoints[1] == true then db.query("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. OL_PPoints[2] .. " WHERE `id` = ".. getPlayerAccountId(cid) ..";") end local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) doCreatureAddHealth(cid,getCreatureMaxHealth(cid) - getCreatureHealth(cid)) doSetStorage(OL_playerCount, getGlobalStorageValue(OL_playerCount)-1) setPlayerStorageValue(cid, OL_playerStorage, 0) for _,items in ipairs(OL_rewards) do doPlayerAddItem(cid, items, 1) end if OL_moneyReward[1] == true then doPlayerAddItem(cid, OL_moneyReward[2], OL_moneyReward[3]) end if getGlobalStorageValue(OL_playerCount) == 0 then for x = OL_fromPosition.x, OL_toPosition.x do for y = OL_fromPosition.y, OL_toPosition.y do for z = OL_fromPosition.z, OL_toPosition.z do areapos = {x = x, y = y, z = z, stackpos = 253} getMonsters = getThingfromPos(areapos) if isMonster(getMonsters.uid) then doRemoveCreature(getMonsters.uid) end end end end end end return false end return false end end end return true end
Postado Setembro 26, 2016 8 anos local item = { id = 3058, count = 1 } local G = { set = function(s, v) Game.setStorage(s, v) end, get = function(s) return Game.getStorage(s) end } broadcast = Game.broadcastMessage function deathMessage(name, attacker) return "You recognize " .. name .. ". He was killed by ".. (attacker:isCreature() and "a "..attacker:getName():lower() or "a field item") end function setTextOfItem(item, attr, str) if not item:isItem() then return end if type(attr) == 'table' then for attribute, text in pairs(attr) do item:setAttribute(attribute, text) end else item:setAttribute(attribute, str) end end function onStatsChange(cid, attacker, type, combat, value) if type == STATSCHANGE_HEALTHLOSS then local player = Player(cid) if player then local p = {} p.health = player:getHealth() p.name = player:getName() p.get = function(s) return player:getStorage(s) end p.set = function(s, v) return player:setStorage(s, v) end p.pos = player:getPosition() p.temple = Town(player:getTown():getId()):getTemplePosition() if p.health <= value then if p.get(OL_playerStorage) > 0 then if G.get(OL_playerCount) > OL_winnerscount then broadcast(p.name .. " have been died!", MESSAGE_STATUS_CONSOLE_RED) local corpse = doCreateItem(item.id, item.count, p.pos) setTextOfItem(corpse, ITEM_ATTRIBUTE_DESCRIPTION, deathMessage(p.name, attacker)) p.pos:sendMagicEffect(CONST_ME_POFF) player:teleportTo(p.temple, false) p.temple:sendMagicEffect(CONST_ME_TELEPORT) player:addHealth(-player:getMaxHealth()) G.set(OL_playerCount, G.get(OL_playerCount) - 1) p.set(OL_playerStorage, 0) elseif G.get(OL_playerCount) <= OL_winnerscount then if OL_winnerscount > 1 then broadcast(p.name .. " is one of " .. OL_winnerscount .. " winners of One Left event! Congratulations!", MESSAGE_STATUS_WARNING) player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You are one of the winners of One Left Event.") else broadcast(p.name " is the winner of One Left event! Congratulations!", MESSAGE_STATUS_WARNING) player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You are the winner of One Left Event.") end if OL_goblet[1] then local wgoblet = player:addItem(OL_goblet[2], 1) setTextOfItem(wgoblet, { [ITEM_ATTRIBUTE_DESCRIPTION] = "Awarded to " .. p.name .. " for winning the One Left event.", [ITEM_ATTRIBUTE_TEXT] = "Awarded to " .. p.name .. " for winning the One Left event." } ) end if OL_PPoints[1] then local accountId = getAccountNumberByPlayerName(p.name) db.storeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. OL_PPoints[2] .. " WHERE `account_id` = " .. accountId) end for _, reward in ipairs(OL_rewards) do player:addItem(reward, 1) end if OL_moneyReward[1] then player:addItem(OL_moneyReward[2], OL_moneyReward[3]) end if G.set(OL_playerCount) == 0 then for x = OL_fromPosition.x, OL_toPosition.x do for y = OL_fromPosition.y, OL_toPosition.y do for z = OL_fromPosition.z, OL_toPosition.z do areapos = {x = x, y = y, z = z, stackpos = 253} getMonsters = getThingfromPos(areapos) if isMonster(getMonsters.uid) then doRemoveCreature(getMonsters.uid) end end end end end end end end end end return true end Editado Setembro 26, 2016 8 anos por Codex NG Changed syntax style (veja o histórico de edições)
Postado Setembro 26, 2016 8 anos Autor @Codex NG vlw man, vou testar quando chegar em casa. Obs se vc tiver o evento oneleft inteiro funcionando cria um tiro pra ele, acho q a galera iria gostar @Codex NG vlw man, vou testar quando chegar em casa. Obs se vc tiver o evento oneleft inteiro funcionando cria um tiro pra ele, acho q a galera iria gostar. Se puder, posta sua tag do creaturescripts tb aqui pra mim
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.