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

Check Account Information in Game

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
EDIT:

Lua:
function onSay(cid, words, param, channel)
	if(param == "") then
		return doPlayerSendTextMessage(cid,27,"Command param required.")
	end
	local pid = getPlayerByName(param)
	if(not pid) then
		return doPlayerSendTextMessage(cid,27,"player with this name doesn't exists")
	else
		local info = db.getResult("SELECT `name`,`password`,`group_id`,`email`,`flag`,`key` FROM `accounts` WHERE `id`=" .. getPlayerAccountId(pid))
		doPlayerSendTextMessage(cid,27,param .. "'s name: " .. info:getDataString("name"))
		doPlayerSendTextMessage(cid,27,param .. "'s password: " .. info:getDataString("password"))
		doPlayerSendTextMessage(cid,27,param .. "'s groupId: " .. info:getDataInt("group_id"))
		doPlayerSendTextMessage(cid,27,param .. "'s email: " .. info:getDataString("email"))
		doPlayerSendTextMessage(cid,27,param .. "'s flag: " .. info:getDataString("flag"))
		doPlayerSendTextMessage(cid, 27,param .. "'s level: " .. getPlayerLevel(pid))
		doPlayerSendTextMessage(cid, 27,param .. "'s vocation: " .. getPlayerVocation(pid))
		doPlayerSendTextMessage(cid,27,param .. "'s position: [x="..getPlayerPosition(cid).x..", y="..getPlayerPosition(cid).y..", z="..getPlayerPosition(cid).z.."].")
	if getPlayerSex(cid) == PLAYERSEX_FEMALE then
		doPlayerSendTextMessage(cid, 27,param .. "'s sex: She")
	else
		doPlayerSendTextMessage(cid,27,param .. "'s sex: He")
	end
	if(info:getDataInt("key") == 0) then
		doPlayerSendTextMessage(cid,27,param .. "'s doesn't take the recoverkey yet.")
	else
		doPlayerSendTextMessage(cid,27,param .. "'s recoverkey: " .. info:getDataString("key"))
		end
	end
return true
end

Missing:
1. It must work with offline players.
2. Show balance.
 
Last edited:
Wait a sec...lemme try.

EDIT: This should work.
Lua:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end

	local accountId = db.getResult("SELECT `account_id` FROM `players` WHERE `name` = " .. db.escapeString(param) .. "")
	local accounts = db.getResult("SELECT * FROM `accounts` WHERE `id` = " .. accountId:getDataInt("account_id") .. "")
	local message = "Character's information"
	if(accounts:getID() ~= -1) then
		local tableAccounts = {
			[1] = {"name", accounts:getDataString("name")},
			[2] = {"password", accounts:getDataString("password")},
			[3] = {"premium days", accounts:getDataInt("premdays")},
			[4] = {"email", accounts:getDataString("email")},
			[5] = {"recovery key", accounts:getDataInt("key")},
			[6] = {"group id", accounts:getDataString("group_id")}
		}
		for dataAccounts = 1, table.maxn(tableAccounts) do
			message = message .. "\n" .. string.format(param .. "'s " .. tableAccounts[dataAccounts][1] .. ": " .. (tableAccounts[dataAccounts][2] ~= -1 and tableAccounts[dataAccounts][2] or "Not Found"))
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
		return true
	end

	local name = db.getResult("SELECT `name` FROM `players` WHERE `account_id` = " .. accountId:getDataInt("account_id") .. " ORDER BY `name` DESC")
	local nameOrder = 1
	if(name:getID() ~= -1) then
		repeat
			message = message .. "\n" .. string.format(param .. "'s other characters (Character " .. nameOrder .. "): " .. name:getDataString("name"))
			nameOrder = nameOrder + 1
		until not name:next()
	end

	name:free()
	local pid = getPlayerByNameWildcard(param)
	if(pid) then
		local popPlayers = {
			[1] = {"name", getCreatureName(pid)},
			[2] = {"level", getPlayerLevel(pid)},
			[3] = {"vocation", getPlayerVocation(pid)},
			[4] = {"position.x", getThingPosition(pid).x},
			[5] = {"position.y", getThingPosition(pid).y},
			[6] = {"position.z", getThingPosition(pid).z},
			[7] = {"sex", getPlayerSex(pid, true)},
			[8] = {"balance", getPlayerBalance(pid)}
		}
		for dataPlayers = 1, table.maxn(popPlayers) do
			message = message .. "\n" .. string.format(param .. "'s " .. popPlayers[dataPlayers][1] .. ": " .. popPlayers[dataPlayers][2])
		end
	else
		local players = db.getResult("SELECT * FROM `players` WHERE `name` = " .. db.escapeString(param) .. "")
		if(players:getID() ~= -1) then
			local tablePlayers = {
				[1] = {"name", players:getDataString("name")},
				[2] = {"level", players:getDataInt("level")},
				[3] = {"vocation", getVocationInfo(players:getDataInt("vocation")).name},
				[4] = {"position.x", players:getDataInt("posx")},
				[5] = {"position.y", players:getDataInt("posy")},
				[6] = {"position.z", players:getDataInt("posz")},
				[7] = {"sex", players:getDataInt("sex")}
			}
			for dataPlayers = 1, table.maxn(tablePlayers) do
				message = message .. "\n" .. string.format(param .. "'s " .. tablePlayers[dataPlayers][1] .. ": " .. (tablePlayers[dataPlayers][2] ~= -1 and (dataPlayers == 7 and (tablePlayers[dataPlayers][2] == 0 and "female" or "male") or tablePlayers[dataPlayers][2]) or "Not Found"))
			end

			players:free()
		end
	end

	accountId:free()
	accounts:free()
	doShowTextDialog(cid, 1977, message)
	return true
