Grillo1995
New Member
Hello everyone.
I have a small problem with my EXP BONUS script.
When the player has a guild, the system works 100% without errors and problems.
However, when he has no guild, the error in the log and the exp stages does not work.
events/player.lua
Error log:
I see that a null value is returning, I do not understand why it is not working since my IF treats this null value .. Thanks and I look forward to it!
Remembering that when the player has a guild, the script works as it should.
I have a small problem with my EXP BONUS script.
When the player has a guild, the system works 100% without errors and problems.
However, when he has no guild, the error in the log and the exp stages does not work.
events/player.lua
Code:
local guild = self:getGuild()
if guild ~= nil then -- If player is in a guild
if guild:getId() == guildOwner() then -- set exp bonus
exp = exp * 1.05
end
else -- If player dont have guild set exp normal
return exp
end
Error log:
Code:
Lua Script Error: [Event Interface]
data/events/scripts/player.lua:Player@onGainExperience
data/events/scripts/player.lua:263: attempt to index global 'player' (a nil value)
stack traceback:
[C]: in function '__index'
data/events/scripts/player.lua:263: in function <data/events/scripts/player.lua:261>
I see that a null value is returning, I do not understand why it is not working since my IF treats this null value .. Thanks and I look forward to it!
Remembering that when the player has a guild, the script works as it should.