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

TalkAction Remove RS (and frags) for premium points [ TFS 0.3.x ]

nsanee

Member
Senator
Joined
Apr 13, 2008
Messages
669
Reaction score
20
Remove RS (and frags) for premium points [ TFS 0.3.4 ]

This simple script will remove Red Skull for premium points - the amount is configurable, as well as effect on succesfull removal. It works with Gesior's AAC shopsystem.

Removing frags doesn't work in 0.3.5, as for some reason they have changed the function for it, or the way it works - dunno since I don't use it.

File: /data/talkactions/scripts/removeskull.lua
Lua:
local exstorage = 1499
-- how many premium points are needed to take off the red skull
local COST = 20
-- "yes" or "no" // should it also remove all frags?
local REMOVE_FRAGS = "yes"
-- effect to use // you can find the list in data/lib/constant.lua
local EFFECT = CONST_ME_YELLOW_RINGS

function onSay(cid, words, param, channel)
    if (exhaustion.check(cid, exstorage) == true) then
        doPlayerSendCancel(cid, "You are exhausted")
        return false
    end
    
    if getCreatureSkullType(cid) == SKULL_RED then
        local query = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
        local points = query:getDataInt("premium_points")

        if points >= COST then
            local update = db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points - COST).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ")
            if (update == true) then            
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your red skull has been taken off!\nRemaining premium points: " .. (points - COST))
                doCreatureSetSkullType(cid, SKULL_NONE)
                doWriteLogFile("./data/logs/removeskull.log", "Success: " .. getCreatureName(cid))
                if (REMOVE_FRAGS == "yes") then
                    doPlayerSetRedSkullTicks(cid, 0)
                end
                doSendMagicEffect(getPlayerPosition(cid), effect)
            else
                doPlayerSendCancel(cid, "Database error")
            end
           
        else
            doPlayerSendCancel(cid, "You need " ..COST.. " premium points to remove red skull")
        end
    else
        doPlayerSendCancel(cid, "You do not have red skull")
    end
    exhaustion.set(cid, exstorage, 30)
    
    if (query ~= nil) then
        query:free()
    end
    
    return TRUE
   
end

File: /data/talkactions/talkactions.xml

Code:
<talkaction words="!removeskull" event="script" value="removeskull.lua"/>

03-11-2009: changed the query:free() placement so that it won't show up errors. Also changed topic title that it's for 0.3.4. I didn't think they'd change the way it works in 0.3.5 but seems like I was wrong. As I don't use it yet I'll update the script when I do.
 
Last edited:
Looks like this is for Gesior's ShopSystem... It uses table premium_points if I'm not mistaking... Can you say that in the first post? Will prevent a lot of people who use another AAC, for instance TFS CMS, from mistaking.
 
Yes, I don't think any other AAC has a built-in shop system, and if some one uses another AAC he's most likely using his own, custom shop system, as well as scripts. I added the info anyway.

Thanks for comment Saj ;]
 
You should write function like doPlayerAddPoints, getPlayerPoints and post on Lua Functions section. Will be usefull for many ppls.
 
It doesn't remove frags for me either =( and this came up in the console:

[15/10/2009 16:22:43] Lua Script Error: [TalkAction Interface]
[15/10/2009 16:22:43] data/talkactions/scripts/removeskull.lua:eek:nSay

[15/10/2009 16:22:43] data/talkactions/scripts/removeskull.lua:33: attempt to index global 'query' (a nil value)
[15/10/2009 16:22:43] stack traceback:
[15/10/2009 16:22:43] data/talkactions/scripts/removeskull.lua:33: in function <data/talkactions/scripts/removeskull.lua:8>
[15/10/2009 16:22:58] > Saving server...
[15/10/2009 16:23:02] > SAVE: Complete in 3.672 seconds using relational house storage.

[15/10/2009 16:23:09] Lua Script Error: [TalkAction Interface]
[15/10/2009 16:23:09] data/talkactions/scripts/removeskull.lua:eek:nSay

[15/10/2009 16:23:09] data/talkactions/scripts/removeskull.lua:19: attempt to call global 'doPlayerSetRedSkullTicks' (a nil value)
[15/10/2009 16:23:09] stack traceback:
[15/10/2009 16:23:09] data/talkactions/scripts/removeskull.lua:19: in function <data/talkactions/scripts/removeskull.lua:8>

Someone have a suggestion about this?

Thanks in advice!
 
When it takes the network from me skull this mistake goes out ->

[02/11/2009 22:49:45] Lua Script Error: [TalkAction Interface]
[02/11/2009 22:49:45] data/talkactions/scripts/removeskull.lua:eek:nSay

[02/11/2009 22:49:45] data/talkactions/scripts/removeskull.lua:19: attempt to call global 'doPlayerSetRedSkullTicks' (a nil value)
[02/11/2009 22:49:45] stack traceback:
[02/11/2009 22:49:45] data/talkactions/scripts/removeskull.lua:19: in function <data/talkactions/scripts/removeskull.lua:8>

When I use the script and do not have network skull it works out this for me :S
Error->
[02/11/2009 22:50:52] Lua Script Error: [TalkAction Interface]
[02/11/2009 22:50:52] data/talkactions/scripts/removeskull.lua:eek:nSay

[02/11/2009 22:50:52] data/talkactions/scripts/removeskull.lua:33: attempt to index global 'query' (a nil value)
[02/11/2009 22:50:52] stack traceback:
[02/11/2009 22:50:52] data/talkactions/scripts/removeskull.lua:33: in function <data/talkactions/scripts/removeskull.lua:8>

And Not Remove Frags :S
Used Tfs 0.3.5 Pl1
Fixed pleased : (
 
This script doesnt remove frags, only red skull. But anyway after logging on u have this rs again.
 
Back
Top