Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local pointsMarkers={
- {"KGP", 1, -1596.26, 684.37, 49.62, 1, 0},
- {"PSP", 2, -2090.29, 519.20, 35.16, 0, 0},
- {"OSP", 3, 306.57, -155.28, 5.99, 0, 0},
- {"SDSA", 4, -2286.08, -168.54, 40.90, 0, 0},
- {"PR", 5, -1538.37, 1128.49, 7.22},
- {"PstoriesNews",6, 2458.93, -1666.57, 73.50, 1, 0},
- }
- for i,v in ipairs(pointsMarkers) do
- local marker=createMarker(v[3], v[4], v[5]-0.90, "cylinder", 1.5, 255, 0, 0,255)
- setElementData(marker,"marker:id",tonumber(v[2]))
- setElementInterior(marker, v[6])
- setElementDimension(marker, v[7])
- setElementData(marker,"marker:faction",v[1])
- local t=createElement("text")
- setElementPosition(t,v[3],v[4],v[5])
- setElementInterior(t, v[6])
- setElementDimension(t, v[7])
- setElementData(t,"name","Panel zarządania frakcją:\n"..v[1])
- end
- addEvent("lider:editUser", true)
- addEventHandler("lider: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("#ff0000✖ #ffffffTo UID nie należy do żadnego gracza!", client, 255, 0, 0,true) return end
- local result2=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions 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 frakcji",client,255,0,0) return end
- local query1=exports["ogrpg-db"]:dbSet("UPDATE `ogrpg_factions` SET `rank`=? WHERE `uid`=? AND `code`=?", rank, text, faction)
- if query1 then
- local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions JOIN ogrpg_users on ogrpg_factions.uid=ogrpg_users.id WHERE code=? order by rank desc", faction)
- triggerClientEvent(client,"lider:refresh",resourceRoot,resulted)
- outputChatBox("* Pomyślnie zmieniono rangę graczowi "..result1[1].login.." we frakcji o id: "..faction.." na "..rank, client)
- end
- end)
- addEvent("lider:addUser", true)
- addEventHandler("lider:addUser", 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_factions WHERE uid=? and code=?", text, faction)
- if result2 and #result2 > 0 then outputChatBox("* Podany użytkownik już znajduje się w tej frakcji.", client, 255, 0, 0) return end
- local result3=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions WHERE uid=?", text)
- if result3 and #result3 > 0 then outputChatBox("* Podany użytkownik już znajduje się w innej frakcji.", client, 255, 0, 0) return end
- local query1=exports["ogrpg-db"]:dbSet("INSERT ogrpg_factions (uid,code,actived) VALUES (?,?,NOW())",text, faction)
- if query1 then
- local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions JOIN ogrpg_users on ogrpg_factions.uid=ogrpg_users.id WHERE code=? order by rank desc", faction)
- triggerClientEvent(client,"lider:refresh",resourceRoot,resulted)
- outputChatBox("* Pomyślnie dodano gracza "..result1[1].login.." o uid: "..text.." we frakcji na 1 poziom", client)
- end
- end)
- addEvent("lider:deleteUser", true)
- addEventHandler("lider: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_factions 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 frakcji",client,255,0,0) return end
- local query1=exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_factions WHERE uid=? AND code=?",text, faction)
- if query1 then
- local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions JOIN ogrpg_users on ogrpg_factions.uid=ogrpg_users.id WHERE code=? order by rank desc", faction)
- triggerClientEvent(client,"lider:refresh",resourceRoot,resulted)
- outputChatBox("* Pomyślnie usunieto gracza "..result1[1].login.." o uid: "..text.." z frakcji" , client)
- end
- end)
- addEvent("panel:refreshgui", true)
- addEventHandler("panel:refreshgui", resourceRoot, function(code)
- local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions JOIN ogrpg_users on ogrpg_factions.uid=ogrpg_users.id WHERE code=? order by rank desc", code)
- triggerClientEvent(client, "lider:showGUI", resourceRoot,code, resulted)
- end)
- addEvent("lider:editweave", true)
- addEventHandler("lider:editweave", resourceRoot, function(name,text,faction)
- local uid = getElementData(client,"player:uid")
- local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions WHERE code=? AND uid=? LIMIT 1;", faction, uid)
- if faction == "KGP" then
- if result[1].rank < 17 then outputChatBox("* Do tej opcji ma dostęp tylko lider frakcji!",client,255,0,0) return end
- elseif faction == "PSP" then
- if result[1].rank < 19 then outputChatBox("* Do tej opcji ma dostęp tylko lider frakcji!",client,255,0,0) return end
- elseif faction == "SAMC" then
- if result[1].rank < 11 then outputChatBox("* Do tej opcji ma dostęp tylko lider frakcji!",client,255,0,0) return end
- elseif faction == "SM" then
- if result[1].rank < 16 then outputChatBox("* Do tej opcji ma dostęp tylko lider frakcji!",client,255,0,0) return end
- elseif faction == "SDSA" then
- if result[1].rank < 9 then outputChatBox("* Do tej opcji ma dostęp tylko lider frakcji!",client,255,0,0) return end
- elseif faction == "TAXI" then
- if result[1].rank < 11 then outputChatBox("* Do tej opcji ma dostęp tylko lider frakcji!",client,255,0,0) return end
- end
- local query1=exports["ogrpg-db"]:dbSet("UPDATE `ogrpg_factions` SET `wyplata`=? WHERE `uid`=? AND `code`=?", text*100, name, faction)
- exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_logs_wyplaty SET Nick=?, uid=?, Typ=?, Kwota=?,Frakcja=?","NWM",name,"Edycja",text*100,faction)
- end)
- addEventHandler("onMarkerHit", resourceRoot, function(el,md)
- if not md or getElementType(el) ~= "player" then return end
- local code=getElementData(source,"marker:faction")
- if not code then return end
- local uid=getElementData(el,"player:uid")
- if not uid then return end
- if not getElementData(el,"player:duty") then outputChatBox("*Wejdz na sluzbe",el) return end
- if getElementData(el,"player:duty") ~= code then outputChatBox("*Brak uprawnien / lub nie jestes na sluzbie",el) return end
- local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions WHERE code=? AND uid=? LIMIT 1;", code, uid) -- pobieramy tylko JEDEN rekord
- if result and #result > 0 then
- if code == "KGP" then
- if result[1].rank < 16 then outputChatBox("*Brak uprawnien",el) return end
- elseif code == "PSP" then
- if result[1].rank < 18 then outputChatBox("*Brak uprawnien",el) return end
- elseif code == "PR" then
- if result[1].rank < 10 then outputChatBox("*Brak uprawnien",el) return end
- elseif code == "SM" then
- if result[1].rank < 15 then outputChatBox("*Brak uprawnien",el) return end
- elseif code == "SDSA" then
- if result[1].rank < 9 then outputChatBox("*Brak uprawnien",el) return end
- elseif code == "TAXI" then
- if result[1].rank < 10 then outputChatBox("*Brak uprawnien",el) return end
- end
- local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions JOIN ogrpg_users on ogrpg_factions.uid=ogrpg_users.id WHERE code=? order by rank desc", code)
- triggerClientEvent(el, "lider:showGUI", resourceRoot,code, resulted)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment