• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Add items to SMS shop

PhoOwned

^_^
Joined
Nov 11, 2010
Messages
375
Reaction score
66
When you start ots SMS shop take much time, copy id, item description, paste in acc. maker, add....

Now you can do it in few seconds :w00t: but first you must install my talkaction ^_^

Create ../data/talkactions/scripts/addshoptalkaction.lua and paste:
PHP:
function onSay(cid, words, param, channel)
	local params = string.explode(param, ",")
	local price = params[1]
	table.remove(params, 1)
	local desc = table.concat(params,",")
	local name = ''
	local item1 = getPlayerSlotItem(cid, CONST_SLOT_RIGHT)
	local itemid1 = item1.itemid
	local count1 = item1.type
	local itemid2 = 0
	local count2 = 0
	if(itemid1 == 0) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Put item in right hand.")
		return true
	end
	if(not price) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must set price.")
		return true
	end
	local itemInfo = getItemInfo(itemid1)
	local offer_type = 'item'
	if(isContainer(item1.uid)) then
		local item2 = getContainerItem(item1.uid, 0)
		if(item2.itemid > 0) then
			count1 = getContainerCap(item1.uid)
			itemid2 = item2.itemid
			count2 = item2.type
			offer_type = 'container'
			itemInfo = getItemInfo(itemid2)
		end
	end
	local count1_desc = (count1 > 0) and count1 or 1
	local count2_desc = (count2 > 0) and count2 or 1
	if(itemid2 == 0) then
		name = count1_desc .. 'x ' .. itemInfo.name
	else
		name = count1_desc .. 'x ' .. count2_desc .. 'x ' .. itemInfo.name
	end
	db.executeQuery('INSERT INTO `z_shop_offer` (`id` ,`points` ,`itemid1` ,`count1` ,`itemid2` ,`count2` ,`offer_type` ,`offer_description` ,`offer_name` ,`pid`) VALUES (NULL , ' .. price .. ', ' .. itemid1 .. ', ' .. count1 .. ', ' .. itemid2 .. ', ' .. count2 .. ', \'' .. offer_type .. '\', ' .. db.escapeString(desc) .. ', ' .. db.escapeString(name) .. ', 0);')
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item >> " .. name .. " << added to SMS shop. Price is " .. price .. " premium points.")
	return true
end
In ../data/talkactions/talkactions.xml add line:
PHP:
<talkaction log="yes" words="/addshop" access="5" event="script" value="addshoptalkaction.lua"/>
In game:
Put item/backpack [it will add full backpack of first item in backpack when player buy] that you want add in your right hand:
86418518.jpg

In game you say /addshop price or /addshop price, D e( ee'e') sc,ri p, tio n:
consl.jpg

Then in SMS shop it show (my version of SMS shop do not show containers :S ):
shopwy.jpg


Now you only have to add images :)

I hope it help many server admins. Report bugs in this thread.
 
Last edited:
lol very nice script, rep ++
maybe first on the otland?first on the internet?
very nice big gz
 
If you have any ideas send me PM. I will try to script them and post :)

My next script will be !screen, command that copy all items,monsters,players info [IP] and positions from player screen to database and PHP script that generate .jpg (to show GM what happend).
 
C++, and lua are way different.
Ye. C++ functions/objects/variables have normal names in TFS - don't change every new release ;)

EDIT:
Don't you think that every TFS release we get same code just with new functions names? :(
As I remember 'war system by elf' was in 0.3.0 beta (on TFS developers private svn), of course without shields because it was for 8.1 or 8.3 client.
Now they call it 'new code' - only for donators...
 
Last edited:
Back
Top