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

Lua If item x do send effect every login

Seumion

★ Spell Maker & Mapper ★
Joined
Feb 24, 2015
Messages
172
Reaction score
2
hello otland support and members how can i make script if i have item x do send effect every login
USING tfs 4.0 dev
 
no i put it in login/lua

updated the post above, check this:

Code:
local storageItem = 11741
if (getPlayerStorageValue(cid, storageItem) > 0) and (getPlayerBlessing(cid, 1) == false) then
  doPlayerAddItem(cid, 2173, 1)
for i = 1,5 do
  doPlayerAddBlessing(cid, i)
end
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You received free AOL and BLESS.")
  doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
else
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your character have all blessings.")
  doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
end
 
Code:
function onLogin(cid)
    doChangeSpeed(cid, 750)
    doCreatureSay(cid, "Welcome!", 19)
    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), getConfigValue('loginMessage')
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end

    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "Forever Amulet")
    registerCreatureEvent(cid, "onPrepareDeath")
    registerCreatureEvent(cid, "ZombieAttack")
    registerCreatureEvent(cid, "removeghostspell")
    registerCreatureEvent(cid, "removeghostcombat")
    registerCreatureEvent(cid, "AutoBuyer")
    registerCreatureEvent(cid, "skullsystem")
    registerCreatureEvent(cid, "BlockEffect")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "Idle")
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")
    if(getBooleanFromString(getConfigValue('useFragHandler'))) then
        registerCreatureEvent(cid, "SkullCheck")
    end

    if(getPlayerItemCount(itemid) >= 1) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
    end
    return true
end

A tip is to keep your code clean, you will waste ALOT of time just trying to find the error.
Just ask @yogiikke who spent 5h last night trying to get my help, once he had actually tabbed the script I helped him :p
* Was pretty funny from my POV * :p
what is it you feel like you did differently from my script? Do you think location of the if statement changes how the onLogin works? Lol
 
what is it you feel like you did differently from my script? Do you think location of the if statement changes how the onLogin works? Lol

No I just diden't like the way you tabbed the code.
And all "no needed" things should be placed at the end, so if something fails like an if statment the code won't be executed.
"Lol"
 
No I just diden't like the way you tabbed the code.
And all "no needed" things should be placed at the end, so if something fails like an if statment the code won't be executed.
"Lol"
You realize my code is tabbed the same as yours except you spaced an if statement out? And if something fails? How would something fail when it's the exact same thing you're adding? Except wait, my code actually included local item and you were in such a hurry to prove a point you left it out. Your sense of direction is lost.
 
You realize my code is tabbed the same as yours except you spaced an if statement out? And if something fails? How would something fail when it's the exact same thing you're adding? Except wait, my code actually included local item and you were in such a hurry to prove a point you left it out. Your sense of direction is lost.

All I am saying is add the crap in the end, if you feel that you would use your script insted then go ahead and do that lol.
Since you seem to be a cry baby ill stop replying.
 
Back
Top