• 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 [SQLite] -=[TFS]=- 0.4 8.60 Use only reset 100 storage = 54676

samuel157

/root
Joined
Mar 19, 2010
Messages
447
Solutions
3
Reaction score
49
Location
São Paulo, Brazil
GitHub
Samuel10M
storage = 54676

Lua:
local gold_cost = 0

function onSay(cid, words, param)
  if getPlayerLevel(cid) >= 717217 and (getPlayerStorageValue(cid, 13545) > 0) and isPremium(cid) then
    if doPlayerRemoveMoney(cid, gold_cost) then
      doPlayerAddItem(cid, 5805, 1)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce comprou um item para desbugar a CAP.")
    else
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce nao tem dinheiro suficiente.")
      doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    end
  else
    if getPlayerLevel(cid) < 717217 then
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce nao tem level suficiente.")
    elseif getPlayerStorageValue(cid, 13545) <= 0 then
      doCreatureSay(cid, "Voce nao e VIP.", TALKTYPE_ORANGE_1)
    else
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce nao e premium.")
    end
    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
  end
end
 
Here's your modified script:

Lua:
local gold_cost = 0
local reset_storage = 54676 -- The storage ID to be reset to 100


function onSay(cid, words, param)
  if getPlayerLevel(cid) >= 717217 and (getPlayerStorageValue(cid, 13545) > 0) and isPremium(cid) then
    if doPlayerRemoveMoney(cid, gold_cost) then
      doPlayerAddItem(cid, 5805, 1)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce comprou um item para desbugar a CAP.")
      
      -- Reset the storage value to 100
      setPlayerStorageValue(cid, reset_storage, 100)
      
    else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce nao tem dinheiro suficiente.")
      doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    end
  else
    if getPlayerLevel(cid) < 717217 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce nao tem level suficiente.")
    elseif getPlayerStorageValue(cid, 13545) <= 0 then
      doCreatureSay(cid, "Voce nao e VIP.", TALKTYPE_ORANGE_1)
    else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce nao e premium.")
    end
    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
  end
end

In this modified script, the storage value with ID 54676 will be reset to 100 when a player successfully purchases an item. Feel free to adjust the placement of setPlayerStorageValue(cid, reset_storage, 100) according to your specific needs.
 
you might be looking for this...

Lua:
local gold_cost = 0

function onSay(cid, words, param)
  if getPlayerLevel(cid) >= 717217 and (getPlayerStorageValue(cid, 13545) > 0) and getPlayerStorageValue(cid, 54676) > 100 and isPremium(cid) then
    if doPlayerRemoveMoney(cid, gold_cost) then
      doPlayerAddItem(cid, 5805, 1)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce comprou um item para desbugar a CAP.")
    else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce nao tem dinheiro suficiente.")
      doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    end
  else
    if getPlayerLevel(cid) < 717217 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce nao tem level suficiente.")
    elseif getPlayerStorageValue(cid, 13545) <= 0 then
      doCreatureSay(cid, "Voce nao e VIP.", TALKTYPE_ORANGE_1)
    else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce nao e premium.")
    end
    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
  end
end

as you can see, the only difference is that I added the getPlayerStorageValue on the main IF, try to understand whats happening on the code and you might improve ur skills
 

Similar threads

Replies
0
Views
385
Back
Top