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

Lua Creaturescript ::Rook System:: Help

Ateo

New Member
Joined
Apr 8, 2011
Messages
43
Reaction score
0
onPrepareDeath file:
LUA:
function onPrepareDeath(cid)
	if getPlayerLevel(cid) < 31 and getPlayerTown(cid) ~= 24 then
		doPlayerSetTown(cid, 24) --Rookgaard ID.
			for i = 1, 10 do --Drop Items.
                   local slotItem = getPlayerSlotItem(cid, i)
				if slotItem.itemid > 0 then
                doRemoveItem(slotItem.uid)
				end
			end
			
			setPlayerStorageValue(cid, 30001, -1) --First Items.
			setPlayerStorageValue(cid, 9999999, 1) --Rook2.
	end
return TRUE
end

Death file:
LUA:
dofile("./config.lua")

function onDeath(cid)
	if getPlayerStorageValue(cid,9999999) == 1 then
		if sqlType == "mysql" then
			env = luasql.mysql()
			sql = env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort)
		else -- sqlite
			env = luasql.sqlite3()
			sql = env:connect(sqliteDatabase)
		end

		sql:execute("UPDATE `players` SET `level` = '20',  `experience` = '98800', `health` = '185', `healthmax` = '185', `mana` = '35', `manamax` = '35', `maglevel` = '0', `manaspent` = '0' WHERE `id` = " .. getPlayerGUID(cid) .. " LIMIT 1;")
		
		sql:close()
		env:close()
		setPlayerStorageValue(cid, 9999999, -1)
end
end

I have The Forgotten Server - Version 0.2.12 (Mystic Spirit).
Thanks so much

- - - Updated - - -

the first code works fine, the problem is when trying to connect to the database (the console does not throw error)
 
O.o! what are this never in my life see this xd:
Code:
code]sql:execute
i remember only for querys in script is
Code:
db.executeQuery or db.query

Only say not connect database?
 
O.o! what are this never in my life see this xd:
Code:
code]sql:execute
i remember only for querys in script is
Code:
db.executeQuery or db.query

Only say not connect database?

effectively, but this command is correct because i copied from another default script(playerdeath)
and the console does not log any errors : /
 
O.o! what are this never in my life see this xd:
Code:
code]sql:execute
i remember only for querys in script is
Code:
db.executeQuery or db.query

Only say not connect database?

sqlite?...
@On: Check if everythings correct in config.lua first.
 
Back
Top