• 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!

Solved Premium Points?

Carlitos Flow

Developer (lvl*1)
Joined
Mar 2, 2011
Messages
156
Solutions
4
Reaction score
10
How i can see with a talkaction the points from a player? I hope your help, thanks:D
Or a new script please

This is my player_info.lua from talakctios
LUA:
function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end

    local pid = getPlayerByNameWildcard(param)
    if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
        return true
    end

    local tmp = {accountId = getPlayerAccountId(pid), ip = getPlayerIp(pid)}
    local pos = getCreaturePosition(pid)
    doPlayerPopupFYI(cid, "Information about player" ..
        "\nName: " .. getCreatureName(pid) ..
        "\nGUID: " .. getPlayerGUID(pid) ..
        "\nGroup: " .. getPlayerGroupName(pid) ..
[B]       "\nPremium Points: " .. getPremiumPoints(pid) ..[/B]
        "\nAccess: " .. getPlayerAccess(pid) ..
        "\nVocation: " .. getVocationInfo(getPlayerVocation(pid)).name ..
        "\nStatus:" ..
            "\nLevel - " .. getPlayerLevel(pid) .. ", Magic Level - " .. getPlayerMagLevel(pid) .. ", Speed - " .. getCreatureSpeed(pid) ..
            "\nHealth - " .. getCreatureHealth(pid) .. " / " .. getCreatureMaxHealth(pid) .. ", Mana - " .. getCreatureMana(pid) .. " / " .. getCreatureMaxMana(pid) ..
            "\nSkills:" ..
            "\nFist - " .. getPlayerSkillLevel(pid, SKILL_FIST) .. ", Club - " .. getPlayerSkillLevel(pid, SKILL_CLUB) .. ", Sword - " .. getPlayerSkillLevel(pid, SKILL_SWORD) .. ", Axe - " .. getPlayerSkillLevel(pid, SKILL_AXE) ..
            "\nDistance - " .. getPlayerSkillLevel(pid, SKILL_DISTANCE) .. ", Shielding - " .. getPlayerSkillLevel(pid, SKILL_SHIELD) .. ", Fishing - " .. getPlayerSkillLevel(pid, SKILL_FISHING) ..
        "\nCoins:" ..
            "\nCrystal - " .. getPlayerItemCount(pid, ITEM_CRYSTAL_COIN) .. ", Platinum - " .. getPlayerItemCount(pid, ITEM_PLATINUM_COIN) .. ", Gold - " .. getPlayerItemCount(pid, ITEM_GOLD_COIN) ..
            "\nOverall amount - " .. getPlayerMoney(pid) ..
        "\nBalance: " .. getPlayerBalance(pid) ..
        "\nPosition: [X - " .. pos.x .. " | Y - " .. pos.y .. " | Z - " .. pos.z .. "]" ..
        "\n\nInformation about account" ..
        "\nName: " .. getPlayerAccount(pid) ..
        "\nID: " .. tmp.accountId ..
        "\nNotations: " .. getNotationsCount(tmp.accountId) ..
        "\nIP: " .. doConvertIntegerToIp(tmp.ip) .. " (" .. tmp.ip .. ")")      
    return true
end
 
Solution
You can add the function getPlayerPremmiumPoints like Ramirow posted, then
Code:
"\nPremium Points: " .. getPlayerPremmiumPoints(pid) ..
Like you posted in the first post (name doesn't matter, should be the same as the function).
what for scripts you use?
I just use it to give Premium points, but i don't know how to check how many have the player, example to give 30 /addpoints Example, 30 and its work but to check?
This is the script:

function onSay(cid, words, param)
local Data = string.explode(param, ",")
if Data then
local Target = db.getResult("SELECT `name` FROM `players` WHERE `name` = " .. db.escapeString(Data[1]) .. ";")
if (Target:getID() ~= -1) then
if Data[2] then
if (words:sub(2, 2) == "a") then
if isNumber(Data[2]) == TRUE then
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + ".. Data[2] .." WHERE `accounts`.`id` = ".. getAccountIdByName(Data[1]) .." LIMIT 1;")
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Was added ".. Data[2] .." points to ".. Data[1] ..".")
else
doPlayerSendCancel(cid, "Enter only numbers.")
end
else
doPlayerSendCancel(cid, "To check the amount of points not need to enter numbers.")
end
else
if (words:sub(2, 2) == "c") then
if premiumPointsByName(Data[1]) == 0 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This player ".. Data[1] .." has no points.")
elseif premiumPointsByName(Data[1]) == 1 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This player ".. Data[1] .." have ".. vipDaysByName(Data[1]) .." point.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This player ".. Data[1] .." have ".. vipDaysByName(Data[1]) .." points.")
end
else
doPlayerSendCancel(cid, "Enter the amount of points.")
end
end
else
doPlayerSendCancel(cid, "This player ".. Data[1] .." does not exist.")
end
else
doPlayerSendCancel(cid, "Enter a name.")
end
return TRUE
end
 
Try replacing "getPremiumPoints(pid)" with:
Code:
db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getAccountIdByName(getPlayerName(pid)) .. ";")

