- 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
File: /data/talkactions/talkactions.xml
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.
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: