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

Ver. 0.1.0 - Gesior ITEM/PACC Shop (PHP+LUA) for TFS

Hello Gesior....

I have one problem...

When I go buy some iten, the character receives no message (online).
I do not receive any items purchased by the shop system.

To: From: Offer name Bought on page Received on OTS
Farquadi Your account 50x Chicken Feather 29 May 2008, 14:51:01 Not realized yet.
 
Hello, I adapt it for trunk version. (0.3)

code here:
Code:
-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 17
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
SQL_COMUNICATION_INTERVAL = SQL_interval * 1000
function onLogin(cid)
	if(InitShopComunication == 0) then
		local eventServ = addEvent(sql_communication, SQL_COMUNICATION_INTERVAL, {})
		InitShopComunication = eventServ
	end
	
	registerCreatureEvent(cid, "PlayerDeath")
	
	return TRUE
end

function sql_communication(parameters)
	
	target = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
	if(target:getID()== -1)then
--Do nothing when table is empty
    else
		id = target:getDataInt("id")
		action = target:getDataString("action")
		delete = target:getDataInt("delete_it")
		cid = getPlayerByName(target:getDataString("name"))
	  
			if isPlayer(cid) == TRUE then
				if action == 'show_msg' then
					local msg_text = target:getDataString("param1")
					local msg_type = target:getDataString("param2")
					doPlayerSendTextMessage(cid, msg_type, msgtext)
					if delete == 1 then
						delete = db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
					end
				elseif action == 'give_item' then
					local itemtogive_id = target:getDataInt("param1")
					local itemtogive_count = target:getDataInt("param2")
					local container_id = target:getDataInt("param3")
					local container_count = target:getDataInt("param4")
					local add_item_type = target:getDataString("param5")
					local add_item_name = target:getDataString("param6")
					local b_head_slot = getPlayerSlotItem(cid, 1)
					local b_necklace_slot = getPlayerSlotItem(cid, 2)
					local b_backpack_slot = getPlayerSlotItem(cid, 3)
					local b_armor_slot = getPlayerSlotItem(cid, 4)
					local b_right_hand = getPlayerSlotItem(cid, 5)
					local b_left_hand = getPlayerSlotItem(cid, 6)
					local b_legs_slot = getPlayerSlotItem(cid, 7)
					local b_feet_slot = getPlayerSlotItem(cid, 8)
					local b_ring_slot = getPlayerSlotItem(cid, 9)
					local b_arrow_slot = getPlayerSlotItem(cid, 10)
					if b_arrow_slot.itemid == 0 or (b_left_hand.itemid == 0 and b_right_hand.itemid == 0) then
						local full_weight = 0
						if add_item_type == 'container' then
							container_weight = getItemWeight(container_id, 1)
							items_weight = container_count * getItemWeight(itemtogive_id, itemtogive_count)
							full_weight = items_weight + container_weight
						else
							full_weight = getItemWeight(itemtogive_id, itemtogive_count)
						end
						local free_cap = getPlayerFreeCap(cid)
						if full_weight <= free_cap then
							if add_item_type == 'container' then
								local new_container = doCreateItemEx(container_id)
								local iter = 0
								while iter ~= container_count do
									doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
									iter = iter + 1
								end
								doPlayerAddItemEx(cid, new_container)
								itemtogive_id = container_id
							else
								local addeditem = doPlayerAddItem(cid, itemtogive_id, itemtogive_count)
							end
							local head_slot = getPlayerSlotItem(cid, 1)
							local necklace_slot = getPlayerSlotItem(cid, 2)
							local backpack_slot = getPlayerSlotItem(cid, 3)
							local armor_slot = getPlayerSlotItem(cid, 4)
							local right_hand = getPlayerSlotItem(cid, 5)
							local left_hand = getPlayerSlotItem(cid, 6)
							local legs_slot = getPlayerSlotItem(cid, 7)
							local feet_slot = getPlayerSlotItem(cid, 8)
							local ring_slot = getPlayerSlotItem(cid, 9)
							local arrow_slot = getPlayerSlotItem(cid, 10)
							if ring_slot.itemid == itemtogive_id or feet_slot.itemid == itemtogive_id or legs_slot.itemid == itemtogive_id or armor_slot.itemid == itemtogive_id or necklace_slot.itemid == itemtogive_id or head_slot.itemid == itemtogive_id or arrow_slot.itemid == itemtogive_id or left_hand.itemid == itemtogive_id or right_hand.itemid == itemtogive_id or backpack_slot.itemid == itemtogive_id then
								if b_ring_slot.uid ~= ring_slot.uid or b_feet_slot.uid ~= feet_slot.uid or b_legs_slot.uid ~= legs_slot.uid or b_armor_slot.uid ~= armor_slot.uid or b_necklace_slot.uid ~= necklace_slot.uid or b_head_slot.uid ~= head_slot.uid or b_backpack_slot.uid ~= backpack_slot.uid or b_right_hand.uid ~= right_hand.uid or b_left_hand.uid ~= left_hand.uid or b_arrow_slot.uid ~= arrow_slot.uid then
								doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop. You should re-login now to become sure your new item will not disappear if any error occur.')
								delete = db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
									db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
								else
									doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop not added. Unknown error occured. Wait about '.. SQL_interval ..' seconds. If error will occur again contact with admin. Error item ID is: '.. id ..'')
								end
							else
								doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop not added. Unknown error occured. Wait about '.. SQL_interval ..' seconds. If error will occur again contact with admin. Error item ID is: '.. id ..'')
							end
						else
							doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot or give to friend and wait about '.. SQL_interval ..' seconds to get it.')
						end
						
						
					else
						doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please take items from both hands or item from arrow slot and wait about '.. SQL_interval ..' seconds to get it.')
					end
				end
				target:free()
			end

	end
	local eventServ = addEvent(sql_communication, SQL_COMUNICATION_INTERVAL, parameters)
	
