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

Remove item get 1 donation point

vTune

KakelmästareN^
Joined
Jun 14, 2012
Messages
3,675
Reaction score
395
Location
Sweden
Hello OtLand,

I'm requesting a fairly easy script(Im just a noobtard).

You click on a item and it gives u 1 donation point. (Also the item should be removed ofc).

I've tried to script this and I could pase in the script as far as I've gotten but I dont think it would help anyone so I skip that part :p

Kind Regards
vTune
 
Code:
function onUse(cid, item, frompos, item2, topos)
   doRemoveItem(item.uid, 1)
   doPlayerAddItem(cid, ITEM_ID_HERE, AMOUNT_HERE)
   doPlayerSendTextMessage(cid, 22, "Anytext here player will get for using this item")
end

Something like that? Not sure if you want to get donation point in SQL or w/e so..

If you want to add a donation point in SQL add this in global.lua or functions.lua in data-folder
Code:
function addPlayerDonationPoint(id, amount)
  db.executeQuery("UPDATE `players` SET `donation_point` = ".. amount .." WHERE `id` = ".. id .."")
end
(You will have to edit your query thats for sure...but that basicly how it would work)

in Actions folder:
Code:
function onUse(cid, item, frompos, item2, topos)
local GUID = getPlayerGUID(cid)
   doRemoveItem(item.uid, 1)
   addPlayerDonationPoint(GUID, 1)
   doPlayerSendTextMessage(cid, 22, "Anytext here player will get for using this item")
end
 
Last edited:
@Last World

Thanks but I chose to do it like this instead

Code:
function onUse(cid, item, frompos, item2, topos)
local points = 1;
   doRemoveItem(item.uid, 1)
   db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid))

   doPlayerSendCancel(cid, "You received " .. points .. " point(s).")
   doPlayerSendTextMessage(cid, 22, "Anytext here player will get for using this item")
end
 
If you do it via global.lua or functions.lua you can use addPlayerDonationPoint in every script :)
your choise

btw:
local points = 1

instead of

local points = 1;
 
Last edited:
Back
Top