Not 100% sure but it's worth trying!
 
Last edited:
I think I forgot to include a ")" behind "getPlayerName(pid))" (I'll update my first post) Sorry, I'm on my phone.

If adding that ending parenthesis doesn't work then I'm not really sure. Sorry :/
 
Last edited:
I didn't have the time to test this, but you can try maybe?

Go to data/libs/050-function.lua

Insert this function at the top:
Code:
function getPlayerPremmiumPoints(cid)
local Info = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
local value= Info:getDataInt("premium_points")
Info:free()
return value
end
return LUA_ERROR
end

Now go to data/talkactions/scripts and add a file named premPointsInfo.lua
Paste this inside:
Code:
function onSay(cid, words, param, channel)
   if(param == '') then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
     return true
   end

   local pid = getPlayerByNameWildcard(param)
   if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
     return true
   end

   local tmp = {accountId = getPlayerAccountId(pid), ip = getPlayerIp(pid)}
   local pos = getCreaturePosition(pid)
   local points = getPlayerPremiumPoints(pid)
 
   doPlayerPopupFYI(cid, "Information about premium account" ..
     "\nPoints: " .. getPlayerPremmiumPoints(pid) ..
     )
   return true
end

Open Talkactions.xml and add this command:
Code:
<talkaction log="yes" words="/pinfo" access="2" event="script" value="premPointsInfo.lua"/>

There may be a better way to do it, if you happen to have any error, post it, maybe we can fix it up!

To use it, you should use /pinfo <Name of player>
If it works, let me know, since the script is made from another one I had, so we can optimize it
 
I didn't have the time to test this, but you can try maybe?

Go to data/libs/050-function.lua

Insert this function at the top:
Code:
function getPlayerPremmiumPoints(cid)
local Info = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
local value= Info:getDataInt("premium_points")
Info:free()
return value
end
return LUA_ERROR
end

Now go to data/talkactions/scripts and add a file named premPointsInfo.lua
Paste this inside:
Code:
function onSay(cid, words, param, channel)
   if(param == '') then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
     return true
   end

   local pid = getPlayerByNameWildcard(param)
   if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
     return true
   end

   local tmp = {accountId = getPlayerAccountId(pid), ip = getPlayerIp(pid)}
   local pos = getCreaturePosition(pid)
   local points = getPlayerPremiumPoints(pid)

   doPlayerPopupFYI(cid, "Information about premium account" ..
     "\nPoints: " .. getPlayerPremmiumPoints(pid) ..
     )
   return true
end

Open Talkactions.xml and add this command:
Code:
<talkaction log="yes" words="/pinfo" access="2" event="script" value="premPointsInfo.lua"/>

There may be a better way to do it, if you happen to have any error, post it, maybe we can fix it up!

To use it, you should use /pinfo <Name of player>
If it works, let me know, since the script is made from another one I had, so we can optimize it
Doesn't work:/ (Error getPlayerPremmiumPoints(pid) .. is not a function *EDIT; Lol "Premmium u was wrong but now i close the host, let me check tomorrow if it work with only 1 p
 
What about this?

Code:
function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
    else
        local pid = getPlayerByNameWildcard(param)
      
        if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
        else
            local tmp = {accountId = getPlayerAccountId(pid), ip = getPlayerIp(pid)}
            local pos = getCreaturePosition(pid)
  
            doPlayerPopupFYI(cid, "Information about player" ..
            "\nName: " .. getCreatureName(pid) ..
            "\nGUID: " .. getPlayerGUID(pid) ..
            "\nGroup: " .. getPlayerGroupName(pid) ..
            "\nPremium Points: " .. db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. tmp.accountId .. ";") ..
            "\nAccess: " .. getPlayerAccess(pid) ..
            "\nVocation: " .. getVocationInfo(getPlayerVocation(pid)).name ..
            "\nStatus:" ..
            "\nLevel - " .. getPlayerLevel(pid) .. ", Magic Level - " .. getPlayerMagLevel(pid) .. ", Speed - " .. getCreatureSpeed(pid) ..
            "\nHealth - " .. getCreatureHealth(pid) .. " / " .. getCreatureMaxHealth(pid) .. ", Mana - " .. getCreatureMana(pid) .. " / " .. getCreatureMaxMana(pid) ..
            "\nSkills:" ..
            "\nFist - " .. getPlayerSkillLevel(pid, SKILL_FIST) .. ", Club - " .. getPlayerSkillLevel(pid, SKILL_CLUB) .. ", Sword - " .. getPlayerSkillLevel(pid, SKILL_SWORD) .. ", Axe - " .. getPlayerSkillLevel(pid, SKILL_AXE) ..
            "\nDistance - " .. getPlayerSkillLevel(pid, SKILL_DISTANCE) .. ", Shielding - " .. getPlayerSkillLevel(pid, SKILL_SHIELD) .. ", Fishing - " .. getPlayerSkillLevel(pid, SKILL_FISHING) ..
            "\nCoins:" ..
            "\nCrystal - " .. getPlayerItemCount(pid, ITEM_CRYSTAL_COIN) .. ", Platinum - " .. getPlayerItemCount(pid, ITEM_PLATINUM_COIN) .. ", Gold - " .. getPlayerItemCount(pid, ITEM_GOLD_COIN) ..
            "\nOverall amount - " .. getPlayerMoney(pid) ..
            "\nBalance: " .. getPlayerBalance(pid) ..
            "\nPosition: [X - " .. pos.x .. " | Y - " .. pos.y .. " | Z - " .. pos.z .. "]" ..
            "\n\nInformation about account" ..
            "\nName: " .. getPlayerAccount(pid) ..
            "\nID: " .. tmp.accountId ..
            "\nNotations: " .. getNotationsCount(tmp.accountId) ..
            "\nIP: " .. doConvertIntegerToIp(tmp.ip) .. " (" .. tmp.ip .. ")")
        end      
    end
    return true
