iSanto
Demetri-World.net
- Joined
- Jan 8, 2011
- Messages
- 922
- Reaction score
- 87
Witam,
Chcia?bym przedstawi? m?j autorski skrypt na zg?aszanie b??d?w gry. Od razu m?wi?, ?e nie jestem jakim? super skrypterem, zatem kod nie jest jako? super optymalny. Stara?em si? napisa? ten system jak najlepiej umia?em.
System jest zapewne bardzo przydatny dla serwer?w RPG, gdzie mo?liwe, ?e gracze b?d? korzysta? z niego intensywnie.
Ka?da osoba na kanale, widzi zg?oszenie gracza.
Istnieje r?wnie? komenda dla GM?w+ /bug.
Mo?liwe opcja:
/bug info, id_buga:
/bug info, all:
/bug status, id_buga:
/bug status, all:
/bug help:
Oraz:
/bug set, id_buga, status
Status mo?e by?: fix, unfix, fixing
Np. /bug set, 2, fix
Ustawia status buga o id 2 na naprawiony przez osob?, kt?ra napisa?a t? komend?:
lub
Np. /bug set, 2, fix, Matt
Ustawia status buga o id 2 na naprawiony przez osob? o nazwie Matt:
Istniej? r?wnie? inne bajerki jak np, wiadomo?? na kanale Bug Tracker, kto aktualnie ma otworzony kana?, kto otworzy? kana?, kto zamkn?? kana?:
Zach?cam do korzystania.
Najpierw tworzymy zapytanie w naszej bazie danych:
[SQL]CREATE TABLE IF NOT EXISTS `bug_tracker_ingame` (
`id_bug` INT AUTO_INCREMENT,
`name` varchar(255) ,
`description` text ,
`posx` INT,
`posy` INT,
`posz` INT,
`time` date,
`status` INT NOT NULL DEFAULT '0',
`repairer` varchar(255) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_bug`)
) [/SQL]
Nast?pnie wchodzimy do data/XML/channels.xml i wklejamy:
[XML]<channel id="10" name="Bug Tracker" access="4" logged="yes"/>[/XML]
Teraz data/creaturescripts/creaturescripts.xml wklejamy:
[XML] <event type="joinchannel" name="BugTrackerChannel" event="script" value="bugtrackerchannel.lua"/>
<event type="leavechannel" name="BugTrackerChannelLeft" event="script" value="bugtrackerchannel.lua"/>[/XML]
wchodzimy w data/creaturescripts/scripts/login.lua i wklejamy:
[LUA] registerCreatureEvent(cid, "BugTrackerChannel")
registerCreatureEvent(cid, "BugTrackerChannelLeft")[/LUA]
Wchodzimy w data/creaturescripts/scripts i tworzymy plik o nazwie: bugtrackerchannel.lua
Wklejamy do niego:
[LUA]function onJoinChannel(cid, channelId, users)
if(channelId == 10) then
local players = {}
for k, v in pairs(users) do
table.insert(players, getPlayerName(v))
end
addEvent(doPlayerSendChannelMessage, 150, cid, "Bug Tracker System:", "Osoby uprawnione na kanale: "..table.concat(players, ', '), TALKTYPE_CHANNEL_W, 10)
for k, v in pairs(users) do
doPlayerSendChannelMessage(v, "System:", "Gracz " .. getCreatureName(cid) .. " otworzy? kanal.", TALKTYPE_CHANNEL_W, 10)
end
end
return true
end
function onLeaveChannel (cid, channel, users)
if(channel == 10) then
for k, v in pairs(users) do
doPlayerSendChannelMessage(v, "System:", "Gracz " .. getCreatureName(cid) .. " opuscil kanal.", TALKTYPE_CHANNEL_W, 10)
end
end
return true
end
[/LUA]
Nast?pnie wchodzimy do data/talkactions/talkactions.xml i wklejamy:
[XML]<talkaction words="!bug" event="script" value="bugtracker.lua"/>[/XML]
oraz:
[XML]<talkaction words="/bug" access="4" event="script" value="bugtracker_gm.lua"/>[/XML]
Teraz wchodzimy do data/talkactions/scripts i tworzymy plik o nazwie: bugtracker.lua . Wklejamy do niego:
[LUA]function onSay(cid, words, param, channel)
local storage = 193728
local seconds = 40
local position_player = getPlayerPosition(cid)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have to write here your message to administration.")
return true
end
if exhaustion.get(cid, storage) then
pause = math.floor(((exhaustion.get(cid, storage)) + 1))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have to wait "..pause.." seconds to be able report next bug.")
return true
end
db.query("INSERT INTO `bug_tracker_ingame` (`id_bug`, `name`, `description`, `posx`, `posy`, `posz`, `time`) VALUES (null, "..db.escapeString(getPlayerName(cid))..", "..db.escapeString(param)..", "..position_player.x..", "..position_player.y..", "..position_player.z..", "..os.date("%Y", times)..""..os.date("%m", times)..""..os.date("%d", times).." );")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your request has been sent.")
exhaustion.set(cid, storage, seconds)
local target = db.getResult("SELECT `name`, `id_bug`, `description`, `posx`, `posy`, `posz` FROM `bug_tracker_ingame` ORDER BY `id_bug` DESC LIMIT 1")
if(target:getID() == -1) then
return true
end
local nickGracza = target:getDataString("name")
local idGracza = target:getDataInt("id_bug")
local desc = target:getDataString("description")
local x = target:getDataInt("posx")
local y = target:getDataInt("posy")
local z = target:getDataInt("posz")
target:free()
for _, pid in ipairs(getPlayersOnline()) do
if getPlayerAccess(pid) > 3 then
doPlayerOpenChannel(pid, 11)
addEvent(doPlayerSendChannelMessage, 500, pid, "Bug Tracker System" , "\n Nr. Zgloszenia: " .. idGracza .." \n Nick Gracza: " .. nickGracza .. "\n Opis bledu: "..desc .." \n Pozycja gracza: ".. x ..", ".. y ..", ".. z .." \n Data: "..os.date("%x", times).." "..os.date("%X", times).."", TALKTYPE_CHANNEL_O, 11)
end
end
return true
end[/LUA]
Nast?pnie w tym samym folderze tworzymy plik o nazwie bugtracker_gm.lua i wklejamy:
[LUA]function RetText(value)
if value == 0 then
return "not fixed"
elseif value == 1 then
return "fixed"
elseif value == 2 then
return "currently is fixing"
end
end
function reapir(person)
if not (person == "0") then return person else return "None." end
end
function repair(stan, funkcja)
if stan == 0 or stan == 1 then return "Repaired by: "..reapir(funkcja) end return "Repairing by: "..reapir(funkcja)
end
function onSay(cid, words, param, channel)
local tile = string.explode(param, ",")
local playersList = {}
local words = {"status", "set", "info", "help"}
local playersResult = db.getResult("SELECT `id_bug`, `status`, `repairer`, `name`, `description`, `posx`, `posy`, `posz`, `time` FROM `bug_tracker_ingame`")
local tbl = {
[0] = {status = "unfix"},
[1] = {status = "fix"},
[2] = {status = "fixing"}
}
local function tiles()
if not tile[4] then return getPlayerName(cid) else return tile[4] end
end
if not isInArray(words, tile[1]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Unknown command. If you don\'t know how use this command write /bug help .")
return true
end
if tile[1] == "help" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Bug commands\n 1. \"/bug status, bug_id\" e.g /bug status, 3. Show selected bug status.\n 2. \"/bug status, all\" Show all bugs status. \n 3.\"/bug set, bug_id, status\" e.g /bug set, 3, fix, Santo. Where bug_id - id bug, status - could be \"fix\", \"unfix\" or \"fixing\". This set status bug on fix by Santo. \n 4. \"/bug info, bug_id\" eg. /bug info, 2 Shows information about the selected bug. \n 5. \"/bug info, all\" Show informations about all bugs.")
return true
end
if(playersResult:getID() ~= -1) then
repeat
playersList[playersResult:getDataInt("id_bug")] = {playersResult:getDataInt("status"), playersResult:getDataString("repairer"), playersResult:getDataString("name"), playersResult:getDataString("description"), playersResult:getDataInt("posx"), playersResult:getDataInt("posy"), playersResult:getDataInt("posz"), playersResult:getDataString("time")}
until not(playersResult:next())
playersResult:free()
else
return true
end
if tile[1] == "info" then
if tile[2] == "all" then
local tekst_info = ""
for guid, data in pairs(playersList) do
tekst_info = tekst_info .. "ID Bug: " .. guid .. "\n Status: " .. RetText(data[1]) .. "\n Nick: ".. data[3] .."\n Description: ".. data[4] .."\n Position: ".. data[5] ..", ".. data[6] ..", ".. data[7] .." \n Date: ".. data[8] .."\n\n"
end
doShowTextDialog(cid, 2050, tekst_info)
return true
elseif tonumber(tile[2]) then
for k, v in pairs(playersList) do
if k == tonumber(tile[2]) then
doShowTextDialog(cid, 2050,"ID Bug: " .. k .. "\n Status: " .. RetText(v[1]) .. "\n Nick: ".. v[3] .."\n Description: ".. v[4] .."\n Position: ".. v[5] ..", ".. v[6] ..", ".. v[7] .." \n Date: ".. v[8] .."" )
break
end
end
return true
elseif tile[2] == nil or not tonumber(tile[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To see informations about bug, you have to write ID bug.")
return true
end
end
if tile[1] == "status" then
if tile[2] == "all" then
local tekst = ""
for guid, data in pairs(playersList) do
tekst = tekst .. "ID Buga: " .. guid .. "\n Status: " .. RetText(data[1]) .. "\n "..repair(data[1], data[2]).."\n\n"
end
doShowTextDialog(cid, 2050, tekst)
return true
elseif tonumber(tile[2]) then
for k, v in pairs(playersList) do
if k == tonumber(tile[2]) then
doPlayerPopupFYI(cid, "Bug Status \n \n Bug ID: "..k.."\n Status: "..RetText(v[1]).."\n "..repair(v[1], v[2]).." ")
break
end
end
return true
elseif not tile[2] or not tonumber(tile[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To see status, you have to write ID bug.")
return true
end
return true
end
if tile[1] == "set" then
if not tonumber(tile[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Bug ID must be a number.")
return true
end
tile_string=0
for i=0, #tbl do
if not isInArray(tbl.status, tile[3]) then
tile_string=tile_string+1
end
end
if tile_string == 3 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only write status: 'fix', 'unfix' or 'fixing'.")
return true
end
for k, v in pairs(tbl) do
if tile[3] == v.status then
db.query("UPDATE `bug_tracker_ingame` SET `repairer` = "..db.escapeString(tiles())..", `status` = "..k.." WHERE `id_bug` = " .. db.escapeString(tile[2]))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You set bug status about ID: " .. tile[2] .." on "..RetText(k).." by: "..tiles()..".")
end
end
end
local target_s = db.getResult("SELECT `status`, `repairer` FROM `bug_tracker_ingame` WHERE `id_bug` = "..db.escapeString(tile[2]).." LIMIT 1")
if(target_s:getID() == -1) then
return true
end
local stat_s = target_s:getDataInt("status")
local repai_s = target_s:getDataString("repairer")
target_s:free()
for _, pid in ipairs(getPlayersOnline()) do
if getPlayerAccess(pid) > 3 then
doPlayerOpenChannel(pid, 10)
addEvent(doPlayerSendChannelMessage, 500, pid, "Bug Tracker System" , " "..getPlayerName(cid).." set bug status about ID: "..tile[2].." on "..RetText(stat_s).." by "..repai_s..".", TALKTYPE_CHANNEL_O, 10)
end
end
return true
end[/LUA]
To wszystko!
Jak napisa?em wcze?niej, nie jest on mo?e jako? super optymalny, ale uwa?am, ?e mo?e si? on przyda? na wielu serwerach. Skrypt jest ca?kowicie bezpieczny.
Jest to v. 0.1.
Planuj? dalsze aktualizacje i optymalizacje kodu.
Specjalne podzi?kowania za porady dla: [user]Matt[/user] oraz [user]G?sior.pl[/user]
Zabraniam kopiowania tego systemu na inne fora bez mojej wiedzy!
Chcia?bym przedstawi? m?j autorski skrypt na zg?aszanie b??d?w gry. Od razu m?wi?, ?e nie jestem jakim? super skrypterem, zatem kod nie jest jako? super optymalny. Stara?em si? napisa? ten system jak najlepiej umia?em.
System jest zapewne bardzo przydatny dla serwer?w RPG, gdzie mo?liwe, ?e gracze b?d? korzysta? z niego intensywnie.
System zg?aszania bug?w dzia?a na podstawie komendy dost?pnej dla graczy !bug. Gracz pisz? np: !bug Nie dzia?aj?ca skrzynka questowa. System zapisuje pozycj? gracza, jego nick, tre?? zg?oszenia oraz dat? zg?oszenia b??du.
Po wys?aniu wiadomo?ci zalogowanym osob? z accesem 4 (GM) lub wi?kszym, otwiera si? specjalny kana? Bug Tracker. Wygl?da to nast?puj?co:
Ka?da osoba na kanale, widzi zg?oszenie gracza.
Istnieje r?wnie? komenda dla GM?w+ /bug.
Mo?liwe opcja:
/bug info, id_buga:
/bug info, all:
/bug status, id_buga:
/bug status, all:
/bug help:
Oraz:
/bug set, id_buga, status
Status mo?e by?: fix, unfix, fixing
Np. /bug set, 2, fix
Ustawia status buga o id 2 na naprawiony przez osob?, kt?ra napisa?a t? komend?:
lub
Np. /bug set, 2, fix, Matt
Ustawia status buga o id 2 na naprawiony przez osob? o nazwie Matt:
Istniej? r?wnie? inne bajerki jak np, wiadomo?? na kanale Bug Tracker, kto aktualnie ma otworzony kana?, kto otworzy? kana?, kto zamkn?? kana?:
Zach?cam do korzystania.
PHP:
Version: 0.1
Tested on: TFS 0.4_dev r.3884
Najpierw tworzymy zapytanie w naszej bazie danych:
[SQL]CREATE TABLE IF NOT EXISTS `bug_tracker_ingame` (
`id_bug` INT AUTO_INCREMENT,
`name` varchar(255) ,
`description` text ,
`posx` INT,
`posy` INT,
`posz` INT,
`time` date,
`status` INT NOT NULL DEFAULT '0',
`repairer` varchar(255) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_bug`)
) [/SQL]
Nast?pnie wchodzimy do data/XML/channels.xml i wklejamy:
[XML]<channel id="10" name="Bug Tracker" access="4" logged="yes"/>[/XML]
Teraz data/creaturescripts/creaturescripts.xml wklejamy:
[XML] <event type="joinchannel" name="BugTrackerChannel" event="script" value="bugtrackerchannel.lua"/>
<event type="leavechannel" name="BugTrackerChannelLeft" event="script" value="bugtrackerchannel.lua"/>[/XML]
wchodzimy w data/creaturescripts/scripts/login.lua i wklejamy:
[LUA] registerCreatureEvent(cid, "BugTrackerChannel")
registerCreatureEvent(cid, "BugTrackerChannelLeft")[/LUA]
Wchodzimy w data/creaturescripts/scripts i tworzymy plik o nazwie: bugtrackerchannel.lua
Wklejamy do niego:
[LUA]function onJoinChannel(cid, channelId, users)
if(channelId == 10) then
local players = {}
for k, v in pairs(users) do
table.insert(players, getPlayerName(v))
end
addEvent(doPlayerSendChannelMessage, 150, cid, "Bug Tracker System:", "Osoby uprawnione na kanale: "..table.concat(players, ', '), TALKTYPE_CHANNEL_W, 10)
for k, v in pairs(users) do
doPlayerSendChannelMessage(v, "System:", "Gracz " .. getCreatureName(cid) .. " otworzy? kanal.", TALKTYPE_CHANNEL_W, 10)
end
end
return true
end
function onLeaveChannel (cid, channel, users)
if(channel == 10) then
for k, v in pairs(users) do
doPlayerSendChannelMessage(v, "System:", "Gracz " .. getCreatureName(cid) .. " opuscil kanal.", TALKTYPE_CHANNEL_W, 10)
end
end
return true
end
[/LUA]
Nast?pnie wchodzimy do data/talkactions/talkactions.xml i wklejamy:
[XML]<talkaction words="!bug" event="script" value="bugtracker.lua"/>[/XML]
oraz:
[XML]<talkaction words="/bug" access="4" event="script" value="bugtracker_gm.lua"/>[/XML]
Teraz wchodzimy do data/talkactions/scripts i tworzymy plik o nazwie: bugtracker.lua . Wklejamy do niego:
[LUA]function onSay(cid, words, param, channel)
local storage = 193728
local seconds = 40
local position_player = getPlayerPosition(cid)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have to write here your message to administration.")
return true
end
if exhaustion.get(cid, storage) then
pause = math.floor(((exhaustion.get(cid, storage)) + 1))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have to wait "..pause.." seconds to be able report next bug.")
return true
end
db.query("INSERT INTO `bug_tracker_ingame` (`id_bug`, `name`, `description`, `posx`, `posy`, `posz`, `time`) VALUES (null, "..db.escapeString(getPlayerName(cid))..", "..db.escapeString(param)..", "..position_player.x..", "..position_player.y..", "..position_player.z..", "..os.date("%Y", times)..""..os.date("%m", times)..""..os.date("%d", times).." );")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your request has been sent.")
exhaustion.set(cid, storage, seconds)
local target = db.getResult("SELECT `name`, `id_bug`, `description`, `posx`, `posy`, `posz` FROM `bug_tracker_ingame` ORDER BY `id_bug` DESC LIMIT 1")
if(target:getID() == -1) then
return true
end
local nickGracza = target:getDataString("name")
local idGracza = target:getDataInt("id_bug")
local desc = target:getDataString("description")
local x = target:getDataInt("posx")
local y = target:getDataInt("posy")
local z = target:getDataInt("posz")
target:free()
for _, pid in ipairs(getPlayersOnline()) do
if getPlayerAccess(pid) > 3 then
doPlayerOpenChannel(pid, 11)
addEvent(doPlayerSendChannelMessage, 500, pid, "Bug Tracker System" , "\n Nr. Zgloszenia: " .. idGracza .." \n Nick Gracza: " .. nickGracza .. "\n Opis bledu: "..desc .." \n Pozycja gracza: ".. x ..", ".. y ..", ".. z .." \n Data: "..os.date("%x", times).." "..os.date("%X", times).."", TALKTYPE_CHANNEL_O, 11)
end
end
return true
end[/LUA]
Nast?pnie w tym samym folderze tworzymy plik o nazwie bugtracker_gm.lua i wklejamy:
[LUA]function RetText(value)
if value == 0 then
return "not fixed"
elseif value == 1 then
return "fixed"
elseif value == 2 then
return "currently is fixing"
end
end
function reapir(person)
if not (person == "0") then return person else return "None." end
end
function repair(stan, funkcja)
if stan == 0 or stan == 1 then return "Repaired by: "..reapir(funkcja) end return "Repairing by: "..reapir(funkcja)
end
function onSay(cid, words, param, channel)
local tile = string.explode(param, ",")
local playersList = {}
local words = {"status", "set", "info", "help"}
local playersResult = db.getResult("SELECT `id_bug`, `status`, `repairer`, `name`, `description`, `posx`, `posy`, `posz`, `time` FROM `bug_tracker_ingame`")
local tbl = {
[0] = {status = "unfix"},
[1] = {status = "fix"},
[2] = {status = "fixing"}
}
local function tiles()
if not tile[4] then return getPlayerName(cid) else return tile[4] end
end
if not isInArray(words, tile[1]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Unknown command. If you don\'t know how use this command write /bug help .")
return true
end
if tile[1] == "help" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Bug commands\n 1. \"/bug status, bug_id\" e.g /bug status, 3. Show selected bug status.\n 2. \"/bug status, all\" Show all bugs status. \n 3.\"/bug set, bug_id, status\" e.g /bug set, 3, fix, Santo. Where bug_id - id bug, status - could be \"fix\", \"unfix\" or \"fixing\". This set status bug on fix by Santo. \n 4. \"/bug info, bug_id\" eg. /bug info, 2 Shows information about the selected bug. \n 5. \"/bug info, all\" Show informations about all bugs.")
return true
end
if(playersResult:getID() ~= -1) then
repeat
playersList[playersResult:getDataInt("id_bug")] = {playersResult:getDataInt("status"), playersResult:getDataString("repairer"), playersResult:getDataString("name"), playersResult:getDataString("description"), playersResult:getDataInt("posx"), playersResult:getDataInt("posy"), playersResult:getDataInt("posz"), playersResult:getDataString("time")}
until not(playersResult:next())
playersResult:free()
else
return true
end
if tile[1] == "info" then
if tile[2] == "all" then
local tekst_info = ""
for guid, data in pairs(playersList) do
tekst_info = tekst_info .. "ID Bug: " .. guid .. "\n Status: " .. RetText(data[1]) .. "\n Nick: ".. data[3] .."\n Description: ".. data[4] .."\n Position: ".. data[5] ..", ".. data[6] ..", ".. data[7] .." \n Date: ".. data[8] .."\n\n"
end
doShowTextDialog(cid, 2050, tekst_info)
return true
elseif tonumber(tile[2]) then
for k, v in pairs(playersList) do
if k == tonumber(tile[2]) then
doShowTextDialog(cid, 2050,"ID Bug: " .. k .. "\n Status: " .. RetText(v[1]) .. "\n Nick: ".. v[3] .."\n Description: ".. v[4] .."\n Position: ".. v[5] ..", ".. v[6] ..", ".. v[7] .." \n Date: ".. v[8] .."" )
break
end
end
return true
elseif tile[2] == nil or not tonumber(tile[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To see informations about bug, you have to write ID bug.")
return true
end
end
if tile[1] == "status" then
if tile[2] == "all" then
local tekst = ""
for guid, data in pairs(playersList) do
tekst = tekst .. "ID Buga: " .. guid .. "\n Status: " .. RetText(data[1]) .. "\n "..repair(data[1], data[2]).."\n\n"
end
doShowTextDialog(cid, 2050, tekst)
return true
elseif tonumber(tile[2]) then
for k, v in pairs(playersList) do
if k == tonumber(tile[2]) then
doPlayerPopupFYI(cid, "Bug Status \n \n Bug ID: "..k.."\n Status: "..RetText(v[1]).."\n "..repair(v[1], v[2]).." ")
break
end
end
return true
elseif not tile[2] or not tonumber(tile[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To see status, you have to write ID bug.")
return true
end
return true
end
if tile[1] == "set" then
if not tonumber(tile[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Bug ID must be a number.")
return true
end
tile_string=0
for i=0, #tbl do
if not isInArray(tbl.status, tile[3]) then
tile_string=tile_string+1
end
end
if tile_string == 3 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only write status: 'fix', 'unfix' or 'fixing'.")
return true
end
for k, v in pairs(tbl) do
if tile[3] == v.status then
db.query("UPDATE `bug_tracker_ingame` SET `repairer` = "..db.escapeString(tiles())..", `status` = "..k.." WHERE `id_bug` = " .. db.escapeString(tile[2]))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You set bug status about ID: " .. tile[2] .." on "..RetText(k).." by: "..tiles()..".")
end
end
end
local target_s = db.getResult("SELECT `status`, `repairer` FROM `bug_tracker_ingame` WHERE `id_bug` = "..db.escapeString(tile[2]).." LIMIT 1")
if(target_s:getID() == -1) then
return true
end
local stat_s = target_s:getDataInt("status")
local repai_s = target_s:getDataString("repairer")
target_s:free()
for _, pid in ipairs(getPlayersOnline()) do
if getPlayerAccess(pid) > 3 then
doPlayerOpenChannel(pid, 10)
addEvent(doPlayerSendChannelMessage, 500, pid, "Bug Tracker System" , " "..getPlayerName(cid).." set bug status about ID: "..tile[2].." on "..RetText(stat_s).." by "..repai_s..".", TALKTYPE_CHANNEL_O, 10)
end
end
return true
end[/LUA]
To wszystko!
Jak napisa?em wcze?niej, nie jest on mo?e jako? super optymalny, ale uwa?am, ?e mo?e si? on przyda? na wielu serwerach. Skrypt jest ca?kowicie bezpieczny.
Jest to v. 0.1.
Planuj? dalsze aktualizacje i optymalizacje kodu.
Specjalne podzi?kowania za porady dla: [user]Matt[/user] oraz [user]G?sior.pl[/user]
Zabraniam kopiowania tego systemu na inne fora bez mojej wiedzy!