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

help fixing script

Keiro

New Member
Joined
Jun 24, 2009
Messages
285
Reaction score
0
PHP:
local levelNeeded = 30
local basePrice = 2000
local blessLeveled = true
local bless = {}
local t = 0
 
function onSay(cid, words, param, channel)
 
	local level = getPlayerLevel(cid)
	local v = (blessLeveled and ((level > 30 and level < 120) and ((level - 30) * 200 + basePrice) or level > 120 and 20000 or level < 30 and basePrice) or 10000)
	for i = 1, 5 do
		if not getPlayerBlessing(cid, i) then
			table.insert(bless, i)
			t = t + 1
		end
	end
 
	if level >= levelNeeded then
		local price = v
		if doPlayerRemoveMoney(cid, price * t) then
			for i = 1, 5 do
				if not getPlayerBlessing(cid, i) then doPlayerAddBlessing(cid, i) end
			end
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, (price * t > 0 and "You bought " .. t .. " blessings for " .. price * t .. " gold coins." or "You already have all blessings."))
			doSendMagicEffect(getCreaturePosition(cid), (price * t > 0 and CONST_ME_MAGIC_RED or CONST_ME_POFF))
			price = 0
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have enough money.")
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need level " .. levelNeeded .. " or higher to buy blessings.")
		return true
	end
end


im lvl 155 i got 210k on my bp and it says i dont have enoguth money, why'
 
try
Lua:
local levelNeeded = 30
local basePrice = 2000
local blessLeveled = true

function onSay(cid, words, param, channel)
	local level = getPlayerLevel(cid)
	
	if level < levelNeeded then
		return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You need level ' .. levelNeeded .. ' or higher to buy blessings.')
	end

	local bless = {}
	local v = (blessLeveled and ((level > 30 and level < 120) and ((level - 30) * 200 + basePrice) or level > 120 and 20000 or level < 30 and basePrice) or 10000)
	for i = 1, 5 do
		if not getPlayerBlessing(cid, i) then
			table.insert(bless, i)
		end
	end

	if doPlayerRemoveMoney(cid, v * #bless) then
		for i = 1, #bless do
			doPlayerAddBlessing(cid, bless[i])
		end
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, #bless > 0 and 'You bought ' .. #bless .. ' blessing' .. (#bless > 1 and 's' or '') .. ' for ' .. v * #bless .. ' gold coins.' or 'You already have all blessings.')
		doSendMagicEffect(getThingPos(cid), #bless > 0 and CONST_ME_MAGIC_RED or CONST_ME_POFF)
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You don\'t have enough money.')
	end
	return true
end
 
Back
Top