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

TalkAction Ingame Credits System

Medargo

Member
Joined
Jun 9, 2010
Messages
158
Reaction score
19
Ingame Credits System



What are these credits?
They are kind of a tibian currenct that can purchase VIP itens.



How they get credits?
Many ways, the GOD can choose, it is possible to make it catchable by quests, events, real money, trading with other players..



How can I, the GOD of the server can give credits to anyone?
  • There is a command that can add / remove credits from anyone, it will be explained later..
  • You can make it catchable by quests by using a piece of script that will be shown later..


We know that they are tradeable ingame, how does it works?
It works by the following, the player can use some commands that can transfer credits to the games, as Credits Pearls, and can use commands to transfer these pearls to the system. These pearls are tradeable ingame. The commands will be shown later.



What are the commands?
  • !credits : It shows a window with a guide of how to use the system;
  • !credits offers : It shows all the offers avaible to buy with the credits;
  • !credits details, [N°] : It shows a window with more details and information of the offer number [N°];
  • !credits buy, [N°] : If the player has the offer#[N°]'s price, it will buy the offer;
  • !credits withdraw, [N°] : It will transfer the number [N°] of credits in to the game;
  • !credits deposit, [N°] : It will transfer the number [N°] of credits to the system;

    ONLY FOR GODS:
  • /changecredits, [player], [N°] : You can add [N°] credits or remove [N°] credits from the player [player] using this command, to remove credits, just put negative on the [N°];
  • /checkcredits, [player] : Using this command you check how many credits the player [player] has;



Do I have to do something before instaling this system?
Yes, to make impossible to players get Credits Pearls by hunting monsters, you must remove the ID 2143 from the loot of the following creatures:
  • Banshee
  • Blood Crab
  • Death Priest
  • Lich
  • Quara Hydromancer
  • Quara Hydromancer Scout
  • Vashresamun
  • Water Elemental
  • Golgordan
  • Hellgorak
  • Morgaroth
  • Thul
  • Ushuriel


In my otserver, the ID 2143 is white pearl, how can I make it to be Credits Pearl?
First of all, open your server folder, then open the data folder, after that, go to items folder, you will find the document: items.xml, open it, then using CTRL+F, search for the ID 2143, you will see the following:
XML:
<item id="2143" article="a" name="white pearl" plural="white pearls">
        <attribute key="weight" value="20" />
</item>
Modify it to:
XML:
<item id="2143" article="a" name="credits pearl" plural="credits pearls">
        <attribute key="weight" value="20" />
</item>


You said that there is a possibily to player get credits by quests, what is the script?
quest.lua:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local storage = 21459
local credits_prize = 1000
local message = "You have found "..credits_prize.." credits"

      if getPlayerStorageValue(cid, storage) ~= 1 then
         doSendMagicEffect(getCreaturePosition(cid), 12)
         doPlayerSendTextMessage(cid, 25, message)
         setPlayerStorageValue(cid, 11111, getPlayerStorageValue(cid, 11111)+credits_prize)
         setPlayerStorageValue(cid, storage, 1)
      else
         doSendMagicEffect(getCreaturePosition(cid), 2)
         doPlayerSendTextMessage(cid, 25, "It is empty")
      end
return true
end
NOT TESTED!



How can I install the system?
talkactions.xml:
XML:
<talkaction log="yes" words="/changecredits" access="3" event="script" value="changecredits.lua"/>
<talkaction log="yes" words="/checkcredits" access="3" event="script" value="checkcredits.lua"/>
<talkaction words="!credits" event="script" value="credits.lua"/>

