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

Lua Remove item, add points

Status
Not open for further replies.

LoLaye

Active Member
Joined
Dec 23, 2008
Messages
3,774
Solutions
1
Reaction score
44
Location
Sweden
Hello,

Okay so i've got a script that when u put a donation item on a coal basin, V from the switch, it shall remove the item, add the points that it cost to your account.. Now the problem is, this works on TFS 0.3.6, when i try it on 0.4 it gives me an error telling me that theres a problem on line 15.

Heres my script:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local itemm =  { [2469] = {point = 2}, [8880] = {point = 2}, [2664] = {point = 2},[7366] = {point = 3},[7902] = {point = 2},[8866] = {point = 2},[7896] = {point = 2},[8903] = {point = 2},[7409] = {point = 3},[2300] = {point = 4},[2501] = {point = 2},[2503] = {point = 2},[2504] = {point = 2},[8926] = {point = 3},[8929] = {point = 3},[7420] = {point = 3},[2527] = {point = 3},[7697] = {point = 4},[10521] = {point = 2},[5785] = {point = 4},[2299] = {point = 3},[11113] = {point = 3},[2297] = {point = 8} }



local iteeeemm = getThingFromPos({x = 990, y = 1004, z = 6, stackpos = 1})




for k, v in pairs(itemm) do
   if (iteeeemm.uid ~= 0 and iteeeemm.itemid == k) then
             doRemoveItem(iteeeemm.uid, 1)

	db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. v.point .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
	    doCreatureSay(cid, "You have got rid of "..getItemNameById(k).." and you have recievd again the "..v.point.." points.", TALKTYPE_ORANGE_1)

	else
	  doPlayerSendCancel(cid,"This is not a donated item")
	
	 end
end

end

Line 15:

Code:
	db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. v.point .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")

Fast help would be really appreciated
 
Wo0MB.png
 
Status
Not open for further replies.
Back
Top