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

Item give storage

Yurland

Member
Joined
Dec 3, 2013
Messages
66
Reaction score
13
Hello, I need script that when I Click on item (it's hat) I get X storage and hat was removed :>
 
I'm going to guess your server version since you forgot to post it.
Code:
local storage = 37483
function onUse(cid, item, fromPosition, itemEx, toPosition)
     if getPlayerStorageValue(cid, storage) == -1 then
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got a storagevalue.")
         setPlayerStorageValue(cid, storage, 1)
         doRemoveItem(item.uid, 1)
     else
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already clicked on this.")
     end
     return true
end
 
I'm going to guess your server version since you forgot to post it.
Code:
local storage = 37483
function onUse(cid, item, fromPosition, itemEx, toPosition)
     if getPlayerStorageValue(cid, storage) == -1 then
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got a storagevalue.")
         setPlayerStorageValue(cid, storage, 1)
         doRemoveItem(item.uid, 1)
     else
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already clicked on this.")
     end
     return true
end
Can you explain what are these lines for ?
Code:
  if getPlayerStorageValue(cid, storage) == -1 then
Code:
   setPlayerStorageValue(cid, storage, 1)
 
Can you explain what are these lines for ?
Code:
  if getPlayerStorageValue(cid, storage) == -1 then
Code:
   setPlayerStorageValue(cid, storage, 1)
Code:
local storage = 37483 -- storageID to be used anywhere throughout the script.
function onUse(cid, item, fromPosition, itemEx, toPosition) -- If the item is used.
if getPlayerStorageValue(cid, storage) == -1 then -- If the storage value above is not in use (-1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got a storagevalue.") -- Send the player a message
setPlayerStorageValue(cid, storage, 1) -- set the storage value to 1 (in use)
doRemoveItem(item.uid, 1) -- remove the item that that was used.
else -- if above is not true (if storage is not equal to -1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already clicked on this.") -- Send player message saying they already have done this before
end -- end the if statement
return true -- I'm actually unsure why we use this, my guess is that it is checking to see if the script is actually finished at this point and that the function has completed successfully
end -- end the function onUse
 
Back
Top