• 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 acc. maker][TFS 0.3]Powergamers and online time stats

I didn't get why we should use 0.3 pre-alpha, since I tested here with 0.2.13 and everything worked perfectly o.o
 
I didn't get why we should use 0.3 pre-alpha, since I tested here with 0.2.13 and everything worked perfectly o.o
I tested now and have error:
attempt to index global 'db' (a nil value)

I think this script really need 0.3 TFS
 
Code:
function historyPage(parameters)
	dofile("./config.lua")
	env = assert(luasql.mysql())
	con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
    local historyPage = addEvent(historyPage, 60000, {})
    if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
        setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
        assert(con:execute("UPDATE `players` SET `onlinetime7`=players.onlinetime6, `onlinetime6`=players.onlinetime5, `onlinetime5`=players.onlinetime4, `onlinetime4`=players.onlinetime3, `onlinetime3`=players.onlinetime2, `onlinetime2`=players.onlinetime1, `onlinetime1`=players.onlinetimetoday, `onlinetimetoday`=0;"))
        assert(con:execute("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;"))
    end
    assert(con:execute("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;"))
end

I just modified it so it can be used on the 0.2.x, because the 0.2.x is still using luasql.
 
Code tested on TFS 0.2.13 - work, but you must compile server with parameter:
-D__GLOBAL_STORAGE__
!!!
Code:
function historyPage(parameters)
	dofile("./config.lua")
	env = assert(luasql.mysql())
	con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
    local historyPage = addEvent(historyPage, 60000, {})
    if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
        setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
        assert(con:execute("UPDATE `players` SET `onlinetime7`=players.onlinetime6, `onlinetime6`=players.onlinetime5, `onlinetime5`=players.onlinetime4, `onlinetime4`=players.onlinetime3, `onlinetime3`=players.onlinetime2, `onlinetime2`=players.onlinetime1, `onlinetime1`=players.onlinetimetoday, `onlinetimetoday`=0;"))
        assert(con:execute("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;"))
    end
    assert(con:execute("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;"))
con:close()
env:close()
end
@UP
Emm... close connection?!!??!
else you will get error "Too many connections" after 1.5h and server/server page will not work (can't connect to mysql)!
--------------------
Code tested on TFS 0.2.13 - work!
EDIT:
After 3 days online (uptime 74 hours now) no problem with this script + my shop script on 0.2.13 :)
 
Last edited:
Code tested on TFS 0.2.13 - work, but you must compile server with parameter:
-D__GLOBAL_STORAGE__
!!!
Code:
function historyPage(parameters)
	dofile("./config.lua")
	env = assert(luasql.mysql())
	con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
    local historyPage = addEvent(historyPage, 60000, {})
    if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
        setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
        assert(con:execute("UPDATE `players` SET `onlinetime7`=players.onlinetime6, `onlinetime6`=players.onlinetime5, `onlinetime5`=players.onlinetime4, `onlinetime4`=players.onlinetime3, `onlinetime3`=players.onlinetime2, `onlinetime2`=players.onlinetime1, `onlinetime1`=players.onlinetimetoday, `onlinetimetoday`=0;"))
        assert(con:execute("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;"))
    end
    assert(con:execute("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;"))
con:close()
env:close()
end
@UP
Emm... close connection?!!??!
else you will get error "Too many connections" after 1.5h and server/server page will not work (can't connect to mysql)!
--------------------
Code tested on TFS 0.2.13 - work!
EDIT:
After 3 days online (uptime 74 hours now) no problem with this script + my shop script on 0.2.13 :)



I dont get what and where I shall replace this HistoryPage? Where it is...?? :/
 
I dont get what and where I shall replace this HistoryPage? Where it is...?? :/
Install script for TFS 0.3 and then replace:
PHP:
function historyPage(parameters)
    local historyPage = addEvent(historyPage, 60000, {})
    if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
        setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
        db.executeQuery("UPDATE `players` SET `onlinetime7`=players.onlinetime6, `onlinetime6`=players.onlinetime5, `onlinetime5`=players.onlinetime4, `onlinetime4`=players.onlinetime3, `onlinetime3`=players.onlinetime2, `onlinetime2`=players.onlinetime1, `onlinetime1`=players.onlinetimetoday, `onlinetimetoday`=0;")
        db.executeQuery("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;")
    end
    db.executeQuery("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;")
