samuel157
Intermediate OT User
- Joined
- Mar 19, 2010
- Messages
- 616
- Solutions
- 4
- Reaction score
- 122
- Location
- São Paulo, Brazil
- GitHub
- Samuel10M
[SQLite] -=[TFS]=- 0.4 8.60 Need script Talkaction show premium time of player example /pa player
function onPlayerCheckPremiumTime(cid, targetName)
local target = getPlayerByNameWildcard(targetName)
if target then
local premiumTime = getPlayerPremiumDays(target)
if premiumTime > 0 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, targetName .. " it has " .. premiumTime .. " premium time days remaining.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, targetName .. "does not have premium time.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Player not found.")
end
end
function onSay(cid, words, param)
local t = string.explode(param, ",")
if #t == 1 then
onPlayerCheckPremiumTime(cid, t[1])
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Use the correct syntax: /pa playername")
end
return true
end
function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
return true
end
local pid = cid
if(t[2]) then
pid = getPlayerByNameWildcard(t[2])
if(not pid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
return true
end
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player have" .. getPlayerPremiumDays(cid) .. " premium days.")
return true
end
<talkaction log="yes" words="/premium" access="5" event="script" value="premiumcheck.lua"/>
[21/09/2023 20:36:59] [Error - TalkAction Interface]
[21/09/2023 20:36:59] data/talkactions/scripts/premiumcheck.lua:onSay
[21/09/2023 20:36:59] Description:
[21/09/2023 20:36:59] data/talkactions/scripts/premiumcheck.lua:9: attempt to index global 't' (a nil value)
[21/09/2023 20:36:59] stack traceback:
[21/09/2023 20:36:59] data/talkactions/scripts/premiumcheck.lua:9: in function <data/talkactions/scripts/premiumcheck.lua:1>
in which of the two scripts?LUA:[21/09/2023 20:36:59] [Error - TalkAction Interface] [21/09/2023 20:36:59] data/talkactions/scripts/premiumcheck.lua:onSay [21/09/2023 20:36:59] Description: [21/09/2023 20:36:59] data/talkactions/scripts/premiumcheck.lua:9: attempt to index global 't' (a nil value) [21/09/2023 20:36:59] stack traceback: [21/09/2023 20:36:59] data/talkactions/scripts/premiumcheck.lua:9: in function <data/talkactions/scripts/premiumcheck.lua:1>