SERVER FOLDER -> TALKACTIONS -> SCRIPTS..
Create the following documents:
credits.lua:
Lua:
function onSay(cid, words, param)

         local pearl_value = 100
         local buylist = {
         {id = 2472, quant = 1, price = 18000, description = "This is the best armor avaible in Tibia"},
         {id = 2152, quant = 10, price = 100, description = "Each of this has the same valor of 100 Gold Coins"},
         {id = 2152, quant = 50, price = 500, description = "Each of this has the same valor of 100 Gold Coins"},
         {id = 2160, quant = 1, price = 1000, description = "Each of this has the same valor of 10000 Gold Coins"},
         {id = 2160, quant = 5, price = 4000, description = "Each of this has the same valor of 10000 Gold Coins"},
         {id = 2160, quant = 20, price = 15000, description = "Each of this has the same valor of 10000 Gold Coins"},
         {id = 6132, quant = 1, price = 32500, description = "This is boots give you faster regeneration"},
         {id = 2173, quant = 1, price = 5000, description = "If you die using this amulet you will not lose any itens, unless you are Red Skull"},
         {id = 2268, quant = 100, price = 900, description = "These runes are the most powerful runes on the Tibian World"},
         {id = 2195, quant = 1, price = 3000, description = "Wearing this pair of boots your speed will be improved"},
         {id = 6529, quant = 100, price = 2000, description = "Those bolts were made at the demon forge"},
         {id = 2273, quant = 100, price = 700, description = "Only these might runes can heal a brave warrior in the battlefield"}
         }

         local string = string.explode(param, ",")
         local points = getPlayerStorageValue(cid, 11111) + 1         
         local popupmsg = "Credits System\n\nCurrent credits in the system:               "..points.."\nTo check our offerts:                                !credits offers\nTo buy any offert:                                    !credits buy, [OFFER NUMBER]\nTo see more details of any offert:       !credits details, [OFFER NUMBER]\n\n---------------\nTransfering Credits:\n\nThis system has a feature that you can transfer your credits ingame, so you can trade them with other players, check some more information:\nPlease note that you must have the required quantity of credits in THE SYSTEM in order to buy anything!\n\n\nValue by pearl:                                                       Each pearl is equal to "..pearl_value.." credits\nTo transfer credits to the game:                     !credits withdraw, [NUMBER OF CREDITS]\nTo transfer credits to the system:                 !credits deposit, [NUMBER OF CREDITS]"


  if param == "" then
     doPlayerPopupFYI(cid, popupmsg)
     return true
  end
  
  if param == 'offers' then
     for var = 1, #buylist do
         doPlayerSendTextMessage(cid, 19, "Offer #"..var..": "..buylist[var].quant.." "..getItemNameById(buylist[var].id).." ["..buylist[var].price.." Credits]")
     end
     return true
  end


  if string[1] == "buy" then
        if tonumber(string[2]) <= #buylist then
           if points >= buylist[tonumber(string[2])].price then
              doPlayerAddItem(cid, buylist[tonumber(string[2])].id, buylist[tonumber(string[2])].quant)
              doSendMagicEffect(getCreaturePosition(cid), 12)
              doPlayerSendTextMessage(cid, 19, "You just have spent "..buylist[tonumber(string[2])].price.." credits to buy "..buylist[tonumber(string[2])].quant.." "..getItemNameById(buylist[tonumber(string[2])].id.."."))
              setPlayerStorageValue(cid, 11111, getPlayerStorageValue(cid, 11111)-buylist[tonumber(string[2])].price)
           else
           doPlayerSendTextMessage(cid, 18, "You don't have "..buylist[tonumber(string[2])].price.." credits in the system to buy the offer #"..string[2].."")
           end
        else
        doPlayerSendTextMessage(cid, 18, "There isn't an offer with ID #"..string[2])
        end                                                                                                                                                                                                                                                                                                                                                                                                                      -- "..getItemDescriptionsById(buylist[tonumber(string[2])].id)..".")
  end
  
  if string[1] == "details" then
        if tonumber(string[2]) <= #buylist then                                                                                                                                                                                                                                                                                                                                                    
        doSendMagicEffect(getCreaturePosition(cid), 12)
        doShowTextDialog(cid, buylist[tonumber(string[2])].id, "General Information:\n\nOffer Number: "..string[2].."\nOffer Price: "..buylist[tonumber(string[2])].price.." credits\nOffer Name: "..buylist[tonumber(string[2])].quant.." "..getItemNameById(buylist[tonumber(string[2])].id).."\nWords to buy it: !credits buy, "..string[2].."\n\n\n----------------\nDetailed Information:\n\nItem Name: "..getItemNameById(buylist[tonumber(string[2])].id).." \nItem Quantity: "..buylist[tonumber(string[2])].quant.." unit(s)\nItem Weight: "..math.ceil(getItemWeightById(buylist[tonumber(string[2])].id, buylist[tonumber(string[2])].quant, 3)).." oz. aprox\nDescription: "..buylist[tonumber(string[2])].description.."\n")
        else
        doPlayerSendTextMessage(cid, 18, "There isn't an offer with ID #"..string[2])
        end   
  end
  
  if string[1] == "withdraw" then
     if string[2] ~= '' and string[2] ~= nil then
      if math.fmod(tonumber(string[2]), pearl_value) == 0 then
        if points >= tonumber(string[2]) then                                                                                                                                                                                                                                                                                                                                                    
        doSendMagicEffect(getCreaturePosition(cid), 12)
        doPlayerSendTextMessage(cid, 18, "You have transfered "..string[2].." credit(s) into the game")
        doPlayerAddItem(cid, 2143, (tonumber(string[2])/pearl_value))
        setPlayerStorageValue(cid, 11111, getPlayerStorageValue(cid, 11111)-tonumber(string[2]))
        else
        doPlayerSendTextMessage(cid, 18, "You do not have "..string[2].." credits in the system to transfer to game")
        end  
      else
      doSendMagicEffect(getCreaturePosition(cid), 2)
      doPlayerSendTextMessage(cid, 18, "We only accept to transfer multiples of "..pearl_value.." in order to transfer to the game")
      end
     else
     doSendMagicEffect(getCreaturePosition(cid), 2)
     doPlayerSendTextMessage(cid, 18, "Parameter with the number of the credits to transfer is required!")
     end 
  end

  
   if string[1] == "deposit" then
      if string[2] ~= '' and string[2] ~= nil then
       if math.fmod(tonumber(string[2]), pearl_value) == 0 then
         if (getPlayerItemCount(cid, 2143)*pearl_value) >= tonumber(string[2]) then                                                                                                                                                                                                                                                                                                                                                    
         doSendMagicEffect(getCreaturePosition(cid), 12)
         doPlayerSendTextMessage(cid, 18, "You have transfered "..string[2].." credit(s) to the system")
         doPlayerRemoveItem(cid, 2143, (tonumber(string[2])/pearl_value))
         setPlayerStorageValue(cid, 11111, getPlayerStorageValue(cid, 11111)+tonumber(string[2]))
        else
        doPlayerSendTextMessage(cid, 18, "You do not have "..string[2].." credits in game to transfer to the system")
        end  
      else
      doSendMagicEffect(getCreaturePosition(cid), 2)
      doPlayerSendTextMessage(cid, 18, "We only accept to transfer multiples of "..pearl_value.." in order to transfer to the game")
      end
     else
     doSendMagicEffect(getCreaturePosition(cid), 2)
     doPlayerSendTextMessage(cid, 18, "Parameter with the number of the credits to transfer is required!")
     end 
  end
  

