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

Gesior ITEM/PACC Shop (PHP+LUA) for TFS

Status
Not open for further replies.
I have one problem.
Database error - can't connect to MySQL database. Possible reasons:
1. MySQL server is not running on host.
2. MySQL user, password, database or host isn't configured in: C:/TFS/config.lua .
3. MySQL user, password, database or host is wrong.

How can i repair it? I use webserv WebServ 2.0. and TFS i compile with lastest source.
 
you must copy all raport and send to forum!
 
How can i coppy all report? I think that all settgins is correct, but i can't install it and connect to mysql server. Why? i use webserv 2.0 FINAL please help me and sorry for my english.

Ok i just slove this problem. I forget active lib PDO_MYSQL

I have next problem if i buy any items and relog my server crash. Why?

it is my login.lua
Code:
dofile("./config.lua")
function onLogin(cid)
	if sqlType == "mysql" then
		env = assert(luasql.mysql())
		con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
	else -- sqlite
		env = assert(luasql.sqlite3())
		con = assert(env:connect(sqliteDatabase))
	end
	local name = getCreatureName(cid)
	local nametodb = escapeString(name)
        result_plr = assert(con:execute("SELECT * FROM z_ots_comunication WHERE `type` = 'login' AND name = '".. nametodb .."';"))
        todo = result_plr:fetch({}, "a")
        while todo do
			id = tonumber(todo.id)
            action = tostring(todo.action)
			delete = tonumber(todo.delete_it)
			if action == 'show_msg' then
				local msg_text = tostring(todo.param1)
				local msg_type = todo.param2
				doPlayerSendTextMessage(cid, msg_type, msgtext)
				if delete == 1 then
					delete = assert(con:execute("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";"))
				end
			elseif action == 'give_item' then
				local itemtogive_id = tonumber(todo.param1)
				local itemtogive_count = tonumber(todo.param2)
				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 addeditem = doPlayerAddItem(cid, itemtogive_id, itemtogive_count)
					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, 17, '"'..getItemName(itemtogive_id)..'" from "OTS shop" added. Please re-login now to save item!')
						delete = assert(con:execute("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";"))
						else
							doPlayerSendTextMessage(cid, 17, '"'..getItemName(itemtogive_id)..'" from "OTS shop" not added. Unknown error occured. Re-login again or contact with admin.')
						end
					else
						doPlayerSendTextMessage(cid, 17, '"'..getItemName(itemtogive_id)..'" from "OTS shop" not added. Unknown error occured. Re-login again or contact with admin.')
					end
				else
					doPlayerSendTextMessage(cid, 17, 'Item from "OTS shop" is waiting for you. Please take items from both hands or item from arrow slot and re-login to get item.')
				end

			end
            todo = result_plr:fetch (todo, "a")
        end
	registerCreatureEvent(cid, "PlayerDeath")
	return TRUE
end
 
Last edited:
Status
Not open for further replies.
Back
Top