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

Linux Send a message to the player on default

Vrotz

Member
Joined
Apr 7, 2011
Messages
1,071
Reaction score
7
Location
Brazil
Hello!

How I do to add one line that will send a message to the player on deafult at the moment that he use the lever?

Script -> pastebin.com/XsXNp3E9
 
Hello!

How I do to add one line that will send a message to the player on deafult at the moment that he use the lever?

Script -> pastebin.com/XsXNp3E9
Code:
local c = {
    pos = {x = 220, y = 1479, z = 8},
    itemid = 1304,
    time = 900,
    msg = "You have clicked the switch"
}
local function Remove(c)
    doCreateItem(c.itemid, 1, c.pos)
    doTransformItem(getTileItemById(c.fromPosition, 1946).uid, 1945)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
    c.fromPosition = fromPosition
    if item.itemid == 1945 then
        doRemoveItem(getTileItemById(c.pos, c.itemid).uid)
        addEvent(Remove, c.time * 1000, c)
        doTransformItem(item.uid, 1946)
    elseif item.itemid == 1946 then
        if getTileItemById(c.pos, c.itemid).uid > 0 then
            doTransformItem(item.uid, 1945)
        else
            doPlayerSendCancel(cid, "It seems the lever has been already used.")
        end     
    end
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, c.msg)
    return true
end
 
Use that ish ^ if you fancy tho! lol
His code does not reflect 1.1+ it is still using cid to refer to the player's user data, so i implemented the proper function, what you wrote is normally seen for 1.1+, where player is used directly.
We don't know which version they are using, so they will have to take what they can get due to their own ignorance.
 
So thanks everyone for answer my post. I have used it and now I need other thing.

How can I make it for show how many seconds left to the lever back to normal position? A message appear at the moment that the player use the lever, an animate text above the lever show the exatcly second.

Like:
60..
59..
58..
57..

How I do to make it? xD
 
So thanks everyone for answer my post. I have used it and now I need other thing.

How can I make it for show how many seconds left to the lever back to normal position? A message appear at the moment that the player use the lever, an animate text above the lever show the exatcly second.

Like:
60..
59..
58..
57..

How I do to make it? xD
Learn the language, atleast the basics
http://tutorialspoint.com/lua

Assuming this is the type of distro, get familiar with the framework
https://github.com/Jo-Tran/cryingdamson-0.3.6-8.60-V8.2/blob/master/doc/LUA_FUNCTIONS
 
Back
Top