Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2017-03-11, 14:07


Pemo97







Wiek: 26
Na forum: 3822 dni
Posty: 49

Piwa: 3

Respekt: 45,3

Witam, mam gm'a Pystories 3.0, i jest maa?y problem. Gdy dodaje si? auto do organizacji w urz?dzie, to poprostu tego autaa nie daje do organizacji.. osoby w org. nie moga nim jezdzic

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-11, 14:29


Avenged

Młodszy Szkrypter






Wiek: 23
Na forum: 3510 dni
Posty: 654
Nick w MP: Avenged

Piwa: 1570

Respekt: 326,3
Respekt: 326,3Respekt: 326,3Respekt: 326,3

Jakie? b??dy lub db3?

Podpis
LUA, JS, PHP



Zapraszam do skorzystania z moich usług: Klik

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-11, 14:47


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

A mo?e kod dasz?

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-11, 14:54


Pemo97







Wiek: 26
Na forum: 3822 dni
Posty: 49

Piwa: 3

Respekt: 45,3

Kod:

local zaproszenia = {}
local max_people_in_org = 55 ---- MAKSYMALNA LICZBA LUDZI W ORGANIZACJI!
function findPlayer(plr,cel)
local target=nil
if (tonumber(cel) ~= nil) then
for _,thePlayer in ipairs(getElementsByType("player")) do
if getElementData(thePlayer,"player:sid") == 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["pystories-db"]:dbGet("SELECT * FROM pystories_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["pystories-db"]:dbGet("SELECT * FROM ms_organizacje 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["pystories-db"]:dbGet("SELECT * FROM ms_organizacje 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["pystories-db"]:dbSet("UPDATE ms_organizacje SET rank=? WHERE uid=? AND code=?", rank, text, faction)
if query1 then
local resulted=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje 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 przynale?no?? w organizacji: "..faction.." zosta?a zaaktualizowana. Aby odej?? wpisz /opusc.organizacje",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["pystories-db"]:dbGet("SELECT * FROM pystories_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["pystories-db"]:dbGet("SELECT * FROM ms_organizacje 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 result=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=?", faction)
if result and #result >= max_people_in_org then outputChatBox("* Posiadasz ju? maksymaln? liczbe ludzi w organizacji.", client, 255, 0, 0) return end
local result3=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje 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 target=findPlayer(client,text)
if target then
if zaproszenia[target] then outputChatBox("** Gracz ju? dosta? zaproszenie !",client) return end
if zaproszenia[target] and isTimer(zaproszenia[target][3]) then killTimer(zaproszenia[target][3]) end
zaproszenia[target] = {faction,client,setTimer(function() zaproszenia[target] = nil end ,10000,1)}
outputChatBox("* Zosta?e?(a?) zaproszony(a) do organizacji o nazwie :"..faction.." !",target,0,255,0)
outputChatBox("* Masz 10 sekund na zaakceptowanie zaproszenia! (Wpisz /akceptuj.organizacje)",target,0,255,0)
end
end)
addEvent("lidero:deleteUser", true)
addEventHandler("lidero:deleteUser", resourceRoot, function(text,faction)
local result1=exports["pystories-db"]:dbGet("SELECT * FROM pystories_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["pystories-db"]:dbGet("SELECT * FROM ms_organizacje 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["pystories-db"]:dbSet("DELETE FROM ms_organizacje WHERE uid=? AND code=?",text, faction)
local resulted=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=?", faction)
triggerClientEvent(client,"lidero:refresh",resourceRoot,resulted)
outputChatBox("* Pomy?lnie usunieto gracza "..result1[1].login.." o SID: "..text.." z organizacji" , client)
local target = findPlayer(client,text)
if target then outputChatBox("* Twoja przynale?no?? w organizacji: "..faction.." zosta?a zaaktualizowana.",target); setElementData(target,"player:organization",false) end
end)

addCommandHandler("panel.organizacji",function (plr,cmd,...)
local uid=getElementData(plr,"player:sid")
if not uid then return end
local code=getElementData(plr,"player:organization")
if not code then return end
local result=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje 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 uprawnie? do panelu organizacji !",plr) return end
local resulted=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=?", code)
triggerClientEvent(plr, "lidero:showGUI", resourceRoot,code, resulted)
end
end)
addCommandHandler("akceptuj.organizacje",function (plr,cmd)
local uid=getElementData(plr,"player:sid")
if not uid then return end
if not zaproszenia[plr] then outputChatBox("* Nie masz zaproszenia do organizacji lub przedawni?o si? !",plr,255,0,0) return end
local result1=exports["pystories-db"]:dbGet("SELECT * FROM pystories_users WHERE id=?", uid)
if not result1 or #result1 < 0 then outputChatBox("* Nie wczytano twoich danych !", plr, 255, 0, 0) return end
local result=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE uid=? and code=?", uid, zaproszenia[plr][1])
if result and #result > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w tej organizacji.", client, 255, 0, 0) return end
local result=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE uid=?", uid)
if result and #result > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w innej organizacji.", client, 255, 0, 0) return end
local query1=exports["pystories-db"]:dbSet("INSERT ms_organizacje (uid,login,code) VALUES (?,?,?)",uid,result1[1].login, zaproszenia[plr][1])
if isElement(zaproszenia[plr][2]) then
if isTimer(zaproszenia[plr][3]) then killTimer(zaproszenia[plr][3]) end
local resulted=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=?", zaproszenia[plr][1])
triggerClientEvent(zaproszenia[plr][2],"lidero:refresh",resourceRoot,resulted)
outputChatBox("* Pomy?lnie dodano gracza "..result1[1].login.." o SID: "..uid.." w organizacji na 1 poziom", zaproszenia[plr][2])
end
outputDebugString("ms_organizacje> Organizacja: "..zaproszenia[plr][1].." SID: "..uid)
outputChatBox("* Akceptowa?e?(a?) zaproszenie do organizacji o nazwie: "..zaproszenia[plr][1]..". Aby odej?? wpisz /opusc.organizacje",plr)
setElementData(plr,"player:organization",zaproszenia[plr][1])
exports['pystories-db']:dbSet("UPDATE ms_organizacje SET actived=curdate() WHERE uid=?", getElementData(plr,"player:sid"))
zaproszenia[plr] = nil
end)
addCommandHandler("opusc.organizacje",function (plr,cmd)
local uid=getElementData(plr,"player:sid")
if not uid then return end
local code=getElementData(plr,"player:organization")
if not code then outputChatBox("* Nie posiadasz ?adnej organizacji !",plr) return end
local query1=exports["pystories-db"]:dbSet("DELETE FROM ms_organizacje WHERE uid=? AND code=?",uid, code)
outputChatBox("* Opu?ci?e?(a?) organizacje "..code.." !",plr); setElementData(plr,"player:organization",false)

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("#000000"..pfrakcje.."> #FFFFFF"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."#FFFFFF:#FFFFFF "..msg:gsub("#%x%x%x%x%x%x",""), v,_,_,_,true)
end
end
local desc = "[ORGANIZACJA] ["..getElementData(plr,"id").."]"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."("..getElementData(plr,"player:organization").."): "..msg:gsub("#%x%x%x%x%x%x","")..""
triggerEvent("admin:addText", resourceRoot, desc:gsub("#%x%x%x%x%x%x",""))
outputServerLog(desc)
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
)
czasami te? w konsoli wyst?puje b??d: [2017-03-11 14] WARNING: [pystories]/[skrypty]/pystories-db/s_db.lua:18: dbPoll failed; Unknown column 'sid' in 'where clause'

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-11, 14:55


Avenged

Młodszy Szkrypter






Wiek: 23
Na forum: 3510 dni
Posty: 654
Nick w MP: Avenged

Piwa: 1570

Respekt: 326,3
Respekt: 326,3Respekt: 326,3Respekt: 326,3

Pemo97, dodaj w znaczniki [.lua] [./lua] (bez kropki)

Podpis
LUA, JS, PHP



Zapraszam do skorzystania z moich usług: Klik

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-11, 15:16


Pemo97







Wiek: 26
Na forum: 3822 dni
Posty: 49

Piwa: 3

Respekt: 45,3

local zaproszenia = {}
local max_people_in_org 55 ---- MAKSYMALNA LICZBA LUDZI W ORGANIZACJI!
function findPlayer(plr,cel)
    local target=nil
    if (tonumber(cel) ~= nilthen
        for _,thePlayer in ipairs(getElementsByType("player")) do
            if getElementData(thePlayer,"player:sid") == tonumber(celthen 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(), 0truethen
                if (targetthen
                    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["pystories-db"]:dbGet("SELECT * FROM pystories_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["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=? AND uid=? LIMIT 1;"factiontext) -- 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["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=? AND uid=? LIMIT 1;"factiongetElementData(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) <= and (tonumber(rank) > 2then outputChatBox("*Posiadasz za ma?? range!",client,255,0,0) return end
    local query1=exports["pystories-db"]:dbSet("UPDATE ms_organizacje SET rank=? WHERE uid=? AND code=?"ranktextfaction)
    if query1 then
    local resulted=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje 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 przynale?no?? w organizacji: "..faction.." zosta?a zaaktualizowana. Aby odej?? wpisz /opusc.organizacje",targetend
end)
addEvent("lidero:addUser"true)
addEventHandler("lidero:addUser"resourceRoot, function(text,faction)
    if string.len(text) <= 0 then return end
    local result1=exports["pystories-db"]:dbGet("SELECT * FROM pystories_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["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE uid=? and code=?"textfaction)
    if result2 and #result2 > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w tej organizacji.", client, 255, 0, 0) return end
    local result=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=?"faction)
    if result and #result >= max_people_in_org then outputChatBox("* Posiadasz ju? maksymaln? liczbe ludzi w organizacji.", client, 255, 0, 0) return end
    local result3=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje 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 target=findPlayer(client,text)
    if target then
        if zaproszenia[targetthen outputChatBox("** Gracz ju? dosta? zaproszenie !",client) return end
        if zaproszenia[target] and isTimer(zaproszenia[target][3]) then killTimer(zaproszenia[target][3]) end
        zaproszenia[target] = {faction,client,setTimer(function() zaproszenia[target] = nil end ,10000,1)}
        outputChatBox("* Zosta?e?(a?) zaproszony(a) do organizacji o nazwie :"..faction.." !",target,0,255,0)
        outputChatBox("* Masz 10 sekund na zaakceptowanie zaproszenia! (Wpisz /akceptuj.organizacje)",target,0,255,0)
    end
end)
addEvent("lidero:deleteUser"true)
addEventHandler("lidero:deleteUser"resourceRoot, function(text,faction)
    local result1=exports["pystories-db"]:dbGet("SELECT * FROM pystories_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["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=? AND uid=? LIMIT 1;"factiontext) -- 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["pystories-db"]:dbSet("DELETE FROM ms_organizacje WHERE uid=? AND code=?",textfaction)
    local resulted=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=?"faction)
    triggerClientEvent(client,"lidero:refresh",resourceRoot,resulted)
    outputChatBox("* Pomy?lnie usunieto gracza "..result1[1].login.." o SID: "..text.." z organizacji" client)
    local target findPlayer(client,text)
    if target then outputChatBox("* Twoja przynale?no?? w organizacji: "..faction.." zosta?a zaaktualizowana.",target); setElementData(target,"player:organization",falseend
end)

addCommandHandler("panel.organizacji",function (plr,cmd,...)
    local uid=getElementData(plr,"player:sid")
    if not uid then return end
    local code=getElementData(plr,"player:organization")
    if not code then return end
    local result=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=? AND uid=? LIMIT 1;"codeuid) -- pobieramy tylko JEDEN rekord
    if result and #result > 0 then
        if result[1].rank <= 2 then outputChatBox("* Brak uprawnie? do panelu organizacji !",plr) return end
    local resulted=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=?"code)
        triggerClientEvent(plr"lidero:showGUI"resourceRoot,coderesulted)
    end
end)
addCommandHandler("akceptuj.organizacje",function (plr,cmd)
    local uid=getElementData(plr,"player:sid")
    if not uid then return end
    if not zaproszenia[plrthen outputChatBox("* Nie masz zaproszenia do organizacji lub przedawni?o si? !",plr,255,0,0) return end
    local result1=exports["pystories-db"]:dbGet("SELECT * FROM pystories_users WHERE id=?"uid)
    if not result1 or #result1 < 0 then outputChatBox("* Nie wczytano twoich danych !", plr, 255, 0, 0) return end 
    local result=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE uid=? and code=?"uid,  zaproszenia[plr][1])
    if result and #result > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w tej organizacji.", client, 255, 0, 0) return end
    local result=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE uid=?"uid)
    if result and #result > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w innej organizacji.", client, 255, 0, 0) return end
    local query1=exports["pystories-db"]:dbSet("INSERT ms_organizacje (uid,login,code) VALUES (?,?,?)",uid,result1[1].loginzaproszenia[plr][1])
    if isElement(zaproszenia[plr][2]) then
    if isTimer(zaproszenia[plr][3]) then killTimer(zaproszenia[plr][3]) end
    local resulted=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=?"zaproszenia[plr][1])
    triggerClientEvent(zaproszenia[plr][2],"lidero:refresh",resourceRoot,resulted)
    outputChatBox("* Pomy?lnie dodano gracza "..result1[1].login.." o SID: "..uid.." w organizacji na 1 poziom"zaproszenia[plr][2])
    end
    outputDebugString("ms_organizacje> Organizacja: "..zaproszenia[plr][1].." SID: "..uid)
    outputChatBox("* Akceptowa?e?(a?) zaproszenie do organizacji o nazwie: "..zaproszenia[plr][1]..". Aby odej?? wpisz /opusc.organizacje",plr) 
    setElementData(plr,"player:organization",zaproszenia[plr][1])
    exports['pystories-db']:dbSet("UPDATE ms_organizacje SET actived=curdate() WHERE uid=?"getElementData(plr,"player:sid"))
    zaproszenia[plr] = nil
end)
addCommandHandler("opusc.organizacje",function (plr,cmd)
    local uid=getElementData(plr,"player:sid")
    if not uid then return end
    local code=getElementData(plr,"player:organization")
    if not code then outputChatBox("* Nie posiadasz ?adnej organizacji !",plr) return end
    local query1=exports["pystories-db"]:dbSet("DELETE FROM ms_organizacje WHERE uid=? AND code=?",uidcode)
    outputChatBox("* Opu?ci?e?(a?) organizacje "..code.." !",plr); setElementData(plr,"player:organization",false)
    
end)


function globalMessage(plrcmd, ...)
    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("#000000"..pfrakcje.."> #FFFFFF"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."#FFFFFF:#FFFFFF "..msg:gsub("#%x%x%x%x%x%x",""), v,_,_,_,true)
        end
    end
        local desc "[ORGANIZACJA] ["..getElementData(plr,"id").."]"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."("..getElementData(plr,"player:organization").."): "..msg:gsub("#%x%x%x%x%x%x","")..""
        triggerEvent("admin:addText"resourceRootdesc:gsub("#%x%x%x%x%x%x",""))
        outputServerLog(desc)
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
)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-11, 17:08


xluq







Wiek: 30
Na forum: 3411 dni
Posty: 64
Nick w MP: SagaPlayer8912

Piwa: 3

Respekt: 80

To jest na pewno ten kod? ja tu nie widz? kodu na przepisywanie pojazdow, no chyba, ?e ?lepy jestem, nie ma innych plikow lua w tym skrypcie?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-11, 17:15


Pemo97







Wiek: 26
Na forum: 3822 dni
Posty: 49

Piwa: 3

Respekt: 45,3

 --[[
Developed by Yolos 
All rights reserved!
You cannot use this without permission!
--]]

function getOnlinePlayersinOrganization(org)
    local number=0
    for i,v in ipairs(getElementsByType("player")) do
        if getElementData(v,"player:organization") == org then
            number=number+1
        end
    end
    return number
end

function getPlayerOrganization(el)
    local uid=getElementData(el,"player:sid")
    local result=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE uid=? LIMIT 1;"uid) -- pobieramy tylko JEDEN rekord
    if result and #result > 0 then
        return result[1].name
    else
        return false
    end
end

function getPlayerOrganizationRank(el,org)
    local uid=getElementData(el,"player:sid")
    local result=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=? AND uid=? LIMIT 1;"orguid) -- pobieramy tylko JEDEN rekord
    if result and #result > 0 then
        return result[1].rank
    else
        return false
    end
end

jest jeszcze to

[ Dodano: 2017-03-11, 17:15 ]

local wm={
    window={},
    added={},
    edit={},
    close={},
    delete={},
    gridlist={},
    faction=nil,
}



-- Panel cz?onk?w
wm.window[1]=guiCreateWindow(0.180.230.640.57"Panel Organizacji"true)
guiWindowSetMovable(wm.window[1], false)
guiWindowSetSizable(wm.window[1], false)
guiSetVisible(wm.window[1], false)
wm.gridlist[1]=guiCreateGridList(0.020.050.970.73truewm.window[1])
guiGridListAddColumn(wm.gridlist[1], "Nick"0.3)
guiGridListAddColumn(wm.gridlist[1], "SID"0.3)
guiGridListAddColumn(wm.gridlist[1], "Ranga"0.3)
guiGridListAddColumn(wm.gridlist[1], "Aktywny"0.3)
wm.added[1]=guiCreateButton(0.020.800.260.16"Dodaj"truewm.window[1])
wm.edit[1]=guiCreateButton(0.380.800.260.16"Edytuj"truewm.window[1])
wm.delete[1]=guiCreateButton(0.730.800.260.16"Wyrzu?"truewm.window[1])

-- Dodawanie cz?onka/edycja jego
wm.window[2]=guiCreateWindow(0.350.430.300.22"Dodawanie cz?onka - wpisz nick i kliknij dodaj"true)
guiWindowSetMovable(wm.window[2], false)
guiWindowSetSizable(wm.window[2], false)
guiSetVisible(wm.window[2], false)
wm.edit[2]=guiCreateEdit(0.090.210.810.20""truewm.window[2])
wm.close[1]=guiCreateButton(0.550.520.360.31"Zamknij"truewm.window[2])
wm.added[2]=guiCreateButton(0.090.520.360.31"Dodaj"truewm.window[2])

function fillUsersData(result)
    guiGridListClear(wm.gridlist[1])
    for i,v in pairs(result) do
        local row=guiGridListAddRow(wm.gridlist[1])
        guiGridListSetItemText(wm.gridlist[1], row1v["login"], falsefalse)
        guiGridListSetItemText(wm.gridlist[1], row2v["uid"], falsefalse)
        guiGridListSetItemText(wm.gridlist[1], row3v["rank"], falsefalse)
        guiGridListSetItemText(wm.gridlist[1], row4v["actived"], falsefalse)
        
    end
end

addEventHandler("onClientMarkerLeave"resourceRoot, function(el,md)
    if el~=localPlayer then return end
    if guiGetVisible(wm.window[1]) == true then
        showCursor(false)
        guiSetVisible(wm.window[1], false)
        guiSetVisible(wm.window[2], false)
    end
end)

addEventHandler("onClientGUIClick"resourceRoot, function()
    if source == wm.added[1then
        guiSetVisible(wm.window[2], true)
        guiMoveToBack(wm.window[1])
        guiSetText(wm.added[2],"Dodaj")
        guiSetText(wm.edit[2],"")
        guiSetText(wm.window[2],"Dodawanie cz?onka - wpisz SID gracza i kliknij dodaj")
    end
    if source == wm.edit[1then
        local selectedRow=guiGridListGetSelectedItem(wm.gridlist[1])
        if not selectedRow or selectedRow 0 then return end
        local rank=guiGridListGetItemText(wm.gridlist[1], selectedRow3)
        if tonumber(rank) == 4 then outputChatBox("* Brak mo?liwo?ci edytowania tego gracza, poniewa? posiada On Lidera !",255,0,0) return end
        guiSetVisible(wm.window[2], true)
        guiMoveToBack(wm.window[1])
        guiSetText(wm.added[2],"Edycja")
        guiSetText(wm.edit[2],"")
        guiSetText(wm.window[2],"Edycja cz?onka - wpisz ID rangi (0-3) i kliknij edycja! Ranga 3 = (vice-lider)")
    end
    if source == wm.close[1then
        guiSetVisible(wm.window[2], false)
    end
    if source == wm.added[2then
        local text=guiGetText(wm.edit[2])
        if guiGetText(wm.added[2]) ~= "Dodaj" then
            local selectedRow=guiGridListGetSelectedItem(wm.gridlist[1])
            if not selectedRow or selectedRow 0 then return end
            local name=guiGridListGetItemText(wm.gridlist[1], selectedRow2)
            if not name then return end
            if not text then return end
            if tonumber(text) and tonumber(text) <= 3 then
                triggerServerEvent("lidero:editUser"resourceRootnametextwm.faction)
                triggerEvent("lidero:showGUI",resourceRoot,"brak","brak")
            else
                guiSetText(wm.window[2], "Podaj range w liczbach! Maksymalna to 3!")
            end
        else
            if not text then return end
            triggerServerEvent("lidero:addUser"resourceRoottextwm.faction)
                triggerEvent("lidero:showGUI",resourceRoot,"brak","brak")
        end
    end
    if source == wm.delete[1then
        local selectedRow=guiGridListGetSelectedItem(wm.gridlist[1])
        if not selectedRow or selectedRow 0 then return end
        local rank=guiGridListGetItemText(wm.gridlist[1], selectedRow3)
        if tonumber(rank) == 4 then outputChatBox("* Brak mo?liwo?ci usuni?cia tego gracza, poniewa? posiada On Lidera !",255,0,0) return end
        local name=guiGridListGetItemText(wm.gridlist[1], selectedRow2)
        if not name then return end
        triggerServerEvent("lidero:deleteUser"resourceRootnamewm.faction)
                triggerEvent("lidero:showGUI",resourceRoot,"brak","brak")
    end
    if source == wm.gridlist[1then
        local selectedRow=guiGridListGetSelectedItem(wm.gridlist[1])
        if not selectedRow or selectedRow 0 then
            guiSetEnabled(wm.edit[1], false)
            guiSetEnabled(wm.delete[1], false)
        else
            guiSetEnabled(wm.edit[1], true)
            guiSetEnabled(wm.delete[1], true)
        end
    end
end)

addEvent("lidero:showGUI"true)
addEventHandler("lidero:showGUI"resourceRoot, function(fid,result)
    if guiGetVisible(wm.window[1]) == false then
        -- Ustawienia
        showCursor(true,false)
        guiSetVisible(wm.window[1], true)

        guiSetEnabled(wm.edit[1], false)
        guiSetEnabled(wm.delete[1], false)


        wm.faction=fid -- deklarujemy frakcj?

        -- Sprawdzamy cz?onk?w
        fillUsersData(result)
    else
            showCursor(false,false)
        guiSetVisible(wm.window[1], false)
        guiSetEnabled(wm.edit[1], false)
        guiSetEnabled(wm.delete[1], false)
        guiSetVisible(wm.window[2], false)
    end
end)

addEvent("lidero:refresh"true)
addEventHandler("lidero:refresh"resourceRootfillUsersData)
oraz to

Postaw piwo autorowi tego posta
 

 
Tagi: dodawanie :: pojazdu :: orgaanizacji
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » dodawanie pojazdu do orgaanizacji Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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
Dodaj temat do Ulubionych
Wersja do druku