Change item for donation/premium points on website

vTune

KakelmästareN^
Joined
Jun 14, 2012
Messages
3,675
Best answers
0
Reaction score
375
Location
Sweden
Hello there OTlanders!,

I wanna request a script for TFSV 0.3.6

So this how I want the script to work:

You pull a lever and it will remove item 6119 from your inventory and convert them to donation/premium points on the website.

And since I'm not a good scripter I have no start on this script and nor do I know if its hard to make.

I will rep++ the one who can help me and if you need anymore information just comment below/PM me.

Thanks in advance!

Kind Regards vTune
 

Dantarrix

Member
Joined
Aug 27, 2010
Messages
546
Best answers
0
Reaction score
18
Location
Stgo, Chile
Go to data/lib/050 - functions.lua and add the following:
Lua:
function doPlayerAddPremiumPoints(cid, points)
    return db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
That's a function made by Gcr...

And now, this is the action script:
Lua:
function onUse(cid, item, fromPos, itemEx, toPos)
while doPlayerRemoveItem(cid, 6119, 1) do
doPlayerAddPremiumPoints(cid, 1)
end
return true
end
You can edit this lines:
while doPlayerRemoveItem(cid, 6119, 1) do <--- 6119 = itemid; 1 = quantity to be removed to add premium points
doPlayerAddPremiumPoints(cid, 1) <--- 1 = premium points to be added

Hope it works.
 
OP
vTune

vTune

KakelmästareN^
Joined
Jun 14, 2012
Messages
3,675
Best answers
0
Reaction score
375
Location
Sweden
Thanks @Dantarrix It works! I repd you! ;)
 
Top