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

Addon lever

Zatacka

Mapper, Basic Scripter
Joined
May 12, 2009
Messages
222
Reaction score
14
Location
Sweden
Can anyone help me, i need a addon lever script, when you have x item and use a lever, you get both addons(first + second) for only 1 outfit.. example: Hunter

Solved:

Code:
local t = {
--[ACTIONID] = {FEMALEID, MALEID, "OUTFITNAME"}
[8001] = {136, 128, "citizen"},
[8002] = {137, 129, "hunter"},
[8003] = {138, 130, "mage"},
[8004] = {139, 131, "knight"},
[8005] = {140, 132, "nobleman"},
[8006] = {141, 133, "summoner"},
[8007] = {142, 134, "warrior"},
[8008] = {147, 143, "barbarian"},
[8009] = {148, 144, "druid"},
[8010] = {149, 145, "wizard"},
[8011] = {150, 146, "oriental"},
[8012] = {155, 151, "pirate"},
[8013] = {156, 152, "assassin"},
[8014] = {157, 153, "beggar"},
[8015] = {158, 154, "shaman"},
[8016] = {252, 251, "norseman"},
[8017] = {269, 268, "nightmare"},
[8018] = {270, 273, "jester"},
[8019] = {279, 278, "brotherhood"},
[8020] = {288, 289, "demonhunter"},
[8021] = {324, 325, "yalaharian"},
[8022] = {336, 335, "warmaster"},
[8023] = {136, 128, "wayfarer"}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local v = t[item.actionid]
    local k = getPlayerSex(cid) == 0 and v[1] or v[2]
    local msg = {"You\'ve already obtained the "..v[3].." addons!", "You don't have any addon doll.", "Congratulations, you\'ve obtained the "..v[3].." addons!"}
    if canPlayerWearOutfit(cid, k, 3) then
        return doPlayerSendCancel(cid, msg[1]), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
    end
    if getPlayerItemCount(cid, 6567) < 1 then
        return doPlayerSendCancel(cid, msg[2]), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
    end
    doPlayerAddOutfit(cid, k, 3)
    doPlayerRemoveItem(cid, 6567, 1)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[3])
    return true
end

Credits and thanks to Ninja
 
Last edited:
Not shure this will work, im lua newbie xD

