I have this in my kills.lua
but when Ido the talkactions, the result is :
and I change thee local kills to this :
but when I execute the talkaction, in my console have a error :
any player do !frags and the Frags is 30, only the frag I guess it's wrong, than, I change the local kills to select in the database the registre kills in players .. can help me ?
TFS 1.2
kills.lua
local kills = math.ceil(skullTime / fragTime)
but when Ido the talkactions, the result is :
14:25 You have 30 unjustified kills. The amount of unjustified kills will decrease after: 8 hours, 4 minutes and 24 seconds.
and I change thee local kills to this :
local kills = db.getResult("SELECT kills FROM players WHERE account_id =" ..player:getAccountId()..";")
but when I execute the talkaction, in my console have a error :
data/talkactions/scripts/kills.lua:14: attempt to call field 'getResult' (a nil value)
stack traceback:
[C]: in function 'getResult'
data/talkactions/scripts/kills.lua:14: in function <data/talkactions/scripts/kills.lua:1>
any player do !frags and the Frags is 30, only the frag I guess it's wrong, than, I change the local kills to select in the database the registre kills in players .. can help me ?
TFS 1.2
kills.lua
Code:
function onSay(player, words, param)
local fragTime = configManager.getNumber(configKeys.FRAG_TIME)
if fragTime <= 0 then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You do not have any unjustified kill.")
return false
end
local skullTime = player:getSkullTime()
if skullTime <= 0 then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You do not have any unjustified kill.")
return false
end
-- I want to change this line to this
--local kills = db.getResult("SELECT kills FROM players WHERE account_id =" ..player:getAccountId()..";")
local kills = math.ceil(skullTime / fragTime)
local remainingSeconds = math.floor((skullTime % fragTime) / 1000)
local hours = math.floor(remainingSeconds / 3600)
local minutes = math.floor((remainingSeconds % 3600) / 60)
local seconds = remainingSeconds % 60
local message = "You have " .. kills .. " unjustified kill" .. (kills > 1 and "s" or "") .. ". The amount of unjustified kills will decrease after: "
if hours ~= 0 then
if hours == 1 then
message = message .. hours .. " hour, "
else
message = message .. hours .. " hours, "
end
end
if hours ~= 0 or minutes ~= 0 then
if minutes == 1 then
message = message .. minutes .. " minute and "
else
message = message .. minutes .. " minutes and "
end
end
if seconds == 1 then
message = message .. seconds .. " second."
else
message = message .. seconds .. " seconds."
end
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, message)
return false
end