• 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 'isPlayer' (a nil value)

Neptera

Member
Joined
Mar 3, 2018
Messages
64
Reaction score
17
I am trying to get a simple "add premium days" script to work.
Engine used is Nostalrius 7.72, please help me.

1712605205200.png

Lua:
function onUse(player, item, fromPosition, target, toPosition)
    if not target:isPlayer() then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "Can not use this is, it is not human!")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return true
    end
    if target:isPlayer() then
    target:sendTextMessage(MESSAGE_STATUS_DEFAULT, "15 days of premium account has been added to your account!")
    target:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    target:addPremiumDays(15)
        doRemoveItem(item.uid, 1)
    end
    return true
end
 
try!
Lua:
function onUse(player, item, fromPosition, target, toPosition)
    if not target or not target:isCreature() then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot use this on a non-creature target.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return true
    end

    if target:isPlayer() then
        target:sendTextMessage(MESSAGE_STATUS_DEFAULT, "15 days of premium account have been added to your account!")
        target:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        target:addPremiumDays(15)
        item:remove(1)
    end

    return true
end
 
Back
Top