• 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 Easy Donator Buying!

Jesper_Kladden

Donator
Joined
May 16, 2008
Messages
458
Reaction score
1
Location
Sweden
PHP:
<talkaction words="!buy" script="DonatorBuying.lua" />

That's what should be in Talkactions.xml ^

This one should be called "DonatorBuying.lua" V

PHP:
--[[

This script is made by Jesper_Kladden @ Tpforums, TibiaTek, Otf4ns or Otland.

Use this script only if you have experience in other scripts.

Thanks to Master-M, Evil Hero, and Colandus for helping.

]]--

-- Configuration --

local DonationValue = 666 -- The special storage value a Donator has (Can't be higher than 65.000(65k)).
local AOL = 2173 -- Amulet of loss
local BPH = 2365 -- BackPack of holding
local BOH = 2195 -- Boots of haste
local SBOOTS = 2640 -- Soft Boots
local AOLP = 20000 -- Price of AOL
local BPHP = 100000 -- Price of Backpack of holding
local BOHP = 50000 -- Price of BOH
local SBOOTSP = 1000000 -- Price of Soft Boots

-- End Configuration --

function onSay(cid, word, param)

setPlayerStorageValue(cid, DonationValue, 1) --<- I used this for testing if it works. Delete if you don't want to test

   if getPlayerStorageValue(cid, DonationValue) == 1 then
   
		if param == "aol" and doPlayerRemoveMoney(cid, AOLP) == TRUE then
			doPlayerAddItem(cid, AOL, 1)
			
		elseif param == "boh" and doPlayerRemoveMoney(cid, BOHP) == TRUE then
			doPlayerAddItem(cid, BOH, 1)
			
		elseif param == "bpholding" and doPlayerRemoveMoney(cid, BPHP) == TRUE then
			doPlayerAddItem(cid, BPH, 1)	
			
		elseif param == "softboots" and doPlayerRemoveMoney(cid, SBOOTSP) == TRUE then
			doPlayerAddItem(cid, SBOOTS, 1)
			
		elseif param == "prices" then
			doPlayerSendTextMessage(cid, 22,
			"Prices for Donation-Fast-Buyment:\n--------\n Boots of haste(boh) - 50k\n Amulet of loss(aol) - 20k\n Backpack of holding (bpholding) - 100k\n Soft Boots (softboots) - 1kk(1000k)\n--------\n Script created by 'Jesper_Kladden'")
			
		  else 
            doPlayerSendTextMessage(cid, 22, "Either a bad code or not enough money!") 
        end 
    else      
      doPlayerSendTextMessage(cid, 22, "You are not a donator!") 
    end 
		end
	end
end


The script works like this:

*You must be a donator and have a certain storagevalue
*You can write either - !buy "aol/boh/softboots/bpholding
*If you can't afford, the script will tell you that
*If you're not a donator, the script will tell you that.


Master Programs <-- Please take a visit.
 
Last edited:
Can someone help me getting the IDs for:

*BoH
*BP of Holding
*Soft Boots.


Thanks
 
Last edited:
Added some "elses" to the script you made:

PHP:
--[[

This script is made by Jesper_Kladden @ Tpforums, TibiaTek, Otf4ns or Otland.

Use this script only if you have experience in other scripts.

Thanks to Master-M, Evil Hero, and Colandus for helping.

]]--

-- Configuration --

local DonationValue = 666 -- The special storage value a Donator has (Can't be higher than 65.000(65k)).
local AOL = 2173 -- Amulet of loss
local BPH = 2365 -- BackPack of holding
local BOH = 2195 -- Boots of haste
local SBOOTS = 2640 -- Soft Boots
local AOLP = 20000 -- Price of AOL
local BPHP = 100000 -- Price of Backpack of holding
local BOHP = 50000 -- Price of BOH
local SBOOTSP = 1000000 -- Price of Soft Boots

-- End Configuration --

function onSay(cid, word, param)

setPlayerStorageValue(cid, DonationValue, 1) --<- I used this for testing if it works. Delete if you don't want to test

	if getPlayerStorageValue(cid, DonationValue) == 1 then
		if param == "aol" and doPlayerRemoveMoney(cid, AOLP) == TRUE then
            doPlayerAddItem(cid, AOL, 1)
		elseif param == "boh" and doPlayerRemoveMoney(cid, BOHP) == TRUE then
            doPlayerAddItem(cid, BOH, 1)
            
        elseif param == "bpholding" and doPlayerRemoveMoney(cid, BPHP) == TRUE then
            doPlayerAddItem(cid, BPH, 1)    
            
        elseif param == "softboots" and doPlayerRemoveMoney(cid, SBOOTSP) == TRUE then
            doPlayerAddItem(cid, SBOOTS, 1)
            
        elseif param == "prices" then
            doPlayerSendTextMessage(cid, 22,
            "Prices for Donation-Fast-Buyment:\n--------\n Boots of haste(boh) - 50k\n Amulet of loss(aol) - 20k\n Backpack of holding (bpholding) - 100k\n Soft Boots (softboots) - 1kk(1000k)\n--------\n Script created by 'Jesper_Kladden'")
            
        else
            doPlayerSendTextMessage(cid, 22, "Wrong param or not enough money!!")
        end
	else     
      doPlayerSendTextMessage(cid, 22, "You are not a donator!")
	end
end

Change:

This:
PHP:
else
            doPlayerSendTextMessage(cid, 22, "Wrong param or not enough money!!")
        end

To this:

PHP:
        else
            doPlayerSendTextMessage(cid, 22, "Wrong param or not enough money!!")
        end
	else     
      doPlayerSendTextMessage(cid, 22, "You are not a donator!")
	end
 
This is my (not tested) version of the script. You can add and remove items more easy....

Code:
local Test = "yes" -- Can be yes/no.
local DonationValue = 666 -- The special storage value a Donator has (Can't be higher than 65.000(65k)).
local Items = 
{
aol = {2173, 1, 20000}, -- Example of an item. "Itemid, count, price"
itemtwo = {2175, 1, 20000}, -- Example of an item. "Itemid, count, price"
anotheritem = {2176, 4, 20000}, -- Example of an item. "Itemid, count, price"
blablabla = {2177, 1, 20000} -- Example of an item. "Itemid, count, price"
}
function onSay(cid, word, param)
local paramitem = {param} -- Don't touch this!
	if Test == "yes" then
		setPlayerStorageValue(cid, DonationValue, 1)
	end

	if getPlayerStorageValue(cid, DonationValue) == 1 then
		if not(param == nil) then
			if param == Items.[paramitem] then
				if doPlayerRemoveMoney(cid, Items.[paramitem][3]) == TRUE then
					doPlayerAddItem(cid, Items.[paramitem][1], Items.[paramitem][2])
				else 
					doPlayerSendTextMessage(cid, 22, "You do not have enough money to buy this item!") 
				end
			else 
				doPlayerSendTextMessage(cid, 22, "You cannot buy that item!") 
			end
		else 
			doPlayerSendTextMessage(cid, 22, "Please write what item you want to buy!") 
		end 
	else      
		doPlayerSendTextMessage(cid, 22, "You are not a donator!") 
	end 
return TRUE
end
 
he might have the value as 2 to show vip or smth xd

which means even if he changed it to "> 1" would make it work ^_^
 
Back
Top