What's new

[8.4 TFS] SQL B??d

Status
Not open for further replies.

Lokaty Lokacz

Active User
Joined
Apr 25, 2008
Messages
114
Reaction score
2
Takie co? wyskakuje mi na konsoli podczas ?mierci gracza... Czy ma kto? mo?e poprawny skrypt playerdeath.lua?? A je?li to nie tego problem to prosze o pomoc.

Code:
[31/01/2009  14:54:50] Lua Script Error: [CreatureScript Interface] 
[31/01/2009  14:54:50] data/creaturescripts/scripts/playerdeath.lua:onDeath

[31/01/2009  14:54:50] data/creaturescripts/scripts/playerdeath.lua:10: attempt to call field 'sqlite3' (a nil value)
[31/01/2009  14:54:50] stack traceback:
[31/01/2009  14:54:50] 	data/creaturescripts/scripts/playerdeath.lua:10: in function <data/creaturescripts/scripts/playerdeath.lua:3>

Pozdrawiam,
LoK
 

Ray

Senior User
Joined
Oct 20, 2008
Messages
1,050
Reaction score
170
Age
28
Odp: [8.4 TFS] SQL B??d

Nie jestem pewien czy pomo?e, ale spr?buj:

 

Lokaty Lokacz

Active User
Joined
Apr 25, 2008
Messages
114
Reaction score
2
Odp: [8.4 TFS] SQL B??d

Niestety nie pomog?o ;/ Widocznie to nie z powodu tego pliku ;/ Ma kto? jaki? pomys? w tej sprawie ??
 
Last edited:

Hulala

Senior User
Joined
May 2, 2008
Messages
539
Reaction score
37
Age
32
Odp: [8.4 TFS] SQL B??d

Prawdo podobnie co? zmienia?e? w tym pliku podmie? go to zobaczymy :)
 

Zarexu

Active User
Joined
Aug 15, 2008
Messages
78
Reaction score
4
Odp: [8.4 TFS] SQL B??d

Wpisa?e? w config.lua mysql czy sqlite?
 

Eturl

We shall know no fear!
Joined
May 21, 2008
Messages
2,280
Reaction score
463
Age
32
Odp: [8.4 TFS] SQL B??d

Najpierw to w config.lua powiniene? mie? tak:
Code:
-- SQL
	sqlType = "mysql"
	passwordType = "plain"
a tu masz zawarto?? mojego pliku jakby co:
Code:
dofile("./config.lua")
function onSay(cid, words, param)
	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 cur = assert(con:execute("SELECT `name`, `id` FROM `players` WHERE `name` = '" .. escapeString(param) .. "';"))
	local row = cur:fetch({}, "a")
	cur:close()
	if row ~= nil then
		local targetName = row.name
		local targetGUID = row.id
		local str = ""
		local breakline = ""
		for time, level, killed_by, is_player in rows(con, "SELECT `time`, `level`, `killed_by`, `is_player` FROM `player_deaths` WHERE `player_id` = " .. targetGUID .. " ORDER BY `time` DESC;") do
			if str ~= "" then
				breakline = "\n"
			end
			local date = os.date("*t", time)
			local article = ""
			if tonumber(is_player) ~= TRUE then
				killed_by = string.lower(killed_by)
				article = getArticle(killed_by) .. " "
			end
			if date.day < 10 then	date.day = "0" .. date.day	end
			if date.hour < 10 then	date.hour = "0" .. date.hour	end
			if date.min < 10 then	date.min = "0" .. date.min	end
			if date.sec < 10 then	date.sec = "0" .. date.sec	end
			str = str .. breakline .. " " .. date.day .. getMonthDayEnding(date.day) .. " " .. getMonthString(date.month) .. " " .. date.year .. " " .. date.hour .. ":" .. date.min .. ":" .. date.sec .. "   Died at Level " .. level .. " by " .. article .. killed_by .. "."
		end
		if str == "" then
			str = "No deaths."
		end
		doPlayerPopupFYI(cid, "Deathlist for player, " .. targetName .. ".\n\n" .. str)
	else
		doPlayerSendCancel(cid, "A player with that name does not exist.")
	end
	con:close()
	env:close()
end
 

Lokaty Lokacz

Active User
Joined
Apr 25, 2008
Messages
114
Reaction score
2
Odp: [8.4 TFS] SQL B??d

Config mam tak jak up, po podmienieniu Twojego kodu przy reloadzie wyskakuje co? takiego:

Code:
[01/02/2009  18:28:15] Warning: [Event::loadScript] Event onDeath not found. data/creaturescripts/scripts/playerdeath.lua
[01/02/2009  18:28:15] Reloaded all.

A gdy podmieni?em pliki od kolego RaOyL'a to nic to nie da?o i tak podczas ?mierci gracza wyskakiwa? taki komunikat.

Prosze o pomoc...


Edit:
Skopiowa?em stary playerdeath.lua i przy reloadzie nie wyskoczy? bl?d ale gdy zgino?em postaci? to znowu na konsoli co? takiego:

Code:
[01/02/2009  18:32:29] Lua Script Error: [CreatureScript Interface] 
[01/02/2009  18:32:29] data/creaturescripts/scripts/playerdeath.lua:onDeath

[01/02/2009  18:32:29] data/creaturescripts/scripts/playerdeath.lua:10: attempt to call field 'sqlite3' (a nil value)
[01/02/2009  18:32:29] stack traceback:
[01/02/2009  18:32:29] 	data/creaturescripts/scripts/playerdeath.lua:10: in function <data/creaturescripts/scripts/playerdeath.lua:3>
 
Last edited:
Status
Not open for further replies.
Top