Godely
Member
- Joined
- Aug 19, 2007
- Messages
- 233
- Reaction score
- 16
Hey there
The problem is really simple for those who know luasql
Here is the script:
There's something wrong. The "rows" is going to give more than 1 result (More than 1 row), and I want the player to receive 1 message for each row he got. I don't know if you can understand, but the way it is written the player is receiving always the same message (The info of the first row).
Thank you in advance,
Godely
Edit: Oh, and don't care about this "return selling". After I fix it, I will change the function to what I really want. This message (You have...), actually, is just for testing =)
The problem is really simple for those who know luasql
Here is the script:
Code:
function getSellerItems(uid)
local selling = {}
local guid = getPlayerGUID(uid)
local rows = db.getResult("SELECT `item_id`,`count`,`price` FROM `player_sells` WHERE `player_id` = ".. guid ..";")
if(rows:getID() ~= -1) then
local amount = rows:numRows(true)
for i = 1, amount do
itemid = rows:getDataInt("item_id")
itemcount = rows:getDataInt("count")
itemprice = rows:getDataInt("price")
doPlayerSendTextMessage(uid, TALKTYPE_PRIVATE_PN, "You have a ".. itemcount .." ".. getItemNameById(itemid) .." that costs ".. itemprice ..".")
end
else
return 0
end
return selling
end
There's something wrong. The "rows" is going to give more than 1 result (More than 1 row), and I want the player to receive 1 message for each row he got. I don't know if you can understand, but the way it is written the player is receiving always the same message (The info of the first row).
Thank you in advance,
Godely
Edit: Oh, and don't care about this "return selling". After I fix it, I will change the function to what I really want. This message (You have...), actually, is just for testing =)