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

CreatureEvent Rook System

Change this:
Code:
if getPlayerExperience(cid) <= 4620
to
Code:
if getPlayerLevel(cid) < 6

But it will still not work, because there are live queries used in TFS 0.3, take a look at your playerdeath.lua and edit this creaturescript to use LuaSQL instead of those live queries.

Broken sentece is broken sentence.
 
hello

hello,is my playerdeath


HTML:
dofile("./config.lua")

function onDeath(cid, corpse, killer)
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You are dead.")
	if deathListEnabled == "yes" then
		if sqlType == "mysql" then
			env = assert(luasql.mysql())
			con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
		else -- sqlite
			env = assert(luasql.sqlite3())
			con = assert(env:connect(sqliteDatabase))
		end
		local byPlayer = FALSE
		if killer == FALSE then
			killerName = "field item"
		else
			if isPlayer(killer) == TRUE then
				byPlayer = TRUE
			end
			killerName = getCreatureName(killer)
		end
		assert(con:execute("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", '" .. escapeString(killerName) .. "', " .. byPlayer .. ");"))
		local cursor = assert(con:execute("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";"))
		local deathRecords = numRows(cursor)
		if sqlType == "mysql" then
			while deathRecords > maxDeathRecords do
				delete = assert(con:execute("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1;"))
				deathRecords = deathRecords - 1
			end
		else
			while deathRecords > maxDeathRecords do
				delete = assert(con:execute("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);"))
				deathRecords = deathRecords - 1
			end
		end			
		con:close()
		env:close()
	end
end

give one error you scrip

PHP:
[15/02/2009  21:02:38] data/creaturescripts/scripts/Rook.lua:33: attempt to call global 'getTownTemplePosition' (a nil value)
[15/02/2009  21:02:39] stack traceback:
[15/02/2009  21:02:39] 	data/creaturescripts/scripts/Rook.lua:33: in function <data/creaturescripts/scripts/Rook.lua:1>


ty for all.
 
Remove this line:
Code:
doTeleportThing(cid, getTownTemplePosition(rookTownID))

Or change it to:
Code:
local rookPos = { x = rookXpos, y = rookYpos, z = rookZpos }
doTeleportThing(cid, rookPos, FALSE)
 
hmm
you can use addEvent

Code:
local rookSystem(cid)
 if getPlayerLevel(cid) == 5 then
  // rook code
 end
end

if getPlayerLevel(cid) == 6 then
addEvent(rookSystem, 100, cid)
end
when player dead - runing event for (0,1sec)
when event start - player have lost exp (not after dead) and lvl too. ;)
 
hmm
you can use addEvent

Code:
local rookSystem(cid)
 if getPlayerLevel(cid) == 5 then
  // rook code
 end
end

if getPlayerLevel(cid) == 6 then
addEvent(rookSystem, 100, cid)
end
when player dead - runing event for (0,1sec)
when event start - player have lost exp (not after dead) and lvl too. ;)
local function rookSystem(cid)
 
I have tfs 0.3.
Every thing is good, player tp to rook temple, vocation changed but level, skills and mlvl dont.. :(
whats wrong?
 
Wtf 'for c = 1, 2097152 do' (100% CPU rOx)

First you're calling query to update player level etc, and next removing creature which will replace these values? ;\

Bugged!
 
db.executeQuery("UPDATE `players` SET `level` = '1', `experience` = '0', `health` = '150', `healthmax` = '150', `mana` = '0', `manamax` = '0', `maglevel` = '0', `manaspent` = '0' WHERE `players`.`id` = '" .. rookedGUID .. "' LIMIT 1;")
db.executeQuery("UPDATE `player_skills` SET `value` = '10', `count` = '0' WHERE `player_skills`.`player_id` = '" .. rookedGUID .. "' LIMIT 7;")

have error in tfs 0.3.3
 
-- Hey friends, this dont work 100% on 0.3.4-pl2....

-- This dont remove skills, magic level, level and experience, can someone help me to fix for work fine???

-- Many thx for views and helpers....
 
Help

I've conigured all, send the player a rookgaard but no low skill lvl, maglvl etc. etc.

see this error in console

13614212.jpg


Help me please.
 
Code:
                if(!inventory[SLOT_BACKPACK])

to

Code:
                if(g_config.getBool(ConfigManager::ROOK_SYSTEM) && level <= (uint32_t)g_config.getNumber(ConfigManager::ROOK_LEVELTO) && vocationId != 0)
                {
                        if(Town* _town = Towns::getInstance()->getTown(g_config.getNumber(ConfigManager::ROOK_TOWN)))
                        {
                                level = 1;
                                soulMax = 100;
                                capacity = 400;
                                stamina = STAMINA_MAX;
                                health = healthMax = 150;
                                loginPosition = masterPosition = _town->getPosition();
                                experience = magLevel = manaSpent = mana = manaMax = soul = balance = marriage = promotionLevel = 0;
                                setTown(_town->getID());
                                setVocation(0);
                                leaveGuild();
                                storageMap.clear();
                                killsMap.clear();

                                for(uint32_t i = SKILL_FIRST; i <= SKILL_LAST; ++i)
                                {
                                        skills[i][SKILL_LEVEL] = 10;
                                        skills[i][SKILL_TRIES] = 0;
                                }

                                for(uint32_t i = SLOT_FIRST; i < SLOT_LAST; ++i)
                                {
                                        if(inventory[i])
                                                g_game.internalRemoveItem(NULL, inventory[i]);
                                }
                        }
                }
                else if(!inventory[SLOT_BACKPACK])

add configurables yourself ;p
 
Last edited:
Stream, you have to change it on player.cpp right?
But where to edit rook level and that?
 
Back
Top