Rayeko
Programmer
- Joined
- Apr 9, 2008
- Messages
- 185
- Reaction score
- 3
Hi
Well, I wonder how to make this to work:
Its a function I made. Basically its about knowing in-game the points the player have. I know how to add points ingame. But, doing a function to get the points.. Its a chaos. I can't make it work.
This is the part of the function I have so far:
The value "points" in the DB, is an INT value, I also tried using "tonumber()" but still I get the same error. This is the error I get:
And the script of the "points.lua" file is:
Also, I would like to know how to do the same but with a text value. For example, how to retrieve the player's email from their account in the DB. Its almost the same but without using INT values, is text. I have this portion of the function (that is almost the same):
Thanks for any kind of help!
Well, I wonder how to make this to work:
Its a function I made. Basically its about knowing in-game the points the player have. I know how to add points ingame. But, doing a function to get the points.. Its a chaos. I can't make it work.
This is the part of the function I have so far:
Code:
function getPoints(cid)
return db.executeQuery("SELECT points FROM players WHERE name='" .. getPlayerName(cid) .. "'")
end
The value "points" in the DB, is an INT value, I also tried using "tonumber()" but still I get the same error. This is the error I get:
Code:
[Error - TalkAction Interface]
data/talkactions/scripts/stats/points.lua:onSay
Description:
data/talkactions/scripts/stats/pointst.lua:3: attempt to concatenate a nil value
stack traceback:
data/talkactions/scripts/stats/points.lua:3: in function <data/talkactions/scripts/stats/points.lua:1>
And the script of the "points.lua" file is:
Code:
function onSay(cid,words,param)
doPlayerPopupFYI(cid, "You have "..getPoints(cid).." points")
return TRUE
end
Also, I would like to know how to do the same but with a text value. For example, how to retrieve the player's email from their account in the DB. Its almost the same but without using INT values, is text. I have this portion of the function (that is almost the same):
Code:
function getPlayerEmail(cid)
return db.executeQuery("SELECT email FROM `accounts` WHERE (`accno` = '" .. getPlayerAccount(cid) .. "')")
end
Thanks for any kind of help!
Last edited: