ME

[Script Erro] Ajudem

Por Mehahbr, 17 de jan. de 2012 em Archived

script
7
1.2k
MehahbrM
17 de janeiro de 2012 às 14:32

Estou com um erro no meu script... toda vez que eu ataco um bicho, no executavel do server aparece este erro: assdc.jpg

 

E o Script exphit.lua é esse:

 

 

-- ExpHit por Stage by Uissu

local rateExp = getConfigValue('rateExperience') or 1

local useStages = true

local tableStages = { -- {min,max or -1,rate}

{1,75,200},{76,150,100},{151,200,50},{201,275,35},{276,300,25},{301,350,15},{351,375,10},{376,400,5},{401,425,3},{426,-1,1}

}

 

function getPlayerStageRate(cid, table) -- by Uissu

for _,v in ipairs(table) do

if getPlayerLevel(cid) >= v[1] and (v[2] == -1 or getPlayerLevel(cid) <= v[2]) then

rate = v[3]

break

end

end

return rate

end

 

function CalculeExp(monsterhp, exptotal, hit)

local x = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0

local x2 = x - 20 + math.random(20)

return x2 > 0 and x2 or 0

end

 

function isSummon(uid)

return uid ~= getCreatureMaster(uid) or false

end

 

function onStatsChange(cid, attacker, type, combat, value)

if type == STATSCHANGE_HEALTHLOSS then

if isMonster(cid) then

if isCreature(attacker) then

local sid = isSummon(attacker) == true and getCreatureMaster(attacker) or attacker

if isPlayer(sid) then

stageRate = getPlayerStageRate(cid, tableStages)

local expg = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp, value)

doSendAnimatedText(getThingPos(sid), useStages and expg * stageRate or expg, 215)

doPlayerAddExp(sid, useStages and expg * stageRate or expg)

end

end

end

elseif type == STATSCHANGE_HEALTHGAIN then

return false

end

return true

end

 

function onCombat(cid, target)

if isMonster(target) and not isSummon(target) and not isPlayer(target) then

registerCreatureEvent(target, "ExpGain")

end

return true

end

 

QUAL o erro desse script?? Poste pra mim como seria o certo disso... Obrigado pela ajuda....

bepokemonB
19 de janeiro de 2012 às 04:04

Primeiramente vou pedir que você troque o Título do seu tópico, sendo mais específico em relação ao seu tópico (dizendo no título oque você precisa em relação a ele), pois na atual forma não está dentro das regras.

 

#Topic

Tente assim ._. (Desculpa, :p)

 

-- ExpHit por Stage by Uissu
local rateExp = getConfigValue('rateExperience') or 1
local useStages = true
local tableStages = { -- {min,max or -1,rate}
{1,75,200},{76,150,100},{151,200,50},{201,275,35},{276,300,25},{301,350,15},{351,375,10},{376,400,5},{401,425,3},{426,-1,1}
}

function CalculeExp(monsterhp, exptotal, hit)
local x = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0
local x2 = x - 20 + math.random(20)
return x2 > 0 and x2 or 0
end

function isSummon(uid)
return uid ~= getCreatureMaster(uid) or false
end

function onStatsChange(cid, attacker, type, combat, value)

function getPlayerStageRate(cid, table) -- by Uissu
for _,v in ipairs(table) do
if getPlayerLevel(cid) >= v[1] and (v[2] == -1 or getPlayerLevel(cid) <= v[2]) then
rate = v[3]
break
end
end
return rate
end

if type == STATSCHANGE_HEALTHLOSS then
if isMonster(cid) then
if isCreature(attacker) then
local sid = isSummon(attacker) == true and getCreatureMaster(attacker) or attacker
if isPlayer(sid) then
stageRate = getPlayerStageRate(cid, tableStages)
local expg = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp, value)
doSendAnimatedText(getThingPos(sid), useStages and expg * stageRate or expg, 215)
doPlayerAddExp(sid, useStages and expg * stageRate or expg)
end
end
end
elseif type == STATSCHANGE_HEALTHGAIN then
return false
end
return true
end

function onCombat(cid, target)
if isMonster(target) and not isSummon(target) and not isPlayer(target) then
registerCreatureEvent(target, "ExpGain")
end
return true
end

Editado Janeiro 19 por Byerne

MehahbrM
19 de janeiro de 2012 às 09:25

Deu erro tambem :S

JohnMapperJ
19 de janeiro de 2012 às 09:30

Se deu erro em todas Pega e tira essa script..

 

Ou adicionei esse tag no XML do creaturescripts

<event type="exphit" name="exphit" script="exphit.lua"/>

se funcionar da mais + rep

Henrique MouraH
19 de janeiro de 2012 às 11:52

Deixe o título do tópico coerente com o conteúdo do mesmo - o que ele aborda, trata etc - caso contrário seu tópico será fechado e você alertado.

 

Abraços.

PedroLaercoP
21 de janeiro de 2012 às 13:37

lua: prog.lua:2: attempt to call global 'getConfigValue' (a nil value)

stack traceback:

prog.lua:2: in main chunk

[C]: ?

MehahbrM
21 de janeiro de 2012 às 17:38

Eu mesmo refiz o script aqui e deu certo... irei deixa aqui para todos verem

 

 

