• 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 shop idea

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,766
Solutions
1
Reaction score
225
Location
Chile, Santiago
A few days ago I though about creating "pack-offers" at my shop offer... And now created some packages that if players buy them, they receive a parcel on their depots with the items:



Uploaded with ImageShack.us

What do you think about it?

You don't need to worry about the cap of players, since it will go to the depot.
 
Here's the script for this shop system if anyone needs it.
Lua:
function onThink(interval, lastExecution, thinkInterval)
local result = db.getResult("SELECT * FROM shop_history WHERE `processed` = 0;")
	if(result:getID() ~= -1) then
		while(true) do
			cid = getCreatureByName(tostring(result:getDataString("player")))
			product = tonumber(result:getDataInt("product"))
			itemr = db.getResult("SELECT * FROM shop_offer WHERE `id` = "..product..";")
			if isPlayer(cid) then
				local id, tid, count, prudctn, x = tonumber(itemr:getDataInt("item")), tonumber(result:getDataInt("id")), tonumber(itemr:getDataInt("count")), tostring(itemr:getDataString("name")), doCreateItemEx(2595)
				doAddContainerItem(x, id, count)
				doPlayerSendTextMessage(cid, 21, prudctn.." has been sent to your hometown depot!")
				doPlayerSendMailByName(getCreatureName(cid), x, getPlayerTown(cid))
				db.executeQuery("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
			end
			itemr:free()
			if not(result:next()) then
				break
			end
		end
		result:free()
	end
return true
end
@ONT
Yeah, it makes the script shorter and avoids people being like "Y I NO GET ITEM, I HAVE CAP" :p
 
Here's the script for this shop system if anyone needs it.
Lua:
function onThink(interval, lastExecution, thinkInterval)
local result = db.getResult("SELECT * FROM shop_history WHERE `processed` = 0;")
	if(result:getID() ~= -1) then
		while(true) do
			cid = getCreatureByName(tostring(result:getDataString("player")))
			product = tonumber(result:getDataInt("product"))
			itemr = db.getResult("SELECT * FROM shop_offer WHERE `id` = "..product..";")
			if isPlayer(cid) then
				local id, tid, count, prudctn, x = tonumber(itemr:getDataInt("item")), tonumber(result:getDataInt("id")), tonumber(itemr:getDataInt("count")), tostring(itemr:getDataString("name")), doCreateItemEx(2595)
				doAddContainerItem(x, id, count)
				doPlayerSendTextMessage(cid, 21, prudctn.." has been sent to your hometown depot!")
				doPlayerSendMailByName(getCreatureName(cid), x, getPlayerTown(cid))
				db.executeQuery("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
			end
			itemr:free()
			if not(result:next()) then
				break
			end
		end
		result:free()
	end
return true
end
@ONT
Yeah, it makes the script shorter and avoids people being like "Y I NO GET ITEM, I HAVE CAP" :p

Only for Modern Acc?
 
Here's the script for this shop system if anyone needs it.
Lua:
function onThink(interval, lastExecution, thinkInterval)
local result = db.getResult("SELECT * FROM shop_history WHERE `processed` = 0;")
	if(result:getID() ~= -1) then
		while(true) do
			cid = getCreatureByName(tostring(result:getDataString("player")))
			product = tonumber(result:getDataInt("product"))
			itemr = db.getResult("SELECT * FROM shop_offer WHERE `id` = "..product..";")
			if isPlayer(cid) then
				local id, tid, count, prudctn, x = tonumber(itemr:getDataInt("item")), tonumber(result:getDataInt("id")), tonumber(itemr:getDataInt("count")), tostring(itemr:getDataString("name")), doCreateItemEx(2595)
				doAddContainerItem(x, id, count)
				doPlayerSendTextMessage(cid, 21, prudctn.." has been sent to your hometown depot!")
				doPlayerSendMailByName(getCreatureName(cid), x, getPlayerTown(cid))
				db.executeQuery("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
			end
			itemr:free()
			if not(result:next()) then
				break
			end
		end
		result:free()
	end
return true
end
@ONT
Yeah, it makes the script shorter and avoids people being like "Y I NO GET ITEM, I HAVE CAP" :p

I made it after login, since on that way I found a bug to duplicate the items, since depot just save on server save... So I made a "setstoragevalue" and when login, the items are sent and the storage is reseted.

Why not just send the sets in a backpack aka container?

Since those sets sometimes needs a lot of weight and you can't get them instantly.
 
@kito
I've got a better shop system, u get points online, u do !buy container1 for example, it checks for the cap then add container :p
 
@kito
I've got a better shop system, u get points online, u do !buy container1 for example, it checks for the cap then add container :p

I tried to do the same as you, but since it is a pack with a set, sometimes player doesn't have enought cap, and it gets a spamm on console every 30 seconds telling them that they don't have cap... It is annoying.

That's why I managed to do this system to parcel the items to the depot, so they can take one by one without problem.

Somehow the commands in game are good, so I will copy your idea.


Thanks.
 
Mine doesnt work like that though... Not every 30 seconds, he says !buy c1 and it says ONCE our don't have enough cap and it doesn't remove the points, he frees some caps then redo it! :p
 
Nice way of using a shop system Joseph, but I think it is more formal, serious a server that you interactue with the website.
 
No difference, in-game will remove points, add in a logs file what has been bought, add to shop history in SQL the stuff bought so the user can check on site :)

@edit
Safer in-game and easier, as you said ppl can duplicate somehow, so just follow the easy way :)
 
Back
Top