Sirion_Mido
Experienced Member
Actions:
the script which add premium points on use item ;s
In data/libs create 048-ppoints.lua
and paste the following
now:
In data/actions/scripts create points.lua
paste the following:
now xml part:
on data/actions.xml
paste the following:
Rep++ if it helpful for you.
the script which add premium points on use item ;s
In data/libs create 048-ppoints.lua
and paste the following
Lua:
-- Sirion_Mido Says: Credites to: LucasFerraz
-- Sirion_Mido Says: Credites to: LucasFerraz
-- Sirion_Mido Says: Credites to: LucasFerraz
function getAccountPoints(cid)
local res = db.getResult('select `premium_points` from accounts where name = \''..getPlayerAccount(cid)..'\'')
if(res:getID() == -1) then
return false
end
local ret = res:getDataInt("premium_points")
res:free()
return tonumber(ret)
end
function doAccountAddPoints(cid, count)
return db.executeQuery("UPDATE `accounts` SET `premium_points` = '".. getAccountPoints(cid) + count .."' WHERE `name` ='"..getPlayerAccount(cid).."'")
end
function doAccountRemovePoints(cid, count)
return db.executeQuery("UPDATE `accounts` SET `premium_points` = '".. getAccountPoints(cid) - count .."' WHERE `name` ='"..getPlayerAccount(cid).."'")
end
-- Sirion_Mido Says: Credites to: LucasFerraz
-- Sirion_Mido Says: Credites to: LucasFerraz
-- Sirion_Mido Says: Credites to: LucasFerraz
now:
In data/actions/scripts create points.lua
paste the following:
Lua:
local cfg = {
amount = 10 -- here how many points you want
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerLevel(cid) > 8 then
doAccountAddPoints(cid, cfg.amount)
doCreatureSay(cid, "CONGRATULATIONS! You have recived 10 premium points!. ", TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(cid), 28)
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid,"You need level 8 or higher to use this item.")
end
return TRUE
end
now xml part:
on data/actions.xml
paste the following:
XML:
<action itemid="5952" event="script" value="points.lua"/>
Rep++ if it helpful for you.
Last edited: