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

[Scrypt] !bless problem

Reins

Member
Joined
Apr 9, 2009
Messages
586
Reaction score
8
Otóż, zainstalowałem sobie na silniku scrypt z blesami (!bless), i co zmienić, aby zawsze, niezależnie od levelu, czy to 100 czy 300, jak się ma blesy to zabierało równo 2 levele, a gdy się nie ma blesów, a bez blesów 4.

Mój scrypt wygląda tak:

PHP:
-- !bless by Piotrek1447
-- edited by Kleksu
local bless = {1, 2, 3, 4, 5}
local cost = 500000 -- Cost in gp.
function onSay(cid, words, param)
	for i = 1, table.maxn(bless) do
		if(getPlayerBlessing(cid, bless[i])) then
			doPlayerSendCancel(cid, "You have already all blessings.")
			return TRUE
		end
	end
	if(doPlayerRemoveMoney(cid, cost) == TRUE) then
		for i = 1, table.maxn(bless) do
			doPlayerAddBlessing(cid, bless[i])
		end
		doPlayerSendTextMessage(cid,24, "You bought all blessing.")
		doSendMagicEffect(getPlayerPosition(cid), 28)
	else
		doPlayerSendCancel(cid, "You don't have enough money.")
	end
	return TRUE
end
 
PHP:
	-- Blessings
	blessingsOnlyPremium = "yes"
	blessingReductionBase = 30
	blessingReductionDecreament = 5
	eachBlessReduction = 8

Co muszę zmienić aby był rezultat?

Pozdrawiam
 
login lua
PHP:
function onLogin(cid)
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
	end

	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
	registerCreatureEvent(cid, "PlayerDeath")
	registerCreatureEvent(cid, "WarAttack")
	registerCreatureEvent(cid, "WarKill")
	return TRUE
end

w nim chyba też nie :/
 
0.3.4.1756

playerdeath.lua chtba z creaturescript :D

PHP:
local config = {
	deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
	sqlType = getConfigInfo('sqlType'),
	maxDeathRecords = getConfigInfo('maxDeathRecords')
}

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
	if(config.deathListEnabled ~= TRUE) then
		return
	end

	local hitKillerName = "field item"
	local damageKillerName = ""
	if(lastHitKiller ~= FALSE) then
		if(isPlayer(lastHitKiller) == TRUE) then
			hitKillerName = getPlayerGUID(lastHitKiller)
		else
			hitKillerName = getCreatureName(lastHitKiller)
		end

		if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
			if(isPlayer(mostDamageKiller) == TRUE) then
				damageKillerName = getPlayerGUID(mostDamageKiller)
			else
				damageKillerName = getCreatureName(mostDamageKiller)
			end
		end
	end

	db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")
	local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
	if(rows:getID() ~= -1) then
		local amount = rows:getRows(true) - config.maxDeathRecords
		if(amount > 0) then
			if(config.sqlType == "sqlite") then
				for i = 1, amount do
					db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
				end
			else
				db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")
			end
		end
	end
end

Prosze
 
Back
Top