end
 
Last edited:
What about this?

Code:
function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
    else
        local pid = getPlayerByNameWildcard(param)
     
        if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
        else
            local tmp = {accountId = getPlayerAccountId(pid), ip = getPlayerIp(pid)}
            local pos = getCreaturePosition(pid)
 
            doPlayerPopupFYI(cid, "Information about player" ..
            "\nName: " .. getCreatureName(pid) ..
            "\nGUID: " .. getPlayerGUID(pid) ..
            "\nGroup: " .. getPlayerGroupName(pid) ..
            "\nPremium Points: " .. db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. tmp.accountId .. ";") ..
            "\nAccess: " .. getPlayerAccess(pid) ..
            "\nVocation: " .. getVocationInfo(getPlayerVocation(pid)).name ..
            "\nStatus:" ..
            "\nLevel - " .. getPlayerLevel(pid) .. ", Magic Level - " .. getPlayerMagLevel(pid) .. ", Speed - " .. getCreatureSpeed(pid) ..
            "\nHealth - " .. getCreatureHealth(pid) .. " / " .. getCreatureMaxHealth(pid) .. ", Mana - " .. getCreatureMana(pid) .. " / " .. getCreatureMaxMana(pid) ..
            "\nSkills:" ..
            "\nFist - " .. getPlayerSkillLevel(pid, SKILL_FIST) .. ", Club - " .. getPlayerSkillLevel(pid, SKILL_CLUB) .. ", Sword - " .. getPlayerSkillLevel(pid, SKILL_SWORD) .. ", Axe - " .. getPlayerSkillLevel(pid, SKILL_AXE) ..
            "\nDistance - " .. getPlayerSkillLevel(pid, SKILL_DISTANCE) .. ", Shielding - " .. getPlayerSkillLevel(pid, SKILL_SHIELD) .. ", Fishing - " .. getPlayerSkillLevel(pid, SKILL_FISHING) ..
            "\nCoins:" ..
            "\nCrystal - " .. getPlayerItemCount(pid, ITEM_CRYSTAL_COIN) .. ", Platinum - " .. getPlayerItemCount(pid, ITEM_PLATINUM_COIN) .. ", Gold - " .. getPlayerItemCount(pid, ITEM_GOLD_COIN) ..
            "\nOverall amount - " .. getPlayerMoney(pid) ..
            "\nBalance: " .. getPlayerBalance(pid) ..
            "\nPosition: [X - " .. pos.x .. " | Y - " .. pos.y .. " | Z - " .. pos.z .. "]" ..
            "\n\nInformation about account" ..
            "\nName: " .. getPlayerAccount(pid) ..
            "\nID: " .. tmp.accountId ..
            "\nNotations: " .. getNotationsCount(tmp.accountId) ..
            "\nIP: " .. doConvertIntegerToIp(tmp.ip) .. " (" .. tmp.ip .. ")")
        end     
    end
    return true
end
thanks bro, but isn't work
 
You can add the function getPlayerPremmiumPoints like Ramirow posted, then
Code:
"\nPremium Points: " .. getPlayerPremmiumPoints(pid) ..
Like you posted in the first post (name doesn't matter, should be the same as the function).
 
Solution
2gv1t0l.png

Solved thanks!<3
You can add the function getPlayerPremmiumPoints like Ramirow posted, then
Code:
"\nPremium Points: " .. getPlayerPremmiumPoints(pid) ..
Like you posted in the first post (name doesn't matter, should be the same as the function).
:)
 
Hey @Limos, for learning purposes, where'd I go wrong on my database query?

Code:
"\nPremium Points: " .. db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. tmp.accountId .. ";") ..

Thanks in advance! :D
 
Back
Top