end
I tested (on trunk server rev. 845) it work good if have any problem write in this topic

All credits for Gesior.pl

//Sory for my english
@Binho test and write here is it works
 
Last edited:
No working... ;(((

Same problem.
The message is no sended...
And on transfer historic of red "Not received/realized yet"
 
does anyone know how to get this working for the latest rev.. because they took out luasql :S so what are we supposed to do now.
 
hello i have problem with it;/
can somebody help me? ;/ i need fast help bacouse i have cash for dedicaded server and i cant host on ots where this scritp dont work;/
[30/05/2008 13:37:02] Warning: [Event::loadScript] Can not load script. data/creaturescripts/scripts/login.lua
[30/05/2008 13:37:02] data/creaturescripts/scripts/login.lua:111: 'end' expected (to close 'function' at line 17) near '<eof>'
 
Leave Gesior alone, if he dont post here fixed login.lua then he cant fix that... also he forget about this topic. Try to send him PM. Maybe he will answer O_O.

I got an idea, how to live without this craping shop.

For example get script like this:

--------------------------- Start Config ----------------------------
local COUNT = 3 -- How many items you get.
local ITEMID = 2160 -- Item sold id.
local PDAYS = 1 -- The premium days lost on use.
----------------------------- End Config -----------------------------
function onUse(cid, item, fromPos, item2, toPos)
if item.actionid == 29002 and item.itemid == 1945 then
if getPlayerPremiumDays(cid) >= PDAYS then
doPlayerAddItem(cid, ITEMID, COUNT)
doPlayerRemovePremiumDays(cid, PDAYS)
doPlayerSendTextMessage(cid, 22, "You have buy 30k for 3 premium account days.")
doSendMagicEffect(getPlayerPosition(cid), 55)
doTransformItem(item.uid,1946)
else
doPlayerSendTextMessage(cid, 22, "You dont have enough premium days left.")
end
else
doTransformItem(item.uid, 1945)
end
end

And then player buy x premium days for x premium points, if he bought premium then he go to the chest or something like that and open it for x premium days.

For example:

You see a chest.
You dont have enought premium days to open it.
<boughting premium days>
Item xx added, thank you for transaction.


How do you like that?
 
Last edited:
does anyone know how to get this working for the latest rev.. because they took out luasql :S so what are we supposed to do now.
Elf rewriten login.lua script for LUA without SQL :)
I must ask him again for link, test on new trunk rev and post.
Leave Gesior alone, if he dont post here fixed login.lua then he cant fix that... also he forget about this topic. Try to send him PM. Maybe he will answer O_O.

***

For example:

You see a chest.
You dont have enought premium days to open it.
<boughting premium days>
Item xx added, thank you for transaction.
How do you like that?
Now you call this script "crappy" because you don't know how to fix it. You was first user of this script and call it "very nice, thx" From time when I blocked you in all communicators you call all my scripts "crappy". I will never help you and recommend all to not help Ronaldinho. At start he is nice to you when you give him new scripts/fix his scripts(scripts downlaoded from forum with bugs), when you ignore him he say "f*** you noob, you are noobish scripter, you dont know how to make it". Don't ask him for any script because he isn't a scripter and he always want something for scripts used on his server.
Our pro0 called Elf noobish scripter ;) Ignore him when he ask you for something...
 
Ronaldino stop thiefing the credits
PHP:
-- Credits 100% to Clary
--------------------------- Start Config ----------------------------
local COUNT = 3 -- How many items you get.
local ITEMID = 2160 -- Item sold id.
local PDAYS = 1 -- The premium days lost on use.
----------------------------- End Config -----------------------------
function onUse(cid, item, fromPos, item2, toPos)
if item.actionid == 29002 and item.itemid == 1945 then
if getPlayerPremiumDays(cid) >= PDAYS then
doPlayerAddItem(cid, ITEMID, COUNT)
doPlayerRemovePremiumDays(cid, PDAYS)
doPlayerSendTextMessage(cid, 22, "You have buy 30k for 3 premium account days.")
doSendMagicEffect(getPlayerPosition(cid), 55)
doTransformItem(item.uid,1946)
else
doPlayerSendTextMessage(cid, 22, "You dont have enough premium days left.")
end
else
doTransformItem(item.uid, 1945)
end
end
I made the script for a guy in the request section.
 
Ronaldino stop thiefing the credits
PHP:
-- Credits 100% to Clary
--------------------------- Start Config ----------------------------
local COUNT = 3 -- How many items you get.
local ITEMID = 2160 -- Item sold id.
local PDAYS = 1 -- The premium days lost on use.
----------------------------- End Config -----------------------------
function onUse(cid, item, fromPos, item2, toPos)
if item.actionid == 29002 and item.itemid == 1945 then
if getPlayerPremiumDays(cid) >= PDAYS then
doPlayerAddItem(cid, ITEMID, COUNT)
doPlayerRemovePremiumDays(cid, PDAYS)
doPlayerSendTextMessage(cid, 22, "You have buy 30k for 3 premium account days.")
doSendMagicEffect(getPlayerPosition(cid), 55)
doTransformItem(item.uid,1946)
else
doPlayerSendTextMessage(cid, 22, "You dont have enough premium days left.")
end
else
doTransformItem(item.uid, 1945)
end
end
I made the script for a guy in the request section.

AHAHAH, really HARD code man O_O, 5 minutes of work. HAHA pwned. Ok 70% credis to CLARY for begginer script. Why 70% look at this thread where that guy requested that.
 
:/ who said it is hard work..
1min of work or less
but I hate credits stealing generally...
 
Leave Gesior alone, if he dont post here fixed login.lua then he cant fix that... also he forget about this topic. Try to send him PM. Maybe he will answer O_O.

I got an idea, how to live without this craping shop.

For example get script like this:



And then player buy x premium days for x premium points, if he bought premium then he go to the chest or something like that and open it for x premium days.

For example:

You see a chest.
You dont have enought premium days to open it.
<boughting premium days>
Item xx added, thank you for transaction.


How do you like that?


You don't mess with THE ZOHAN!!

i mean Gesior ^_^

Seriously leave him alone he always help us.

Gesior plx make this work for 0.3 TFS :D we don't get the orange msg to recieve the item
 
You don't mess with THE ZOHAN!!

i mean Gesior ^_^

Seriously leave him alone he always help us.

Gesior plx make this work for 0.3 TFS :D we don't get the orange msg to recieve the item

Gesior ALWAYS help us? Are you sure? I'm not, now I'm sure Gesior wont help ya because he dont know how :(. We don't get the orange message? Rotfl, its not enought, we dont receive any items :cool:.
 
Back
Top