end
with:
PHP:
function historyPage(parameters)
	dofile("./config.lua")
	env = assert(luasql.mysql())
	con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
    local historyPage = addEvent(historyPage, 60000, {})
    if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
        setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
        assert(con:execute("UPDATE `players` SET `onlinetime7`=players.onlinetime6, `onlinetime6`=players.onlinetime5, `onlinetime5`=players.onlinetime4, `onlinetime4`=players.onlinetime3, `onlinetime3`=players.onlinetime2, `onlinetime2`=players.onlinetime1, `onlinetime1`=players.onlinetimetoday, `onlinetimetoday`=0;"))
        assert(con:execute("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;"))
    end
    assert(con:execute("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;"))
con:close()
env:close()
end
and it should work.
 
ehh :(
when I to link http://localhost/exphist.php there is error:

Fatal error: Call to a member function query() on a non-object in C:\xampp\htdocs\exphist.php on line 21



Also I see this error in console of TFS ;/





this is my login.lua

PHP:
-- ### 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, {}) 
        local historyPage = addEvent(historyPage, 60000, {}) 
        InitShopComunication = eventServ 
    end  
	registerCreatureEvent(cid, "PlayerDeath")
	return TRUE
end
function historyPage(parameters) 
    local historyPage = addEvent(historyPage, 60000, {}) 
    if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then 
        setGlobalStorageValue(23456, (tonumber(os.date("%d")))) 
        db.executeQuery("UPDATE `players` SET `onlinetime7`=players.onlinetime6, `onlinetime6`=players.onlinetime5, `onlinetime5`=players.onlinetime4, `onlinetime4`=players.onlinetime3, `onlinetime3`=players.onlinetime2, `onlinetime2`=players.onlinetime1, `onlinetime1`=players.onlinetimetoday, `onlinetimetoday`=0;") 
        db.executeQuery("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;") 
    end 
    db.executeQuery("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;") 
end  
function sql_communication(parameters)
	dofile("./config.lua")
	env = assert(luasql.mysql())
	con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
        result_plr = assert(con:execute("SELECT * FROM z_ots_comunication WHERE `type` = 'login';"))
        todo = result_plr:fetch({}, "a")
        while todo do
			id = tonumber(todo.id)
            action = tostring(todo.action)
			delete = tonumber(todo.delete_it)
			cid = getPlayerByName(tostring(todo.name))
			if isPlayer(cid) == TRUE then
				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 container_id = tonumber(todo.param3)
					local container_count = tonumber(todo.param4)
					local add_item_type = tostring(todo.param5)
					local add_item_name = tostring(todo.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 = assert(con:execute("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";"))
								assert(con:execute("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
			end
            todo = result_plr:fetch (todo, "a")
        end
	con:close()
	env:close()
	local eventServ = addEvent(sql_communication, SQL_COMUNICATION_INTERVAL, parameters)
end

Gesior please help me with this :<<<
 
Last edited:
Put it in your login.lua
PHP:
-- ### 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, {}) 
        local historyPage = addEvent(historyPage, 60000, {}) 
        InitShopComunication = eventServ 
    end  
	registerCreatureEvent(cid, "PlayerDeath")
	return TRUE
end

function historyPage(parameters)
	dofile("./config.lua")
	env = assert(luasql.mysql())
	con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
    local historyPage = addEvent(historyPage, 60000, {})
    if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
        setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
        assert(con:execute("UPDATE `players` SET `onlinetime7`=players.onlinetime6, `onlinetime6`=players.onlinetime5, `onlinetime5`=players.onlinetime4, `onlinetime4`=players.onlinetime3, `onlinetime3`=players.onlinetime2, `onlinetime2`=players.onlinetime1, `onlinetime1`=players.onlinetimetoday, `onlinetimetoday`=0;"))
        assert(con:execute("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;"))
    end
    assert(con:execute("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;"))
con:close()
env:close()
end

function sql_communication(parameters)
	dofile("./config.lua")
	env = assert(luasql.mysql())
	con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
        result_plr = assert(con:execute("SELECT * FROM z_ots_comunication WHERE `type` = 'login';"))
        todo = result_plr:fetch({}, "a")
        while todo do
			id = tonumber(todo.id)
            action = tostring(todo.action)
			delete = tonumber(todo.delete_it)
			cid = getPlayerByName(tostring(todo.name))
			if isPlayer(cid) == TRUE then
				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 container_id = tonumber(todo.param3)
					local container_count = tonumber(todo.param4)
					local add_item_type = tostring(todo.param5)
					local add_item_name = tostring(todo.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 = assert(con:execute("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";"))
								assert(con:execute("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
			end
            todo = result_plr:fetch (todo, "a")
        end
	con:close()
	env:close()
	local eventServ = addEvent(sql_communication, SQL_COMUNICATION_INTERVAL, parameters)
end
 
Sorry Double post...

Editing...

I fixed all, but your can create too for who's dead, put on -200.000?

Sorry for my shit english:D
 
Last edited:
Translated to english (might be wrong since im not from poland i did use an translator)
replace this in charinfo.php
PHP:
<?php
//include charts.php to access the SendChartData function
include("config-and-functions.php");
include("charts.php");
if($_REQUEST['type'] == "exp")
{
	$chart[ 'axis_category' ] = array ( 'size'=>11, 'color'=>"000000", 'alpha'=>100, 'font'=>"arial", 'bold'=>true, 'skip'=>1 ,'orientation'=>"diagonal_up" ); 
	$chart[ 'axis_ticks' ] = array ( 'value_ticks'=>true, 'category_ticks'=>true ); 
	$chart[ 'axis_value' ] = array ( 'alpha'=>90, 'orientation'=>"horizontal" ); 
	$chart[ 'chart_border' ] = array ( 'top_thickness'=>0, 'bottom_thickness'=>3, 'left_thickness'=>3, 'right_thickness'=>0 ); 
	$chart[ 'chart_grid_h' ] = array ( 'thickness'=>2, 'color'=>"000000", 'alpha'=>60 ); 
	$chart[ 'chart_grid_v' ] = array ( 'thickness'=>2, 'color'=>"000000", 'alpha'=>60 ); 
	$chart[ 'chart_rect' ] = array ( 'x'=>65, 'y'=>5, 'width'=>450, 'height'=>200, 'positive_alpha'=>20 ); 
	$chart[ 'chart_pref' ] = array ( 'rotation_x'=>10, 'rotation_y'=>15 ); 
	$chart[ 'chart_type' ] = "parallel 3d column" ; 
	$chart[ 'chart_value' ] = array ( 'color'=>"FFFF00", 'alpha'=>100, 'size'=>14, 'position'=>"cursor" ); 
	$chart[ 'legend_label' ] = array ( 'layout'=>"horizontal", 'font'=>"arial", 'bold'=>true, 'size'=>12, 'color'=>"000000", 'alpha'=>90 ); 
	$chart[ 'legend_rect' ] = array ( 'x'=>25, 'y'=>250, 'width'=>350, 'height'=>50, 'margin'=>20, 'fill_color'=>"000000", 'fill_alpha'=>7, 'line_color'=>"000000", 'line_alpha'=>0, 'line_thickness'=>0 ); 
	$chart[ 'series_color' ] = array ("00FF00" ); 
	$chart[ 'series_gap' ] = array ( 'bar_gap'=>50, 'set_gap'=>50) ; 
	$player = new OTS_Player();
	$player->load($_REQUEST['guid']);
	if($player->isLoaded())
	{
		$player_exp[0] = (int) $player->getExperience();
		$player_exp[1] = (int) $player->getCustomField("exphist_lastexp");
		$player_exp[2] = (int) $player_exp[1] - $player->getCustomField("exphist1");
		$player_exp[3] = (int) $player_exp[2] - $player->getCustomField("exphist2");
		$player_exp[4] = (int) $player_exp[3] - $player->getCustomField("exphist3");
		$player_exp[5] = (int) $player_exp[4] - $player->getCustomField("exphist4");
		$player_exp[6] = (int) $player_exp[5] - $player->getCustomField("exphist5");
		$player_exp[7] = (int) $player_exp[6] - $player->getCustomField("exphist6");
		$chart [ 'chart_data' ] = array ( array ( "", "7 Days ago", "","6 Days ago", "", "5 Days ago", "", "4 Days ago", "", "3 Days ago", "", "2 Days ago", "", "1 Days ago", "", "Today"),
										  array ( "Experience given each day", $player_exp[7],"",$player_exp[6], "",$player_exp[5], "",$player_exp[4], "",$player_exp[3], "", $player_exp[2], "", $player_exp[1], "", $player_exp[0]));
	}
}
elseif($_REQUEST['type'] == "online")
{
	$chart[ 'axis_category' ] = array ( 'size'=>11, 'color'=>"000000", 'alpha'=>100, 'font'=>"arial", 'bold'=>true, 'skip'=>1 ,'orientation'=>"diagonal_up" ); 
	$chart[ 'axis_ticks' ] = array ( 'value_ticks'=>true, 'category_ticks'=>true ); 
	$chart[ 'axis_value' ] = array ( 'alpha'=>90, 'orientation'=>"horizontal" ); 
	$chart[ 'chart_border' ] = array ( 'top_thickness'=>0, 'bottom_thickness'=>3, 'left_thickness'=>3, 'right_thickness'=>0 ); 
	$chart[ 'chart_grid_h' ] = array ( 'thickness'=>2, 'color'=>"000000", 'alpha'=>60 ); 
	$chart[ 'chart_grid_v' ] = array ( 'thickness'=>2, 'color'=>"000000", 'alpha'=>60 ); 
	$chart[ 'chart_rect' ] = array ( 'x'=>65, 'y'=>5, 'width'=>445, 'height'=>200, 'positive_alpha'=>20 ); 
	$chart[ 'chart_pref' ] = array ( 'rotation_x'=>10, 'rotation_y'=>15 ); 
	$chart[ 'chart_type' ] = "parallel 3d column" ; 
	$chart[ 'chart_value' ] = array ( 'color'=>"FF0000", 'alpha'=>100, 'size'=>14, 'position'=>"cursor" ); 
	$chart[ 'legend_label' ] = array ( 'layout'=>"horizontal", 'font'=>"arial", 'bold'=>true, 'size'=>12, 'color'=>"000000", 'alpha'=>90 ); 
	$chart[ 'legend_rect' ] = array ( 'x'=>25, 'y'=>250, 'width'=>350, 'height'=>50, 'margin'=>20, 'fill_color'=>"000000", 'fill_alpha'=>7, 'line_color'=>"000000", 'line_alpha'=>0, 'line_thickness'=>0 ); 
	$chart[ 'series_color' ] = array ("FFFF00" ); 
	$chart[ 'series_gap' ] = array ( 'bar_gap'=>50, 'set_gap'=>50) ; 
	$player = new OTS_Player();
	$player->load($_REQUEST['guid']);
	if($player->isLoaded())
	{
		$player_exp[0] = bcdiv($player->getCustomField("onlinetimetoday"), 3600, 2);
		$player_exp[1] = bcdiv($player->getCustomField("onlinetime1"), 3600, 2);
		$player_exp[2] = bcdiv($player->getCustomField("onlinetime2"), 3600, 2);
		$player_exp[3] = bcdiv($player->getCustomField("onlinetime3"), 3600, 2);
		$player_exp[4] = bcdiv($player->getCustomField("onlinetime4"), 3600, 2);
		$player_exp[5] = bcdiv($player->getCustomField("onlinetime5"), 3600, 2);
		$player_exp[6] = bcdiv($player->getCustomField("onlinetime6"), 3600, 2);
		$player_exp[7] = bcdiv($player->getCustomField("onlinetime7"), 3600, 2);
		$chart [ 'chart_data' ] = array ( array ( "", "7 Days ago", "","6 Days ago", "", "5 Days ago", "", "4 Days ago", "", "3 Days ago", "", "2 Days ago", "", "1 Days ago", "", "Today"),
										  array ( "Online time last days", $player_exp[7],"",$player_exp[6], "",$player_exp[5], "",$player_exp[4], "",$player_exp[3], "", $player_exp[2], "", $player_exp[1], "", $player_exp[0]));
	}
}
elseif($_REQUEST['type'] == "expgain")
{
	$chart[ 'axis_category' ] = array ( 'size'=>11, 'color'=>"000000", 'alpha'=>100, 'font'=>"arial", 'bold'=>true, 'skip'=>1 ,'orientation'=>"diagonal_up" ); 
	$chart[ 'axis_ticks' ] = array ( 'value_ticks'=>true, 'category_ticks'=>true ); 
	$chart[ 'axis_value' ] = array ( 'alpha'=>90, 'orientation'=>"horizontal" ); 
	$chart[ 'chart_border' ] = array ( 'top_thickness'=>0, 'bottom_thickness'=>3, 'left_thickness'=>3, 'right_thickness'=>0 ); 
	$chart[ 'chart_grid_h' ] = array ( 'thickness'=>2, 'color'=>"000000", 'alpha'=>60 ); 
	$chart[ 'chart_grid_v' ] = array ( 'thickness'=>2, 'color'=>"000000", 'alpha'=>60 ); 
	$chart[ 'chart_rect' ] = array ( 'x'=>65, 'y'=>5, 'width'=>445, 'height'=>200, 'positive_alpha'=>20 ); 
	$chart[ 'chart_pref' ] = array ( 'rotation_x'=>10, 'rotation_y'=>15 ); 
	$chart[ 'chart_type' ] = "parallel 3d column" ; 
	$chart[ 'chart_value' ] = array ( 'color'=>"00FF00", 'alpha'=>100, 'size'=>14, 'position'=>"cursor" ); 
	$chart[ 'legend_label' ] = array ( 'layout'=>"horizontal", 'font'=>"arial", 'bold'=>true, 'size'=>12, 'color'=>"000000", 'alpha'=>90 ); 
	$chart[ 'legend_rect' ] = array ( 'x'=>25, 'y'=>250, 'width'=>350, 'height'=>50, 'margin'=>20, 'fill_color'=>"000000", 'fill_alpha'=>7, 'line_color'=>"000000", 'line_alpha'=>0, 'line_thickness'=>0 ); 
	$chart[ 'series_color' ] = array ("FF0000" ); 
	$chart[ 'series_gap' ] = array ( 'bar_gap'=>50, 'set_gap'=>50) ; 
	$player = new OTS_Player();
	$player->load($_REQUEST['guid']);
	{
		$player_exp[0] = (int) $player->getExperience() - $player->getCustomField("exphist_lastexp");
		$player_exp[1] = (int) $player->getCustomField("exphist1");
		$player_exp[2] = (int) $player->getCustomField("exphist2");
		$player_exp[3] = (int) $player->getCustomField("exphist3");
		$player_exp[4] = (int) $player->getCustomField("exphist4");
		$player_exp[5] = (int) $player->getCustomField("exphist5");
		$player_exp[6] = (int) $player->getCustomField("exphist6");
		$player_exp[7] = (int) $player->getCustomField("exphist7");
		$chart [ 'chart_data' ] = array ( array ( "", "7 Days ago", "","6 Days ago", "", "5 Days ago", "", "4 Days ago", "", "3 Days ago", "", "2 Days ago", "", "1 Days ago", "", "Today"),
										  array ( "Experience earned or lost last days", $player_exp[7],"",$player_exp[6], "",$player_exp[5], "",$player_exp[4], "",$player_exp[3], "", $player_exp[2], "", $player_exp[1], "", $player_exp[0]));
	}
}
SendChartData ($chart);

?>

can someone from poland check if i translated it right?
 
myyyhhh... Me no running script (i probably make good script)
 
hello gesior i need the script for List of players who lost most exp you have?? plx

srry for my inglish i speak low in reality speak spainsh
 
Back
Top