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

Db questions

Doggynub

LUA / C++
Joined
Sep 28, 2008
Messages
2,541
Reaction score
186
Table : player_killers

contains : player_id ---> this return the player who killed or who was killed?
 
What is wrong in this it syas result not set but when i execute on database it is excuted with no eror
Code:
db.getResult("SELECT players.id  FROM players WHERE players.id NOT IN ("..( #r > 0 and table.concat(r,",") or '0' )..") AND level < '11' AND players.name NOT IN ('Account Manager','Druid Sample','Knight Sample','Paladin Sample','Sorcerer Samle') AND group_id < 2 AND lastlogin < UNIX_TIMESTAMP() - '12121' ;"):getDataInt('players.id ')







s
 
lol, it is check for how long the character didnt log any way this isnt the problem i want to know where is the eroor
 
hmm from what i understood you want it to give list of player? if yes then try this
LUA:
local Info = db.getResult("SELECT `id` FROM `players` WHERE ( `level` < 11 AND `name` NOT IN ('Account Manager','Druid Sample','Knight Sample','Paladin Sample','Sorcerer Samle') AND `group_id` < 2 )")
local players = {}
		if (Info:getID() ~= -1) then
	        while true do
			table.insert(players, Info:getDataInt("id"))
			if not Info:next() then
			    break
			end
		end
		Info:free()
		end	
		local txt = ""
		for k, i in ipairs(players) do
		txt = txt .. i .. ((k < #players) and ", " or "")
		end
--example >> doPlayerSendTextMessage(cid, 19,""..txt.."")
 
I like how you made it , i have made it in a hard way but thanks.

I have tryed to make it like that to get all result not only first result :P
LUA:
	local r = {}
	local f = db.getResult("SELECT accounts.id AS `id` FROM accounts INNER JOIN players ON accounts.id = players.account_id ;"):getRows()
	local s = db.getResult("SELECT accounts.id AS `id` FROM accounts INNER JOIN players ON accounts.id = players.account_id ;"):getDataInt('id')
	table.insert(r,s)
	local c = f
	repeat
			for i = 1,#r do
				s = db.getResult("SELECT accounts.id AS `id` FROM accounts INNER JOIN players ON accounts.id = players.account_id != '"..r[i].."' ;"):getDataInt('id')
				if not isInArray(r,s) then
					table.insert(r,s)
				end
			end
			c = c - 1
	until c == 0
 
Back
Top