Fermantor
Active Member
Hello everyone,
I really like the idea, to get points by donating, but sometimes I think, it's cool, to unlock some points without paying, but with ingame events (get level 100 or do special quest, for example)
This is the function you can add in any lua script (and in global ofc) (I tested this in TFS 0.2.14)
You can use it on an creaturescript like this:
Hope you like it, and find it usefull
I really like the idea, to get points by donating, but sometimes I think, it's cool, to unlock some points without paying, but with ingame events (get level 100 or do special quest, for example)
This is the function you can add in any lua script (and in global ofc) (I tested this in TFS 0.2.14)
Code:
function addPlayerPoints(cid, Points, reason)
local AccountID = db.getResult("SELECT `account_id` FROM `players` WHERE `id` = " .. getPlayerGUID(cid)):getDataInt("account_id")
db.query("UPDATE `znote_accounts` SET `points` = `points` + ".. Points .." WHERE `account_id` = " .. AccountID)
doPlayerSendTextMessage(cid, 18, (reason ~= nil and .. ' For ' .. reason ' you gained' or 'You gained ') .. Points .. ' shop-points. You can use them anytime on the website.')
return TRUE
end
Code:
function onDeath(cid, corpse, lasthitkill, killer)
local PointsPerKill = 2
local reason = "killing " .. getCreatureName(cid)
if isPlayer(killer) then
addPlayerPoints(killer, PointsPerKill, reason)
end
return TRUE
end
Hope you like it, and find it usefull