Ir para conteúdo
  • 0

Matar player


mlksil

Pergunta

5 respostass a esta questão

Posts Recomendados

  • 0

Esse script da uma % de exp no caso 100% [1] Level e so configurar

 

 

cria um arquivo Frag.lua e cole =

 

 

 

function onDeath(cid, corpse, deathList)

local percent = 10 -- 10% que vai ganha se Matar o Player

local xp = getPlayerExperience(deathList) -- fetch enemy experience

local calc = ((xp/100) * percent) -- calculate 1% of enemy experience, and multiply it with configured "percent"

local gain = math.floor(calc) -- Make sure the value is integer (etc 230 instead of 230,123123123)

doPlayerAddExperience(deathList, gain)

doCreatureSay(deathList, text, 19)

doSendAnimatedText(getPlayerPosition(cid),"+Frag!",math.random(1,255))

return true

end

 

depois coloca no Creaturescripts/xml =

 

 

<event type="death" name="Frags" event="script" value="Frag.lua"/>

 

 

depois Registra

 

registerCreatureEvent(cid, "Frags")

 

Editado por Nextbr
Link para o comentário
Compartilhar em outros sites

  • 0

Nextbr deu esse erro:

 

[11/03/2013 22:20:10] [Error - CreatureScript Interface]

[11/03/2013 22:20:10] data/creaturescripts/scripts/Frag.lua:onDeath

[11/03/2013 22:20:10] Description:

[11/03/2013 22:20:10] (internalGetPlayerInfo) Player not found when requesting player info #4

[11/03/2013 22:20:10] [Error - CreatureScript Interface]

[11/03/2013 22:20:10] data/creaturescripts/scripts/Frag.lua:onDeath

[11/03/2013 22:20:10] Description:

[11/03/2013 22:20:10] data/creaturescripts/scripts/Frag.lua:4: attempt to perform arithmetic on local 'xp' (a boolean value)

[11/03/2013 22:20:10] stack traceback:

[11/03/2013 22:20:10] data/creaturescripts/scripts/Frag.lua:4: in function <data/creaturescripts/scripts/Frag.lua:1>

Link para o comentário
Compartilhar em outros sites

  • 0
function onDeath(cid, corpse, deathList)

local percent = 10
local exp = 0

for _, tid in ipairs(deathList) do
  if isPlayer(cid) then
     if isPlayer(tid) then
       exp = math.floor((getPlayerExperience(tid) / 100) * percent)
          doPlayerAddExp(tid, exp)
              doCreatureSay(tid, "FRAG", 1)
              end
          end
       end
return true
end

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...