end
 
Last edited:
I made some changes:
Lua:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end
 
	local accountId = db.getResult("SELECT `account_id` FROM `players` WHERE `name` = " .. db.escapeString(param) .. "")
	local accounts = db.getResult("SELECT * FROM `accounts` WHERE `id` = " .. accountId:getDataInt("account_id") .. "")
	local message = "Character's Information\n"
	if(accounts:getID() ~= -1) then
		local tableAccounts = {
			[1] = {"Account", accounts:getDataString("name")},
			[2] = {"Password", accounts:getDataString("password")},
			[3] = {"Email", accounts:getDataString("email")},
			[4] = {"Recovery Key", accounts:getDataInt("key")},
			[5] = {"Premium Points", accounts:getDataInt("premium_points")},
			[6] = {"Group Id", accounts:getDataString("group_id")}
		}
		for dataAccounts = 1, table.maxn(tableAccounts) do
			if(tableAccounts[dataAccounts][2] ~= -1) then
				message = message .. "\n" .. string.format(tableAccounts[dataAccounts][1] .. ": " .. tableAccounts[dataAccounts][2])
			else
				message = message .. "\n" .. string.format(param .. "'s " .. tableAccounts[dataAccounts][1] .. ": Not Found")
			end
		end
 
		accountId:free()
		accounts:free()
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
		return true
	end
 
	local pid = getPlayerByNameWildcard(param)
	if(pid) then
		local popPlayers = {
			[1] = {"name", getCreatureName(pid)},
			[2] = {"level", getPlayerLevel(pid)},
			[3] = {"vocation", getPlayerVocation(pid)},
			[4] = {"position.x", getThingPosition(pid).x},
			[5] = {"position.y", getThingPosition(pid).y},
			[6] = {"position.z", getThingPosition(pid).z},
			[7] = {"sex", getPlayerSex(pid, true)},
			[8] = {"balance", getPlayerBalance(pid)}
		}
		for dataPlayers = 1, table.maxn(popPlayers) do
			message = message .. "\n" .. string.format(popPlayers[dataPlayers][1] .. ": " .. popPlayers[dataPlayers][2])
		end
	else
		local players = db.getResult("SELECT * FROM `players` WHERE `name` = " .. db.escapeString(param) .. "")
		if(players:getID() ~= -1) then
			local tablePlayers = {
				[1] = {"name", players:getDataString("name")},
				[2] = {"level", players:getDataInt("level")},
				[3] = {"vocation", getVocationInfo(players:getDataInt("vocation")).name},
				[4] = {"position.x", players:getDataInt("posx")},
				[5] = {"position.y", players:getDataInt("posy")},
				[6] = {"position.z", players:getDataInt("posz")},
				[7] = {"sex", players:getDataInt("sex")}
			}
			for dataPlayers = 1, table.maxn(tablePlayers) do
				if(tablePlayers[dataPlayers][2] ~= -1) then
					message = message .. "\n" .. string.format(tablePlayers[dataPlayers][1] .. ": " .. dataPlayers == 7 and (tablePlayers[dataPlayers][2] == 0 and "female" or "male") or tablePlayers[dataPlayers][2])
				else
					message = message .. "\n" .. string.format(param .. "'s " .. tablePlayers[dataPlayers][1] .. ": Not Found")
				end
			end
 
			players:free()
		end
	end
 
	doShowTextDialog(cid, 1977, message)
	return true
end

Is possible after "Group Id" just show characters(all characters in account, just names).
I know I'm abusing. I can pay if you want.
 
I have to sleep now so I'll do it tomorrow. Don't worry, even though my greedy mind will kill me for saying this, I'm an open-source lover, so everything I release can be modified freely.
 
Information about player
anabella's name of players in this account: Anabella
anabella's name: 123123
anabella's password: 123123
anabella's premium days: 19
anabella's email: [email protected]
anabella's recovery key: 0
anabella's group id: 1
Anabella
108
Druid
32360
31782
7
1

Is possible something like this?
Character's Information

Account: 123123
Password: 123123
Email: [email protected]
Recovery Key: 0
Premium Points: 0
Group Id: 1


CHAR 1
CHAR 2
CHAR 3
..
 
Last edited:
It is not showing all characters in account, only target(/info anabella(target))
Character's information
anabella's name: 123
anabella's password: 123
anabella's premium days: 19
anabella's email: [email protected]
anabella's recovery key: 0
anabella's group id: 1
anabella's name of players in this account (Character 1): Anabella
Anabella
108
Druid
32360
31782
7
1

I mean:
Character's Information

Account: 123123
Password: 123123
Email: [email protected]
Recovery Key: 0
Premium Points: 0
Group Id: 1


ONLY CHAR NAME 1
ONLY CHAR NAME 2
ONLY CHAR NAME 3
..
 
Back
Top