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

Lua Help please! script simple (creatureevents)

snuckles

Banned User
Joined
Apr 4, 2009
Messages
74
Reaction score
3
Location
Hong Kong
Hi, can you help me? I know that this may seem simple to you, but since I can't find that someone has created it, could you do it? I think it will take you little time. This script is for tfs 1.2 "creaturescripts". Its function is that when a player dies and contains said storage, his character is permanently deleted. this is an example of which I tried to create an experimental one.

function onDeath(cid, corpse, deathList)
if getPlayerStorageValue(cid,61266) < 1 then
return true
end
db.storeQuery("UPDATE players SET deleted = 1 WHERE id = " .. player:getID());
return true
end
 
Solution
Lua:
local function setDeletedStatus(playerGUID)
    db.storeQuery("UPDATE players SET deleted = 1 WHERE id = " .. playerGUID);
    return
end

function onDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    if player:getStorageValue(61266) < 1 then
        return true
    end
    local playerGUID = player:getGuid()
    addEvent(setDeletedStatus, 0, playerGUID)
    return true
end
So what's the problem? Script doesn't work?

Did you try to register it in login.lua?
Is registered into login.lua and spent about 4 hours testing multi functions that I saw based on all the posts related to this, I also used GetGUID but nothing works, if someone could be so kind and have mercy on me please fix this script. please! I use actually the TFS 1.2
 
Is registered into login.lua and spent about 4 hours testing multi functions that I saw based on all the posts related to this, I also used GetGUID but nothing works, if someone could be so kind and have mercy on me please fix this script. please! I use actually the TFS 1.2
My guess without actually testing the theory, is that the player is still online while you're executing the function, so it doesn't save the changes.

Try executing the function with an addEvent.

Lua:
local function setDeletedStatus(playerGUID)
    db.storeQuery("UPDATE players SET deleted = 1 WHERE id = " .. playerGUID);
    return
end

function onDeath(cid, corpse, deathList)
    if getPlayerStorageValue(cid, 61266) < 1 then
        return true
    end
    local playerGUID = player:getGuid()
    addEvent(setDeletedStatus, 0, playerGUID)
    return true
end
 
Lua:
local function setDeletedStatus(playerGUID)
    db.storeQuery("UPDATE players SET deleted = 1 WHERE id = " .. playerGUID);
    return
end

function onDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    if player:getStorageValue(61266) < 1 then
        return true
    end
    local playerGUID = player:getGuid()
    addEvent(setDeletedStatus, 0, playerGUID)
    return true
end
 
Solution
Lua:
local function setDeletedStatus(playerGUID)
    db.storeQuery("UPDATE players SET deleted = 1 WHERE id = " .. playerGUID);
    return
end

function onDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    if player:getStorageValue(61266) < 1 then
        return true
    end
    local playerGUID = player:getGuid()
    addEvent(setDeletedStatus, 0, playerGUID)
    return true
end
in this case addevent is useless, just sayin
 
Last edited:
Holy shit, Akihiko Kayaba, is that you?

since the beginning, every time you tried, it always gave this error? Every script?
Post automatically merged:


Deleted exist in your database? Can be deletion or another name
The truth is that I am not sure what is really happening, but I do know that the "deleted" function exists in the database, simply something must be wrong in the configuration, there are always these types of problems with OTX.


If a few days ago I've been trying to create this experimental script.
 
The truth is that I am not sure what is really happening, but I do know that the "deleted" function exists in the database, simply something must be wrong in the configuration, there are always these types of problems with OTX.


If a few days ago I've been trying to create this experimental script.
Otx 3.6 based on tfs 1.2 uses deletion, try to change deleted to deletion

Or try to delete the player, not set deleted.

Lua:
db.storeQuery("DELETE FROM players WHERE id = " .. playerGUID);
 
Last edited:
Otx 3.6 based on tfs 1.2 uses deletion, try to change deleted to deletion

Or try to delete the player, not set deleted.

Lua:
db.storeQuery("DELETE FROM players WHERE id = " .. playerGUID);

Fixed. The solution is change of "deleted" to "deletion" perfectly. Now is work correctly, Thank you very much!
And thank you @Xikini for your contribution and help! I really appreciate this.
 
Come to play a world different. (Multiverses alternate realities).
Server Website: Latestnews - SAO Game (http://swordart.zapto.org/)

 
Back
Top