return true
end


changecredits.lua:
Lua:
function onSay(cid, words, param)

local string = string.explode(param, ",")
 
 
if param == "" then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
end
 
if string[1] == "" or string[1] == nil then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player param required.")
end
 
if string[2] == "" or string[2] == nil then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Credits quantity param required.")
end

if isPlayer(getPlayerByName(string[1])) then
                                        setPlayerStorageValue(getPlayerByName(string[1]), 11111, getPlayerStorageValue(getPlayerByName(string[1]), 11111)+(tonumber(string[2])))
                                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have modyfied the credits of "..string[1].." by "..(tonumber(string[2])).." credits")
                                        doPlayerSendTextMessage(getPlayerByName(string[1]), MESSAGE_STATUS_CONSOLE_BLUE, "You have your credits modyfied by "..(tonumber(string[2])).." credits")
                                        doSendMagicEffect(getPlayerPosition(cid), 14)
else
                                        doSendMagicEffect(getPlayerPosition(cid), 2)
                                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player "..string[1].." not found")
end


return true
end


checkcredits.lua:
Lua:
function onSay(cid, words, param)

local string = string.explode(param, ",")
 
 
if param == "" then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player param required.")
end
 

if isPlayer(getPlayerByName(param)) then
                                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The player "..param.." has "..getPlayerStorageValue(getPlayerByName(param), 11111) + 1 .." credits")
else
                                        doSendMagicEffect(getPlayerPosition(cid), 2)
                                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player "..string[1].." not found")
end


return true
end


How can I add more offerts?
In the script credits.lua, go to the table buylist and add more minor tables, like this:[/B]
Lua:
{id = ITEMID, quant = ITEMQUANTITY, price = ITEMPRICE, description = "ITEMDESCRIPTION"}



I want to see images!
Here they are:
H1E5yS.png


IZblN9.png


OKtUte.png


UEZAtS.png


9oJdja.png


_SEAH7.png


EkO5Tt.png

Any error report to me please!
 
i have to say this is pretty amazing, great work! keep it up im looking forward to more scripts from you :)
 
Very nice script, but personally I would like to change the tokens to something extraodinary :p
Thanks for sharing! :)
 
I ask for help to get new features to this system, if anyone has an sugestion, please post it here, I'll update the system with the sugestion asap! Thanks
 
Back
Top