Try:
Code:
local item = ID
local count = COUNT

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if (getPlayerStorageValue(cid, 4777) == EMPTY_STORAGE) and getPlayerItemCount(cid, item, count) then
        doCreatureSay(cid, "You have recived the Assassin Addon!", TALKTYPE_ORANGE_1)
        doPlayerAddOutfit(cid, 156, 3)
        doPlayerAddOutfit(cid, 152, 3)
        setPlayerStorageValue(cid, 4777, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
    else
        doPlayerSendTextMessage(cid,22,"You have already have this addon.")
    end
    return true
end

This is for Assassin for an example
 
its work but when player go and buy don't remove money :S
Code:
local item = 9971
local count = 15

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if (getPlayerStorageValue(cid, 4777) == EMPTY_STORAGE) and getPlayerItemCount(cid, 9971, 15) then
        doCreatureSay(cid, "You have recived the Assassin Addon!", TALKTYPE_ORANGE_1)
        doPlayerAddOutfit(cid, 156, 3)
        doPlayerAddOutfit(cid, 152, 3)
        setPlayerStorageValue(cid, 4777, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
    else
        doPlayerSendTextMessage(cid,22,"You have already have this addon.")
    end
    return true
end
 
Think i was a bit tierd yesterday, here u go :)
Code:
local item = 9971
local count = 15

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if (getPlayerStorageValue(cid, 4777) == EMPTY_STORAGE) and (getPlayerItemCount(cid, item) >= count) then
        doCreatureSay(cid, "You have recived the Assassin Addon!", TALKTYPE_ORANGE_1)
        doPlayerRemoveItem(cid, item, count)
        doPlayerAddOutfit(cid, 156, 3)
        doPlayerAddOutfit(cid, 152, 3)
        setPlayerStorageValue(cid, 4777, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
    else
        doPlayerSendTextMessage(cid,22,"You have already have this addon.")
    end
    return true
end
 
thx but when player go to buy without money its say
You have already have this addon i want its say you need 15 items name to get this addon i will rep you :D and i have one more problem if u can help me Why I can not access the account manager in a own account? Brand incorrect password. im use tfs 0.4 dev when creat account by account manger i can't open account manger on same account
 
Code:
        doCreatureSay(cid, "You have recived the Assassin Addon!", TALKTYPE_ORANGE_1)
Change this line :), Srry dont know the other problem :(
 
i want it too say
You have recived the Assassin Addon if i realy have this addon example im new commer and want to buy this addon and when got to buy it lever say you need 15 items name to get this addon . and if i have this addon
Creature
You have already have this addon i hope u understand me sorry for my english :S
 
Code:
        doCreatureSay(cid, "You have recived the Assassin Addon!", TALKTYPE_ORANGE_1)
Change this line :), Srry dont know the other problem :(

you are wrong about you explain
the line you change is when you get the addon

the line needed to be changed is this
Code:
  doPlayerSendTextMessage(cid,22,"You have already have this addon.")

to this

Code:
  doPlayerSendTextMessage(cid,22,"You need 15 crystal coins to buy this addon.")
 
Yee saw i was wrong xD but he wants it to say

You need 15 crystal coins to buy this addon if you dont have 15 crystal coins and You have already have this addon if you already have it.
 
no no I got what he want

look

if he have 15 cc he can use lever and get addon
if he don't have 15 cc it's gonna say you need 15 cc

if he already did it and have the outfit and try to use lever again
it will say sorry you have this outfit

something like this

Code:
if getPlayerStorageValue(cid, Storage, 1) then
doCreatureSay(cid, "you already have this outfit", TALKTYPE_ORANGE_1)
 
You could use canPlayerWearOutfit instead of storage :p
Code:
    local v = getPlayerSex(cid) == 0 and 156 or 152
    if canPlayerWearOutfit(cid, v, 3) then
        return doPlayerSendCancel(cid, "You already have this outfit.")
    end
 
@Ninja
I made this script

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if (getPlayerStorageValue(cid, 4777) == -1) and (getPlayerItemCount(cid, 9971) >= 15) then
doPlayerSendTextMessage(cid,21 , "Wow you own assassin addon! ")
doPlayerRemoveItem(cid, 9971, 15)
doPlayerAddOutfit(cid, 156, 3)
doPlayerAddOutfit(cid, 152, 3)
setPlayerStorageValue(cid, 4777, 1)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
else
doPlayerSendTextMessage(cid,22,"You need 15 Gold Ingots to get this addon")
end
if getPlayerStorageValue(cid, 4777) >= 1 then
doPlayerSendCancel(cid, "You Already have this addon")
end
return true
end

if you don't have money it says u need money to get it



if you have money it says you own it



if you have more money and try again :D here is the thing make me cry :'(

it says you need 15 gold ingots and send cancel that you own it xD !!



Premium Account needed
 
@EvilSkillz, you can do like this

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local v = getPlayerSex(cid) == 0 and 156 or 152
    if canPlayerWearOutfit(cid, v, 3) then
        return doPlayerSendCancel(cid, "You have already obtained the assassin addons."), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
    end

    if getPlayerItemCount(cid, 9971) < 15 then
        return doPlayerSendCancel(cid, "You need 15 gold ingots in order to obtain the assassin addons."), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
    end

    doPlayerAddOutfit(cid, v, 3)
    doPlayerRemoveItem(cid, 9971, 15)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have obtained the assassin addons!")
    doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
    return true
end
 
Last edited:
@EvilSkillz, you can do like this

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local v = getPlayerSex(cid) == 0 and 156 or 152
    if canPlayerWearOutfit(cid, v, 3) then
        return doPlayerSendCancel(cid, "You have already obtained the assassin addons."), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
    end
 
    if getPlayerItemCount(cid, 9971) < 15 then
        return doPlayerSendCancel(cid, "You need 15 gold ingots in order to obtain the assassin addons."), doSendMagicEffect(getThingPos(cid), false
    end
 
    doPlayerAddOutfit(cid, v, 3)
    doPlayerRemoveItem(cid, 9971, 15)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have obtained the assassin addons!")
    doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
    return true
end

Error Brother

[28/09/2013 11:12:57] [Error - LuaScriptInterface::loadFile] data/actions/scripts/lever.lua:9: ')' expected (to close '(' at line 8) near 'end'
[28/09/2013 11:12:57] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/lever.lua)
[28/09/2013 11:12:57] data/actions/scripts/lever.lua:9: ')' expected (to close '(' at line 8) near 'end'
 
Back
Top