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

[Znote AAC] Gain Shop Points by Ingame Event

Fermantor

Active Member
Joined
Dec 16, 2009
Messages
209
Solutions
4
Reaction score
33
Location
Germany
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)
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
You can use it on an creaturescript like this:
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 :)
 
Thread moved to
OpenTibia -> Resources -> Mods & Lua Functions board.

Thanks for your contribution. :)
 
Hello, does this also work one TFS 1.0 ?
Becouse it's a nice script, and i like to use it ^^
 
Hiho i want this script in my server like take lvl 400 and gain like 100 points can you help me out with this one please?
 
Back
Top