• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

tablice lua

Boomer

Grenadia.eu - Best EVO
Joined
Aug 22, 2009
Messages
97
Reaction score
0
Ema! Na początek złożę wszystkim smacznego jaja i mokrego śmigusa dyngusa!

Mój problem polega na tym, że...
Nie wiem jak mogę wyciągnąć wszystkie wyniki z zapytania, wrzucić je do tablicy i wypisać graczowi. Pomoże ktoś?
Code:
function onSay(cid, words, param, channel)	

	local Info2 = db.getResult("SELECT `code` FROM `codes` WHERE `to_name` = '"..getCreatureName(cid).."'")
    local code = Info2:getDataString("code")
    Info2:free()

	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your codes: ".. code .."")
		return TRUE
	end
	return true
end
 
LUA:
function onSay(cid, words, param, channel)
 local Info2 = db.getResult("SELECT `code` FROM `codes` WHERE `to_name` = '"..getCreatureName(cid).."'")
 local message = "Your codes: "
 if(Info2:getID() ~= -1) then
  while(true) do
   local code = Info2:getDataString("code")
   message = message + " " + code
   if not(Info2:next()) then
    break
   end
  end
  Info2:free()
 end
 if(param == '') then
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, message)
  return TRUE
 end
 return true
end
 
Last edited:
A ja dziękuję za życzenia i życzę również wesołych oraz pogodnych ;)

Co do rozwiązania, to podane wyżej powinno spełnić twoje wymagania.
 
Back
Top