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

Lua Otserv 0.6.3 avesta help!

rafig78

New Member
Joined
Dec 17, 2010
Messages
62
Reaction score
0
hello i have avesta 7.4 0.6.3 otserv , i really need make sms shop system , i use my edit gesior acc , all works but if i wants to buy something in shop i get " attempt to index global 'luasql' ( a nil value) "
how fix it? otserv 0.6.3 dont have "luasql" function?


heres my
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

return TRUE
end

Please help
 
Back
Top