Ir para conteúdo

Featured Replies

Postado

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

 

  • Respostas 12
  • Visualizações 572
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • @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, QUANTID

  • 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

  • xD só uma observação, tu ta confundindo rep+(reputação ou melhor, voto positivo) com melhor resposta huehue.

Postado
  • 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
  • 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 por Yan Liima (veja o histórico de edições)

════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═══╗

Te Ajudei? Rep + e ficamos Quits

166420979_logoyanliimaornight.png.33f822b8970081a5b3646e85dbfd5934.png

Precisando de ajuda?

discord.png.1ecd188791d0141f74d99db371a2e0a4.png.890d5a38d7bcde75543c72b624a65de1.pngDiscord: Yan Liima #3702

Programador Júnior de LUA, PHP e JavaScript

Juntos somos lendas, separados somos Mitos!

╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝

Postado
  • 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
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

166420979_logoyanliimaornight.png.33f822b8970081a5b3646e85dbfd5934.png

Precisando de ajuda?

discord.png.1ecd188791d0141f74d99db371a2e0a4.png.890d5a38d7bcde75543c72b624a65de1.pngDiscord: 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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo