G0han 0 Postado Julho 7, 2009 Share Postado Julho 7, 2009 Tipo do script: addItem Protocolo (versão do Tibia): 8.4 Servidor utilizado: TFS 0.3.1.1231 Nível de experiência: 20x Adicionais/Informações: È o seguinte eu queria uma script, se possivel introduzida no playerdeath.lua que quando um tal player matasse o outro, o player que matasse, ganhasse um item ou dinheiro e só, eu ja tentei doPlayerAddItem(cid,param,1) usando todas as variaveis do playerdeath.lua, mas nao consegui. Vou mandar aqui meu playerdeath.lua: local config = {deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')), sqlType = getConfigInfo('sqlType'), maxDeathRecords = getConfigInfo('maxDeathRecords') } function onDeath(cid, corpse, lastHitKiller, mostDamageKiller) if(config.deathListEnabled == TRUE) then local hitKillerName = "field item" local damageKillerName = "" if(lastHitKiller ~= FALSE) then if(isPlayer(lastHitKiller) == TRUE) then hitKillerName = getPlayerGUID(lastHitKiller) else hitKillerName = getCreatureName(lastHitKiller) end if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then if(isPlayer(mostDamageKiller) == TRUE) then damageKillerName = getPlayerGUID(mostDamageKiller) else damageKillerName = getCreatureName(mostDamageKiller) end end end db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");") local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";") if(rows:getID() ~= -1) then local amount = (rows:numRows(true) - config.maxDeathRecords) if(amount > 0) then if(config.sqlType == "sqlite") then for i = 1, amount do db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);") end else db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";") end end end end end function onDeath(cid, corpse, killer) local player = getCreatureName(cid) local killername = getCreatureName(killer) local level = getPlayerLevel(cid) local levelkiller = getPlayerLevel(killer) if getPlayerLevel(cid) >= 0 then broadcastMessage(""..player.." ["..level.."] acabou de ser morto(a) por "..killername.." ["..levelkiller.."].",19) else return TRUE end end Obrigado Link para o comentário https://xtibia.com/forum/topic/115741-pedidorecompensa-quando-mata-player/ Compartilhar em outros sites More sharing options...
Kydrai 146 Postado Julho 7, 2009 Share Postado Julho 7, 2009 Vc usou a function onDeath 2 vezes, mas pelo que vc falou isso deve estar funcionando. Se vc fosse usar o doPlayerAddItem seria assim: doPlayerAddItem(cid, itemid, count, canDropOnMap) Pode por isso dps do: broadcastMessage(""..player.." ["..level.."] acabou de ser morto(a) por "..killername.." ["..levelkiller.."].",19) Fica assim: broadcastMessage(""..player.." ["..level.."] acabou de ser morto(a) por "..killername.." ["..levelkiller.."].",19) doPlayerAddItem(killer, 2160, 10, TRUE) Acho que isso deve dar, se tiver com erro avisa qual o erro que da. Link para o comentário https://xtibia.com/forum/topic/115741-pedidorecompensa-quando-mata-player/#findComment-758266 Compartilhar em outros sites More sharing options...
G0han 0 Postado Julho 7, 2009 Autor Share Postado Julho 7, 2009 Nossa cara, muito obrigado mesmo, voce salvou meu otserver Agora olha, se nao for pedir muito, tem como dar um determinado valor de gps entre 100 gps e 1000 gps? Valeu Link para o comentário https://xtibia.com/forum/topic/115741-pedidorecompensa-quando-mata-player/#findComment-758597 Compartilhar em outros sites More sharing options...
gabrielf10 6 Postado Julho 8, 2009 Share Postado Julho 8, 2009 GOOhan, nao entendo muito de scripts mas pelo que dei uma olhada no script do kydrai, (o ultimo bb code) onde está o 2160 é o id de crystal e onde está o 10 é a quantidade. (não sou scripter, é só uma suposição). Link para o comentário https://xtibia.com/forum/topic/115741-pedidorecompensa-quando-mata-player/#findComment-759340 Compartilhar em outros sites More sharing options...
cagaio 0 Postado Julho 30, 2009 Share Postado Julho 30, 2009 (editado) pow keria bota isso tbm no meu serve como eu fasso posta ele pronto ae plx :S FICARIA TIPO ASSIM ? local config = {deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')), sqlType = getConfigInfo('sqlType'), maxDeathRecords = getConfigInfo('maxDeathRecords') } function onDeath(cid, corpse, lastHitKiller, mostDamageKiller) if(config.deathListEnabled == TRUE) then local hitKillerName = "field item" local damageKillerName = "" if(lastHitKiller ~= FALSE) then if(isPlayer(lastHitKiller) == TRUE) then hitKillerName = getPlayerGUID(lastHitKiller) else hitKillerName = getCreatureName(lastHitKiller) end if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then if(isPlayer(mostDamageKiller) == TRUE) then damageKillerName = getPlayerGUID(mostDamageKiller) else damageKillerName = getCreatureName(mostDamageKiller) end end end db.executeQuery(" INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");") local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";") if(rows:getID() ~= -1) then local amount = (rows:numRows(true) - config.maxDeathRecords) if(amount > 0) then if(config.sqlType == "sqlite") then for i = 1, amount do db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);") end else db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";") end end end end end function onDeath(cid, corpse, killer) local player = getCreatureName(cid) local killername = getCreatureName(killer) local level = getPlayerLevel(cid) local levelkiller = getPlayerLevel(killer) if getPlayerLevel(cid) >= 0 then broadcastMessage(""..player.." ["..level.."] acabou de ser morto(a) por "..killername.." ["..levelkiller.."].",19) doPlayerAddItem(killer,2160,10,TRUE) else return TRUE end end ??? ::::S Editado Julho 30, 2009 por cagaio Link para o comentário https://xtibia.com/forum/topic/115741-pedidorecompensa-quando-mata-player/#findComment-770206 Compartilhar em outros sites More sharing options...
jacknight 0 Postado Julho 30, 2009 Share Postado Julho 30, 2009 @cagaio esse q vc postou ja pronto pra ser usado ? preciza ter mais algum arkivo p isso aee roda ? Link para o comentário https://xtibia.com/forum/topic/115741-pedidorecompensa-quando-mata-player/#findComment-770469 Compartilhar em outros sites More sharing options...
cagaio 0 Postado Julho 30, 2009 Share Postado Julho 30, 2009 Axo q Naaao :S Tbm kero saber se preciza de mais algo ou é so isso ae q eu postei Link para o comentário https://xtibia.com/forum/topic/115741-pedidorecompensa-quando-mata-player/#findComment-770490 Compartilhar em outros sites More sharing options...
marcaodailha 0 Postado Agosto 1, 2009 Share Postado Agosto 1, 2009 (editado) Está faltando a tag no creaturescripts.xml <event type="death" name="PlayerDeath" event="script" value="owned.lua"/> Agora salva o script ai em cima como owned Se quiser outro nome para o script muda onde está em negrito no quote. Confere ai pessoal não sei se é isso mesmo! Grande abraço! Editado Agosto 1, 2009 por Cotar Link para o comentário https://xtibia.com/forum/topic/115741-pedidorecompensa-quando-mata-player/#findComment-771515 Compartilhar em outros sites More sharing options...
cagaio 0 Postado Agosto 2, 2009 Share Postado Agosto 2, 2009 Aff nao entendii :S Eu tenhoo q Cria um Arquivo Chamado owned.lua ? Link para o comentário https://xtibia.com/forum/topic/115741-pedidorecompensa-quando-mata-player/#findComment-771748 Compartilhar em outros sites More sharing options...
marcaodailha 0 Postado Agosto 2, 2009 Share Postado Agosto 2, 2009 Aff nao entendii :S Eu tenhoo q Cria um Arquivo Chamado owned.lua ? Arquivo não véio, uma tag(linha de comando) dentro do teu arquivo creaturescripts.xml que se encontra na pasta creaturescripts. Depois você copia, cola e renomeia para onwed um arquivo qualquer dentro da pasta scripts, apaga o script que está lá e cola o teu script. Grande abraço! Link para o comentário https://xtibia.com/forum/topic/115741-pedidorecompensa-quando-mata-player/#findComment-771753 Compartilhar em outros sites More sharing options...
cagaio 0 Postado Agosto 2, 2009 Share Postado Agosto 2, 2009 intao mais aii ta o problema eu nao tenho a scripiti essa q o cara posto ai em cima ta certa ? Tem como faze um tuto enssinano naao ? :'S Link para o comentário https://xtibia.com/forum/topic/115741-pedidorecompensa-quando-mata-player/#findComment-771906 Compartilhar em outros sites More sharing options...
Wiltry 7 Postado Agosto 6, 2009 Share Postado Agosto 6, 2009 Dúvida do GOOHAN sanada, então tópico fechado. Para as outras duvidas aqui, olhem: local config = {deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')), sqlType = getConfigInfo('sqlType'), maxDeathRecords = getConfigInfo('maxDeathRecords') } function onDeath(cid, corpse, lastHitKiller, mostDamageKiller) if(config.deathListEnabled == TRUE) then local hitKillerName = "field item" local damageKillerName = "" if(lastHitKiller ~= FALSE) then if(isPlayer(lastHitKiller) == TRUE) then hitKillerName = getPlayerGUID(lastHitKiller) else hitKillerName = getCreatureName(lastHitKiller) end if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then if(isPlayer(mostDamageKiller) == TRUE) then damageKillerName = getPlayerGUID(mostDamageKiller) else damageKillerName = getCreatureName(mostDamageKiller) end end end db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");") local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";") if(rows:getID() ~= -1) then local amount = (rows:numRows(true) - config.maxDeathRecords) if(amount > 0) then if(config.sqlType == "sqlite") then for i = 1, amount do db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);") end else db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";") end end end end end function onDeath(cid, corpse, killer) local player = getCreatureName(cid) local killername = getCreatureName(killer) local level = getPlayerLevel(cid) local levelkiller = getPlayerLevel(killer) if getPlayerLevel(cid) >= 0 then broadcastMessage(""..player.." ["..level.."] acabou de ser morto(a) por "..killername.." ["..levelkiller.."].",19) doPlayerAddItem(killer, 2160, 10, TRUE) else return TRUE end end Coloque isso sobre o seu script playerdeath.lua em creaturescripts. Apenas isso creio eu. Abraços. Link para o comentário https://xtibia.com/forum/topic/115741-pedidorecompensa-quando-mata-player/#findComment-774264 Compartilhar em outros sites More sharing options...
Posts Recomendados