Postado Março 9, 2019 6 anos Optimizando a script: local config = { items = {{2160,20},{2148,2}}, -- ID DO ITEM, QUANTIDADE level = 1 -- Quanto irá adicionar de level } function onDeath(cid, corpse, deathList) if not isPlayer(cid) then return true end local killer = deathList[1] if isPlayer(killer) then doPlayerAddExperience(killer, (getPlayerExperience(cid) + config.level)) for i = 1, #items do doPlayerAddItem(killer, config.items[i][1], config.items[i][2]) end return true end return true end function onLogin(cid) registerCreatureEvent(cid, "LootPlayerDeath") return true end
Postado Março 9, 2019 6 anos Autor 28 minutos atrás, Yan Liima disse: Creaturescripts. function onDeath(cid, corpse, deathList) if not isPlayer(cid) then return true end local killer = deathList[1] local items = {{2160,20},{2148,2}} -- ID DO ITEM, QUANTIDADE if isPlayer(killer) then doPlayerAddExperience(killer, (getPlayerExperience(cid) + 1)) -- Irá adicionar 1 de level. for i = 1, #items do doPlayerAddItem(killer, items[i][1], items[i][2]) end return true end return true end function onLogin(cid) registerCreatureEvent(cid, "LootPlayerDeath") return true end <event type="login" name="LootPlayerLogin" event="script" value="arquivo.lua"/> <event type="death" name="LootPlayerDeath" event="script" value="arquivo.lua"/> tem como colocar anti -mc e storage .tipo mata o mesmo player 2 vezes não ganha nada . 9 minutos atrás, Emooooo disse: Agora, Storm disse: Optimizando a script: local config = { items = {{2160,20},{2148,2}}, -- ID DO ITEM, QUANTIDADE level = 1 -- Quanto irá adicionar de level } function onDeath(cid, corpse, deathList) if not isPlayer(cid) then return true end local killer = deathList[1] if isPlayer(killer) then doPlayerAddExperience(killer, (getPlayerExperience(cid) + config.level)) for i = 1, #items do doPlayerAddItem(killer, config.items[i][1], config.items[i][2]) end return true end return true end function onLogin(cid) registerCreatureEvent(cid, "LootPlayerDeath") return true end tem como colocar anti -mc e storage .tipo mata o mesmo player 2 vezes não ganha nada .
Postado Março 10, 2019 6 anos Solução @Storm thanks! só faltou o #items que também é necessario alterar. @EmoooooPra que serveria o anti MC? bom, tenta ai: local config = { items = {{2160,20},{2148,2}}, -- ID DO ITEM, QUANTIDADE level = 1, -- Quanto irá adicionar de level storage = 673420 -- Storage } function onDeath(cid, corpse, deathList) if not isPlayer(cid) then return true end local killer = deathList[1] local ip = true if #config > 0 and isInArray(config,getPlayerIp(killer)) then ip = false end if ip and isPlayer(killer) and getPlayerStorageValue(killer, config.storage) <= 0 then doPlayerAddExperience(killer, (getPlayerExperience(cid) + config.level)) for i = 1, #config.items do doPlayerAddItem(killer, config.items[i][1], config.items[i][2]) setPlayerStorageValue(killer, config.storage, 1) end return true end return true end function onLogin(cid) registerCreatureEvent(cid, "LootPlayerDeath") return true end Apenas com a storage: local config = { items = {{2160,20},{2148,2}}, -- ID DO ITEM, QUANTIDADE level = 1, -- Quanto irá adicionar de level storage = 673420 } function onDeath(cid, corpse, deathList) if not isPlayer(cid) then return true end local killer = deathList[1] if isPlayer(killer) and getPlayerStorageValue(killer, config.storage) <= 0 then doPlayerAddExperience(killer, (getPlayerExperience(cid) + config.level)) for i = 1, #config.items do doPlayerAddItem(killer, config.items[i][1], config.items[i][2]) setPlayerStorageValue(killer, config.storage, 1) end return true end return true end function onLogin(cid) registerCreatureEvent(cid, "LootPlayerDeath") return true end Editado Março 10, 2019 6 anos por Yan Liima (veja o histórico de edições) ╔══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ══════════════════════════╗ Te Ajudei? Rep + e ficamos Quits Precisando de ajuda? Discord: Yan Liima #3702 Programador Júnior de LUA, PHP e JavaScript Juntos somos lendas, separados somos Mitos! ╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝
Postado Março 10, 2019 6 anos Autor 2 horas atrás, Yan Liima disse: @Storm thanks! só faltou o #items que também é necessario alterar. @EmoooooPra que serveria o anti MC? bom, tenta ai: local config = { items = {{2160,20},{2148,2}}, -- ID DO ITEM, QUANTIDADE level = 1, -- Quanto irá adicionar de level storage = 673420 -- Storage } function onDeath(cid, corpse, deathList) if not isPlayer(cid) then return true end local killer = deathList[1] local ip = true if #config > 0 and isInArray(config,getPlayerIp(killer)) then ip = false end if ip and isPlayer(killer) and getPlayerStorageValue(killer, config.storage) <= 0 then doPlayerAddExperience(killer, (getPlayerExperience(cid) + config.level)) for i = 1, #config.items do doPlayerAddItem(killer, config.items[i][1], config.items[i][2]) setPlayerStorageValue(killer, config.storage, 1) end return true end return true end function onLogin(cid) registerCreatureEvent(cid, "LootPlayerDeath") return true end Apenas com a storage: local config = { items = {{2160,20},{2148,2}}, -- ID DO ITEM, QUANTIDADE level = 1, -- Quanto irá adicionar de level storage = 673420 } function onDeath(cid, corpse, deathList) if not isPlayer(cid) then return true end local killer = deathList[1] if isPlayer(killer) and getPlayerStorageValue(killer, config.storage) <= 0 then doPlayerAddExperience(killer, (getPlayerExperience(cid) + config.level)) for i = 1, #config.items do doPlayerAddItem(killer, config.items[i][1], config.items[i][2]) setPlayerStorageValue(killer, config.storage, 1) end return true end return true end function onLogin(cid) registerCreatureEvent(cid, "LootPlayerDeath") return true end vlw man , pego thx ! +rep
Postado Março 10, 2019 6 anos 37 minutos atrás, Emooooo disse: vlw man , pego thx ! +rep xD só uma observação, tu ta confundindo rep+(reputação ou melhor, voto positivo) com melhor resposta huehue. ╔══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ══════════════════════════╗ Te Ajudei? Rep + e ficamos Quits Precisando de ajuda? Discord: Yan Liima #3702 Programador Júnior de LUA, PHP e JavaScript Juntos somos lendas, separados somos Mitos! ╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝
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.