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 ?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
if getPlayerStorageValue(cid, storage) == -1 then
setPlayerStorageValue(cid, storage, 1)
Can you explain what are these lines for ?
Code:if getPlayerStorageValue(cid, storage) == -1 thenCode:setPlayerStorageValue(cid, storage, 1)
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