[b]--------------------->> Criado por Mehah <<---------------[/b]
[b]--------->> Refeito o Script do xOtServx( Eu) <<---------[/b]
[b]------> Considerando os valores de Level e EXP <<--------[/b]
[b]rateExp = 100 -- 0 a 100[/b]
[b]rateExp1 = 80 -- 101 a 125[/b]
[b]rateExp2 = 60 -- 126 a 150[/b]
[b]rateExp3 = 40 -- 151 a 200[/b]
[b]rateExp4 = 20 -- 201 a 250[/b]
[b]rateExp5 = 10 -- 251 a 300[/b]
[b]rateExp6 = 5 -- 301 a 400[/b]
[b]rateExp7 = 3 -- 401 a 450[/b]
[b]rateExp8 = 1 -- 451[/b]
[b]bonus = 1 -- Bonus por estar com exp ring[/b]
[b]expringid = 1000 -- Id do exp ring[/b]
[b]------------------------------[/b]

[b]function CalculeExp(monsterhp, exptotal, hit)[/b]
[b]local x = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0[/b]
[b]local x2 = x - 20 + math.random(20)[/b]
[b]return x2 > 0 and x2 or 0[/b]
[b]end[/b]

[b]function isSummon(uid)[/b]
[b]return uid ~= getCreatureMaster(uid) or false[/b]
[b]end[/b]

[b]function onStatsChange(cid, attacker, type, combat, value)[/b]
[b]if type == STATSCHANGE_HEALTHLOSS then[/b]
[b]if isMonster(cid) then[/b]
[b]if isCreature(attacker) then[/b]
[b]local sid = isSummon(attacker) == true and getCreatureMaster(attacker) or attacker[/b]
[b]if isPlayer(sid) and getPlayerLevel(sid) <= 100 then[/b]
[b]local expg = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp, value)[/b]
[b]doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg.." exp.")[/b]
[b]doPlayerAddExp(sid, expg)[/b]
[b]elseif isPlayer(sid) and getPlayerLevel(sid) > 100 and getPlayerLevel(sid) <= 125 then[/b]
[b]local expg1 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp1, value)[/b]
[b]doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg1.." exp.")[/b]
[b]doSendAnimatedText(getThingPos(sid), expg1, 215)[/b]
[b]doPlayerAddExp(sid, expg1)[/b]
[b]elseif isPlayer(sid) and getPlayerLevel(sid) > 125 and getPlayerLevel(sid) <= 150 then[/b]
[b]local expg2 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp2, value)[/b]
[b]doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg2.." exp.")[/b]
[b]doSendAnimatedText(getThingPos(sid), expg2, 215)[/b]
[b]doPlayerAddExp(sid, expg2)[/b]
[b]elseif isPlayer(sid) and getPlayerLevel(sid) > 150 and getPlayerLevel(sid) <= 200 then[/b]
[b]local expg3 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp3, value)[/b]
[b]doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg3.." exp.")[/b]
[b]doSendAnimatedText(getThingPos(sid), expg3, 215)[/b]
[b]doPlayerAddExp(sid, expg3)[/b]
[b]elseif isPlayer(sid) and getPlayerLevel(sid) > 200 and getPlayerLevel(sid) <= 250 then[/b]
[b]local expg4 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp4, value)[/b]
[b]doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg4.." exp.")[/b]
[b]doSendAnimatedText(getThingPos(sid), expg4, 215)[/b]
[b]doPlayerAddExp(sid, expg4)[/b]
[b]elseif isPlayer(sid) and getPlayerLevel(sid) > 250 and getPlayerLevel(sid) <= 300 then[/b]
[b]local expg5 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp5, value)[/b]
[b]doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg5.." exp.")[/b]
[b]doSendAnimatedText(getThingPos(sid), expg5, 215)[/b]
[b]doPlayerAddExp(sid, expg5)[/b]
[b]elseif isPlayer(sid) and getPlayerLevel(sid) > 300 and getPlayerLevel(sid) <= 450 then[/b]
[b]local expg6 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp6, value)[/b]
[b]doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg6.." exp.")[/b]
[b]doSendAnimatedText(getThingPos(sid), expg6, 215)[/b]
[b]doPlayerAddExp(sid, expg6)[/b]
[b]elseif isPlayer(sid) and getPlayerLevel(sid) > 400 and getPlayerLevel(sid) <= 400 then[/b]
[b]local expg7 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp7, value)[/b]
[b]doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg7.." exp.")[/b]
[b]doSendAnimatedText(getThingPos(sid), expg7, 215)[/b]
[b]doPlayerAddExp(sid, expg7)[/b]
[b]elseif isPlayer(sid) and getPlayerLevel(sid) > 450 then[/b]
[b]local expg8 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp8, value)[/b]
[b]doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg8.." exp.")[/b]
[b]doSendAnimatedText(getThingPos(sid), expg8, 215)[/b]
[b]doPlayerAddExp(sid, expg8)[/b]
[b]end[/b]
[b]end[/b]
[b]end[/b]
[b]elseif type == STATSCHANGE_HEALTHGAIN then[/b]
[b]return false[/b]
[b]end[/b]
[b]return true[/b]
[b]end[/b]

[b]function onCombat(cid, target)[/b]
[b]if isMonster(target) and not isSummon(target) and not isPlayer(target) then[/b]
[b]registerCreatureEvent(target, "ExpGain")[/b]
[b]end[/b]
[b]return true[/b]
[b]end[/b]