• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Monster is lifeless however stands and dies

felipemko

New Member
Joined
Mar 2, 2010
Messages
173
Reaction score
3
Error in Task System, Monster is lifeless however stands and dies.
http://prntscr.com/48jlj3


Script:

local config = {
['verminor'] = {amount = 2000, storage = 19555, startstorage = 5555, startvalue = 1},
}
function onKill(cid, target)
local monster = config[getCreatureName(target):lower()]
if isPlayer(target) or not monster or isSummon(target) then
return true
end

if getPlayerStorageValue(cid, monster.storage) >= -1 and (getPlayerStorageValue(cid, monster.storage)+1) < monster.amount and getPlayerStorageValue(cid, monster.startstorage) >= monster.startvalue then
setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Task: Matou '..(getPlayerStorageValue(cid, monster.storage)+1)..' de '..monster.amount..' '..getCreatureName(target)..'s.')
end
if (getPlayerStorageValue(cid, monster.storage)+1) == monster.amount then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Parabens, voce matou '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s e completou a missao dos '..getCreatureName(target)..'s.')
setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
end
return true
end
 
What happens if you use a different storage? For example 19556 or something totaly different like 41900.
Do you also get the same error?
 
I do not know because not all monsters are bug in the task, sometimes you have 1 monster starts to bug this way, another time is another monster, at first it was just the Verminor, bug are now 2, and so on ... randomly ..

Look what show in player_storage the storage of task when happens this bug
http://prntscr.com/4byje3

Rather than show the amount of already dead monsters (ex: 500) appears odd symbols happens when the bug, since when you try to kill the monster task, it happens
 
You can try to do this, find this line in the script, it's added 2x (don't forget to change storage number, so it's not 19555, since that doesn't have a number as value anymore).
Code:
setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
Change it to
Code:
local s = getPlayerStorageValue(cid, monster.storage)
print(s)
setPlayerStorageValue(cid, monster.storage, s + 1)

Do the same thing with the second line.
Then when you kill the monster, look what it shows in your console and if it changes from a number to something else.
If it stays a number, then it should work like this and you can remove: print(s), since that is just to test.
 
What is the result if you do it like this?
Code:
local s = getPlayerStorageValue(cid, monster.storage)
print(s)
setPlayerStorageValue(cid, monster.storage, s + 1)
What does it show in your console when you kill the monster?
Make sure to use a storage you didn't use yet, like 41902 or something.

To remove the bugged storage values you can remove it from the database or set them to -1 in a script.
Code:
setPlayerStorageValue(cid, 19555, -1)
 
It won't show (s), it will show the storage value, which should be a number, if you still get errors after you changed that and changed the storage number, post them.
You can also add:
Code:
print(getPlayerStorageValue(cid, monster.storage))
Under local monster = config[getCreatureName(target):lower()]
Make sure while testing it you only kill monsters in the config then, else you will get a bunch of errors and not dieing monsters.
Or you can add it under this, if you are sure that part is working properly on your server (the isSummon function, the other 2 will always work).
Code:
if isPlayer(target) or not monster or isSummon(target) then
return true
end
 
Back
Top