• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

TFS 1.X+ player:registerEvent(name) && onTextEdit tfs 1.x

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,210
Solutions
35
Reaction score
207
I'm creating an item where the player opens the paper, and writes something, he looses hp (deathnoe).
So i use function "onTextEdit", like this.

LUA:
function onTextEdit(cid, item, newText)
    if item.actionid == 9202 then
        doCreatureAddHealth(getCreatureByName(newText), -250)
    end
    return TRUE
end

but i need to register on login.lua
Code:
registerCreatureEvent (cid, "DeathNote")

to avoid registering at all, I wanted to register only those who open the item. Like this in actions:

LUA:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 15811 then
        player:registerEvent("DeathNote")
    end
    return false
end

but every time he opens the paper, it will be registred, can this cause an error or lag? If you register multiple times on the same player for example
 
I'm creating an item where the player opens the paper, and writes something, he looses hp (deathnoe).
So i use function "onTextEdit", like this.

LUA:
function onTextEdit(cid, item, newText)
    if item.actionid == 9202 then
        doCreatureAddHealth(getCreatureByName(newText), -250)
    end
    return TRUE
end

but i need to register on login.lua
Code:
registerCreatureEvent (cid, "DeathNote")

to avoid registering at all, I wanted to register only those who open the item. Like this in actions:

LUA:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 15811 then
        player:registerEvent("DeathNote")
    end
    return false
end

but every time he opens the paper, it will be registred, can this cause an error or lag? If you register multiple times on the same player for example
You can setup this without any problems and lags in login.lua
 
Back
Top