• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

!gmp from shop system

swordman

Member
Joined
Jun 5, 2011
Messages
394
Reaction score
7
Hi does someone know how to make an command that let u buy items from the shop system of gesior aac. i need a command for the great mana potions. example: someone is going to buy 100 gmp he says !gmp and 50 points gets removed from his acc and the 100 gmp gets added to his account. bbut it only can be added when he dont have fight icon on the icon list.

Thx in advance i hope someone can help me
with this
 
Haven't tested this, but it should work.
Just add to talkaction

LUA:
local config = {
	itemid = 7590,--Itemid of item to be delivered
	amount = 100,--Amount of items to be delivered
	points = 50,--Amount of points to be removed
}

function removePremiumPoints(cid, amount)
	db.query("UPDATE `accounts` SET `premium_points` = `premium_points`-".. amount .." WHERE `id` = ".. getPlayerAccountId(cid) .."")
	return true
end

function getPlayerPremiumPoints(cid)
	return db.getResult("SELECT * FROM `accounts` WHERE `id` = ".. getPlayerAccountId(cid) ..""):getDataInt("premium_points")
end

function onSay(cid, words, param)
	if(isPlayerPzLocked(cid) == false)then
		if(getPlayerPremiumPoints(cid) >= config.amount)then
			if(removePremiumPoints(cid, config.points))then
				doPlayerAddItem(cid, config.itemid, config.amount)
			else
				doPlayerSendCancel(cid, "Something went wrong, try again.")
		else
			doPlayerSendCancel(cid, "You don't have enough premium points")
	
	else
		doPlayerSendCancel(cid, "You can't use this if you're PZ locked")
	end
	return true
end
 
Last edited:
LUA:
local item = 1234 --- item id
local amount = 100 -- amount of the item
local removePoints = 50 -- amount to remove points
local str = 456 -- empty storage
local time = 60 -- exhaustion time
function onSay(cid, words, param, channel)
	if exhaustion.check(cid, str) then
		return doPlayerSendCancel(cid,'you are exhausted for '.. exhaustion.get(cid, str) ..' seconds')
	end
	if hasCondition(cid, CONDITION_INFIGHT) == TRUE then
		return doPlayerSendCancel(cid, "You may not use this command while you are in combat.")
	end
points = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = ".. getPlayerAccountId(cid) .." LIMIT 1;"):getDataInt("premium_points")
	if points >= removePoints then
		doPlayerAddItem(cid, item, amount)
		db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` - ".. removePoints .." WHERE `id` = " .. getPlayerAccountId(cid) ..";")
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "you have bought ".. amount .." ".. getItemNameById(item) .." for ".. removePoints .." premium points")
	else
		doPlayerSendCancel(cid, "sorry you don't have enough premium points")
		exhaustion.set(cid, str, time)
		end
	return true
end
 
Back
Top