• 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 Item dissapear after second use

Hbraveq

Active Member
Joined
Nov 11, 2012
Messages
167
Reaction score
39
Hello

I have simple script to add storage id, but I have problem. Item can be used by any number of ppl instead of dissapear after first use....
function onUse(cid, item)
if getPlayerStorageValue(cid, 343450) < 1 then
setPlayerStorageValue(cid, 343450, 1)
doPlayerSendTextMessage(cid,22,"zyskales dostep do drzwi")
doRemoveItem(item.uid, 1)
end
end
 
Solution
E
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(343450) == -1 then
        player:say("zyskales dostep do drzwi", TALKTYPE_MONSTER_SAY)
        player:setStorageValue(343450, 1)
    end
    item:remove(1)
    return true
end
Hello

I have simple script to add storage id, but I have problem. Item can be used by any number of ppl instead of dissapear after first use....
use gobalstorage instead of playerstorage..
search for some example in your sorces
 
but.. wait..
why use storage?
it's not just remove the item after using it?
Post automatically merged:

i think i get it now..
function onUse(cid, item)
if getPlayerStorageValue(cid, 343450) < 1 then
setPlayerStorageValue(cid, 343450, 1)
doPlayerSendTextMessage(cid,22,"zyskales dostep do drzwi")
end
doRemoveItem(item.uid, 1)
end
 
It dissapear only if u have this storage added alredy (if u used this item before, it remove after use, but if u haven't u can use it infinity on all characters)
I want to make remove this item after one use.
Post automatically merged:

but.. wait..
why use storage?
it's not just remove the item after using it?
Post automatically merged:

i think i get it now..
function onUse(cid, item)
if getPlayerStorageValue(cid, 343450) < 1 then
setPlayerStorageValue(cid, 343450, 1)
doPlayerSendTextMessage(cid,22,"zyskales dostep do drzwi")
end
doRemoveItem(item.uid, 1)
end
It dissapear only if u have this storage added alredy (if u used this item before, it remove after use, but if u haven't u can use it infinity on all characters)
I want to make remove this item after one use.
 
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(343450) == -1 then
        player:say("zyskales dostep do drzwi", TALKTYPE_MONSTER_SAY)
        player:setStorageValue(343450, 1)
    end
    item:remove(1)
    return true
end
 
Solution
Back
Top