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

Lever of item

lopez65

Member
Joined
May 10, 2012
Messages
294
Solutions
1
Reaction score
16
Location
Barcelona
Hi, I need a script. That when using it I remove xxx coin, and measure xxx itemp


My server is 10.76. Thank you and greetings
 
Not sure what you mean but try this:
LUA:
function onUse(cid, item, frompos, item2, topos)   
   
    local thing, coins, count = item.itemid == 1945, 2148, 10
   
    if not thing then
        return item:transform(1945)
    end
   
    if cid:removeItem(coins, count) then
        cid:sendTextMessage(22, count .. " coins removed. " .. (cid:getItemCount(coins) ~= 0 and "You now have " .. cid:getItemCount(coins) .." coins left" or "You don't have any coins left") .. ".")
        item:transform(1946)
    end
   
    return true
end
 
LUA:
local coin = 2160
local count = 50

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not player:removeItem(coin, count) then
        return item:transform(item:getId() == 1945 and 1946 or 1945)
    end
    local newCount = player:getItemCount(coin)
    local msg = ("You now have %d %s coin%s"):format(newCount, ItemType(coin):getName(), newCount > 1 and "s" or "")
    player:sendTextMessage(MESSAGE_INFO_DESCR, msg)
    return item:transform(item:getId() == 1945 and 1946 or 1945)
end

XML:
<action actionid="9998" script="script here.lua"/>
then set a lever (item id 1945) to action id 9998
 
Por favor, ayudar a dónde va el id del elemento y la cantidad que tiene que dar.
Please help where the id of the item goes and how much it has to give.

[= Código Lua] locales de Moneda = 2160
locales de recuento = 50
Función onUse (Jugador, Elemento, fromPosition, Objetivo, toPosition, isHotkey)
si no Jugador: removeItem (monedas, Contar) una Continuación,
volver article: Transformar (TEMA: getId () == 1945 y 1946 o 1945)
aleta
locales newCount = Jugador: getItemCount (monedas)
locales msg = ( "Ahora Tiene% d% s% s de la moneda"): Formato (newCount, itemtype (monedas): getName (), newCount> 1 y "s" o "")
Jugador: sendTextMessage (MESSAGE_INFO_DESCR, msg)
volver article: Transformar (TEMA: getId () == 1945 y 1946 o 1945)
fin [/ code]

itemp is 16101 quantity 1
here look

local coin = 2160
local count = 50

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if not player:removeItem(coin, count) then
return item:transform(item:getId() ==16101, 1 and 1946 or 1945)
end
local newCount = player:getItemCount(coin)
local msg = ("You now have %d %s coin%s"):format(newCount, ItemType(coin):getName(), newCount > 1 and "s" or "")
player:sendTextMessage(MESSAGE_INFO_DESCR, msg)
return item:transform(item:getId() ==16101, 1 and 1946 or 1945)
end


Discount the money but not the item

My problem is here and this is an important part of my server I hope someone helps me deduct the object but does not measure anything

help please
LUA:
local coin = 2160
local count = 50

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if not player:removeItem(coin, count) then
return item:transform(item:getId() ==16101, 1 and 1946 or 1945)
end
local newCount = player:getItemCount(coin)
local msg = ("You now have %d %s coin%s"):format(newCount, ItemType(coin):getName(), newCount > 1 and "s" or "")
player:sendTextMessage(MESSAGE_INFO_DESCR, msg)
return item:transform(item:getId() ==16101, 1 and 1946 or 1945)
end

LUA:
    <action actionid="23478" script="Edited/Palancas V1.lua"/>

bump please help!
 
Last edited by a moderator:
Get your parents to translate for you.
I have no idea what you want.

What I want is that when you click on the lever, it removes x amount of crystal coins and me from a fire sword for example.

The server version is 10.76 TFS 1.2

I hope you understand now
 
Back
Top