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

doPlayerAddPremiumPoints

Gcr

New Member
Joined
Apr 23, 2010
Messages
2
Reaction score
0
Hi, I present to you a simple function "doPlayerAddPremiumPoints"
Application:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(not isPlayer(itemEx.uid)) then
        return false
    end

    doPlayerAddPremiumPoints(cid, cfg.points)
    doCreatureSay(cid, "You have received " .. cfg.points .. " premium points!", TALKTYPE_ORANGE_1, false, nil, toPosition)
    doSendMagicEffect(toPosition, cfg.effect)
    doRemoveItem(item.uid, 1)
    return true
end

Data/lib/function.lua
Lua:
function doPlayerAddPremiumPoints(cid, points)
    return db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
 
fixed up a bit
Code:
local cfg = {
	points = 10,
	effect = CONST_ME_MAGIC_GREEN
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(itemEx.uid) then
		doPlayerAddPremiumPoints(itemEx.uid, cfg.points)
		doCreatureSay(itemEx.uid, "You have received " .. cfg.points .. " premium points!", TALKTYPE_ORANGE_1)
		doSendMagicEffect(toPosition, cfg.effect)
		doRemoveItem(item.uid, 1)
		return true
	end
end
 
where go local cfg = {
points = 10,
effect = CONST_ME_MAGIC_GREEN
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isPlayer(itemEx.uid) then
doPlayerAddPremiumPoints(itemEx.uid, cfg.points)
doCreatureSay(itemEx.uid, "You have received " .. cfg.points .. " premium points!", TALKTYPE_ORANGE_1)
doSendMagicEffect(toPosition, cfg.effect)
doRemoveItem(item.uid, 1)
return true
end
end
?
 
fixed up a bit
Code:
local cfg = {
	points = 10,
	effect = CONST_ME_MAGIC_GREEN
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(itemEx.uid) then
		doPlayerAddPremiumPoints(itemEx.uid, cfg.points)
		doCreatureSay(itemEx.uid, "You have received " .. cfg.points .. " premium points!", TALKTYPE_ORANGE_1)
		doSendMagicEffect(toPosition, cfg.effect)
		doRemoveItem(item.uid, 1)
		return true
	end
end

cant get it to work. How i get this in a quest chest lua?


ERROR
[03/06/2010 00:07:54] data/lib/050-function.lua:664: in function 'doPlayerAddPvpPoints'
[03/06/2010 00:07:54] data/actions/scripts/inquichest.lua:12: in function <data/actions/scripts/inquichest.lua:5>

Function
function doPlayerAddPvpPoints(cid, points)
return db.executeQuery("UPDATE `accounts` SET `pvp_points` = `pvp_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end

Quest script
local cfg = {
points = 10000,
effect = CONST_ME_MAGIC_GREEN
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid == 8560 then
queststatus = getPlayerStorageValue(cid,8560)
if queststatus == -1 then
doPlayerSendTextMessage(cid,22,"You have found a Hellforged axe")
doPlayerAddItem(cid,8924,1)
setPlayerStorageValue(cid,8560,1)
doPlayerAddPvpPoints(itemEx.uid, cfg.points)
doCreatureSay(itemEx.uid, "You have received " .. cfg.points .. " war points!", TALKTYPE_ORANGE_1)
doSendMagicEffect(toPosition, cfg.effect)
doRemoveItem(item.uid, 1)
return true
else
doPlayerSendTextMessage(cid,22,"It is empty.")
end

else
return 0
end

return 1
end
 
Last edited:
Code:
local cfg = {
	points = 10000,
	effect = CONST_ME_MAGIC_GREEN
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.uid == 8560 then
		if getPlayerStorageValue(cid, 8560) == -1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a Hellforged axe')
			doPlayerAddItem(cid, 8924, 1)
			setPlayerStorageValue(cid,8560,1)
			doPlayerAddPvpPoints(cid, cfg.points)
			doCreatureSay(cid, "You have received " .. cfg.points .. " war points!", TALKTYPE_ORANGE_1)
			doSendMagicEffect(getThingPos(cid), cfg.effect)
			doRemoveItem(item.uid,)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The " .. getItemName(item.uid) .. " is empty.")
		end
	end
	return true
end
 
fixed up a bit
Code:
local cfg = {
	points = 10,
	effect = const_me_magic_green
}
function onuse(cid, item, fromposition, itemex, toposition)
	if isplayer(itemex.uid) then
		doplayeraddpremiumpoints(itemex.uid, cfg.points)
		docreaturesay(itemex.uid, "you have received " .. Cfg.points .. " premium points!", talktype_orange_1)
		dosendmagiceffect(toposition, cfg.effect)
		doremoveitem(item.uid, 1)
		return true
	end
end

love u
 
HELP HERROR

OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: near "LIMIT": syntax error (UPDATE "accounts" SET "premium_points" = 50 WHERE "name"='jibran' LIMIT 1;)
 
Back
Top