Witam, gdy robie reconnecta wyskakuje mi taki b??d :
WARNING: [skrypty_glowne]/ogrpg-db/s_db.lua:26: dbPoll failed; Not unique table/alias: 'ogrpg_organizations'
Nie posiadasz tabeli 'ogrpg_organizations'. Aby ja wgrac zaloguj sie do Bazy Danych nastepnie przejdz w zakladke Sql i wklej to:
CREATE TABLE IF NOT EXISTS `ogrpg_organizations` (
`id` int(11) NOT NULL,
`name` text NOT NULL,
`Shortcut` varchar(5) NOT NULL,
`liderid` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Podpis
Aktualny projekt: LSgame
Na scenie MTA od: 2015 roku.
Discord: Chwilowoo, brak
CREATE TABLE IF NOT EXISTS `ogrpg_organizations` (
`id` int(11) NOT NULL,
`name` text NOT NULL,
`Shortcut` varchar(5) NOT NULL,
`liderid` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
tabela MYSQL
function findPlayer(plr,cel)
local target=nil
if (tonumber(cel) ~= nil) then
for _,thePlayer in ipairs(getElementsByType("player")) do
if getElementData(thePlayer,"player:uid") == tonumber(cel) then target = thePlayer end
end
else -- podano fragment nicku
for _,thePlayer in ipairs(getElementsByType("player")) do
if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), cel:lower(), 0, true) then
if (target) then
outputChatBox("Znaleziono wiecej niz jednego gracza o pasujacym nicku, podaj wiecej liter.", plr)
return nil
end
target=thePlayer
end
end
end
if target and getElementData(target,"p:inv") then return nil end
return target
end
addEvent("lidero:editUser", true)
addEventHandler("lidero:editUser", resourceRoot, function(text,rank,faction)
local result1=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?", text)
if not result1 or #result1 < 0 then outputChatBox("* Podany u?ytkownik nie istnieje w bazie danych.", client, 255, 0, 0) return end
local result2=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=? AND uid=? LIMIT 1;", faction, text) -- pobieramy tylko JEDEN rekord
if not result2 or #result2 < 0 then outputChatBox("*Podany u?ytkownik nie znajduje si? w tej organizacji",client,255,0,0) return end
local ranke=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=? AND uid=? LIMIT 1;", faction, getElementData(client,"player:uid")) -- pobieramy tylko JEDEN rekord
if not ranke or #ranke < 0 then outputChatBox("*Nie znajdujesz si? w tej organizacji!",client,255,0,0) return end
if tonumber(ranke[1].rank) <= 3 and (tonumber(rank) > 2) then outputChatBox("*Posiadasz za ma?? range!",client,255,0,0) return end
local query1=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_organizations SET rank=? WHERE uid=? AND code=?", rank, text, faction)
if query1 then
local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=?", faction)
triggerClientEvent(client,"lidero:refresh",resourceRoot,resulted)
outputChatBox("* Pomy?lnie zmieniono rang? graczowi "..result1[1].login.." o id: "..faction.." na "..rank.." w organizacji.", client)
end
local target = findPlayer(client,text)
if target then outputChatBox("Twoja przynaleznosc w organizacji :"..faction.." zostala zaaktualizowana. Aby odej?? wpisz /opusc",target) end
end)
addEvent("lidero:addUser", true)
addEventHandler("lidero:addUser", resourceRoot, function(text,faction)
if string.len(text) < 0 then return end
local result1=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?", text)
if not result1 or #result1 < 0 then outputChatBox("* Podany u?ytkownik nie istnieje w bazie danych.", client, 255, 0, 0) return end
local result2=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=? and code=?", text, faction)
if result2 and #result2 > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w tej organizacji.", client, 255, 0, 0) return end
local result3=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=?", text)
if result3 and #result3 > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w innej organizacji.", client, 255, 0, 0) return end
local query1=exports["ogrpg-db"]:dbSet("INSERT ogrpg_organizations (uid,login,code) VALUES (?,?,?)",text,result1[1].login, faction)
local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=?", faction)
triggerClientEvent(client,"lidero:refresh",resourceRoot,resulted)
outputChatBox("* Pomy?lnie dodano gracza "..result1[1].login.." o uid: "..text.." w organizacji na 1 poziom", client)
outputDebugString("Organizacja : "..faction.." UID :"..text)
local target=findPlayer(client,text)
if target then
outputChatBox("Zosta?e? dodany do organizacji o nazwie :"..faction..". Aby odej?? wpisz /opusc",target)
setElementData(target,"player:organization",faction)
exports['ogrpg-db']:dbSet("UPDATE ogrpg_organizations SET actived=curdate() WHERE uid=?", getElementData(target,"player:uid"))
end
end)
addEvent("lidero:deleteUser", true)
addEventHandler("lidero:deleteUser", resourceRoot, function(text,faction)
local result1=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?", text)
if not result1 or #result1 < 0 then outputChatBox("* Podany u?ytkownik nie istnieje w bazie danych.", client, 255, 0, 0) return end
local result2=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=? AND uid=? LIMIT 1;", faction, text) -- pobieramy tylko JEDEN rekord
if not result2 or #result2 < 0 then outputChatBox("*Podany u?ytkownik nie znajduje si? w tej organizacji",client,255,0,0) return end
local query1=exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_organizations WHERE uid=? AND code=?",text, faction)
local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=?", faction)
triggerClientEvent(client,"lidero:refresh",resourceRoot,resulted)
outputChatBox("* Pomy?lnie usunieto gracza "..result1[1].login.." o uid: "..text.." z organizacji" , client)
local target = findPlayer(client,text)
if target then outputChatBox("Twoja przynaleznosc w organizacji :"..faction.." zostala zaaktualizowana.",target); setElementData(target,"player:organization",false) end
end)
addCommandHandler("org",function (plr,cmd,...)
local uid=getElementData(plr,"player:uid")
if not uid then return end
local code=getElementData(plr,"player:organization")
if not code then return end
local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=? AND uid=? LIMIT 1;", code, uid) -- pobieramy tylko JEDEN rekord
if result and #result > 0 then
if result[1].rank <= 2 then outputChatBox("*Brak uprawnien do panelu organizacji",plr) return end
local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=?", code)
triggerClientEvent(plr, "lidero:showGUI", resourceRoot,code, resulted)
end
end)
addCommandHandler("opusc",function (plr,cmd)
local uid=getElementData(plr,"player:uid")
if not uid then return end
local code=getElementData(plr,"player:organization")
if not code then outputChatBox("Nie jestes w ?adnej organizacji!",plr) return end
local query1=exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_organizations WHERE uid=? AND code=?",uid, code)
outputChatBox("Twoja przynaleznosc w organizacji :"..code.." zostala zaaktualizowana.",plr); setElementData(plr,"player:organization",false)
end)
addCommandHandler("ustawspawn",function (plr,cmd)
local uid=getElementData(plr,"player:uid")
if not uid then return end
local code=getElementData(plr,"player:organization:id")
if not code then outputChatBox("Nie jestes w ?adnej organizacji!",plr) return end
local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=? and code=?", uid,code) -- pobieramy tylko JEDEN rekord
if result and #result > 0 then
if result[1].rank <= 99 then outputChatBox("*Nie jestes g?ownym liderem",plr) return end
end
local int = getElementInterior(plr)
local dim = getElementDimension(plr)
local x,y,z = getElementPosition(plr)
if int > 0 then outputChatBox("Spawn nie moze byc w interiorze!",plr) return end
if dim > 0 then outputChatBox("Spawn nie moze byc w innym dimensionie!",plr) return end
local query1=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_organization_list set spawn=? where id=?", ("%s,%s,%s"):format(x,y,z),code)
outputChatBox("Spawn w twojej organizacji zostal zaaktualizowany.",plr)
for _,p in pairs(getElementsByType('player')) do
local gan = getElementData(p,"player:organization:id")
if gan == code then
outputChatBox("Spawn w twojej organizacji zostal zaaktualizowany.",p)
end
end
end)
function globalMessage(plr, cmd, ...)
local frakcja=getElementData(plr,'player:organization')
if not frakcja then
return
end
local msg = table.concat ( { ... }, " " )
local admins=getElementsByType('player')
for i,v in pairs(admins) do
local pfrakcje=getElementData(v,'player:organization')
if frakcja == pfrakcje then
outputChatBox("[ORGANIZACJA]: ("..getElementData(plr,"id")..") "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","")..": "..msg, v, 255, 96, 0, false)
end
end
end
addCommandHandler("organizacja", globalMessage)
addEventHandler("onResourceStart", root, function()
local players=getElementsByType('player')
for _, p in pairs(players) do
bindKey(p, "o", "down", "chatbox", "organizacja")
end
end)
addEventHandler( "onPlayerSpawn", getRootElement(),
function (_)
bindKey(source, "o", "down", "chatbox", "organizacja")
end
)
Ta tabelka powinna by? poprawna. Jak nie b?dzie to powied? jakiej paczki u?ywasz.
CREATE TABLE IF NOT EXISTS `ms_organizacje` (
`code` varchar(31) CHARACTER SET utf16 COLLATE utf16_polish_ci NOT NULL,
`login` varchar(121) CHARACTER SET utf16 COLLATE utf16_polish_ci NOT NULL,
`uid` int(11) NOT NULL,
`actived` date NOT NULL,
`rank` int(5) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach