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

Wysłany: 2017-05-15, 12:27


wojakmati







Wiek: 28
Na forum: 3434 dni
Posty: 8
Nick w MP: AlabamaJustice



Respekt: 36,3

Ostrzeżeń: 80%
Witam zamieszczam zdj?cie 2 linijek b??du wraz z kawa?kiem kodu


linijki od 85

function loadFactionData(qq2)
   guiSetText(window2q2['nazwa'])
   details q2

145
 addEventHandler("onClientGUIClick"add_accept2, function ()
      if not selected then
         outputChatBox("Nie wybra?e?/a? osoby do dodania"25500)
         return
      end
      triggerServerEvent("addToFaction"localPlayerselecteddetails['username'], details['uid'])
      destroyElement(add_window2)
   endfalse)
end


Dodaje znaczniki lua //Emm

Ostatnio zmieniony przez Emm 2017-05-15, 16:37, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-05-15, 12:58


Allansso







Wiek: 24
Na forum: 3938 dni
Posty: 386

Piwa: 1537

Respekt: 180
Respekt: 180Respekt: 180

Ostrzeżeń: 100%
Masz skrypt pod??czony pod baz? danych?

Podpis
https://www.youtube.com/TheMikol
https://www.facebook.com/TheMikol1337
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-05-15, 14:29


wojakmati







Wiek: 28
Na forum: 3434 dni
Posty: 8
Nick w MP: AlabamaJustice



Respekt: 36,3

Ostrzeżeń: 80%
tak

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-05-15, 14:33


Allansso







Wiek: 24
Na forum: 3938 dni
Posty: 386

Piwa: 1537

Respekt: 180
Respekt: 180Respekt: 180

Ostrzeżeń: 100%
Podaj mo?e ca?y kod

function loadFactionData(qq2)
guiSetText(window2q2['nazwa'])
details q2
 

Masz w kodzie funkcje q?

Podpis
https://www.youtube.com/TheMikol
https://www.facebook.com/TheMikol1337
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-05-15, 14:37


wojakmati







Wiek: 28
Na forum: 3434 dni
Posty: 8
Nick w MP: AlabamaJustice



Respekt: 36,3

Ostrzeżeń: 80%
--[[
   System panelu frakcji
1
1
]]

local sw,sh guiGetScreenSize()
local details false
local selected false

function openFactionWindow()
   if isElement(window2then destroyElement(window2showCursor(false) return end

   if getElementData(localPlayer"op:block"then
      outputChatBox("Musisz chwil? odczeka?..."25500)
      return
    end

   showCursor(true)

   setElementData(localPlayer"op:block"true)
   setTimer(function ()
      setElementData(localPlayer"op:block"false)
   end20001)

   window2 guiCreateWindow(sw/2-300sh/2-150600300"Frakcja"false)
   guiWindowSetSizable(window2false)

   grid2 guiCreateGridList(00.080.61truewindow2)
   col12 guiGridListAddColumn(grid2"Nazwa gracza"0.5)
   col22 guiGridListAddColumn(grid2"Status"0.2)
   col32 guiGridListAddColumn(grid2"Ranga"0.2)
  btn_add2 guiCreateButton(0.630.310.350.15"Dodaj gracza"truewindow2)
  btn_edit2 guiCreateButton(0.630.480.350.15"Edytuj gracza"truewindow2)
  guiSetEnabled(btn_edit2false)
  btn_kick2 guiCreateButton(0.630.650.350.15"Wyrzu? gracza"truewindow2)
  guiSetEnabled(btn_kick2false)
   btn_close2 guiCreateButton(0.630.820.350.15"Zamknij"truewindow2)

   triggerServerEvent("getFactionPlayers"localPlayer)

   addEventHandler("onClientGUIClick"btn_close2, function ()
      destroyElement(window2)
      showCursor(false)
      if isElement(add_window2then destroyElement(add_window2end
      hideEditWindow()
   endfalse)

   addEventHandler("onClientGUIClick"grid2userClickfalse)
   addEventHandler("onClientGUIClick"btn_kick2kickFromFactionfalse)
   addEventHandler("onClientGUIClick"btn_add2showAddWindowfalse)
   addEventHandler("onClientGUIClick"btn_edit2showEditWindowfalse)
end
addEvent("openFactionWindow"true)
addEventHandler("openFactionWindow"rootopenFactionWindow)

function userClick()
   local selected guiGridListGetSelectedItem(grid2)
   if selected == -1 then
      guiSetEnabled(btn_edit2false)
      guiSetEnabled(btn_kick2false)
   else
      guiSetEnabled(btn_edit2true)
      guiSetEnabled(btn_kick2true)
   end
end

function kickFromFaction()
   local selected guiGridListGetSelectedItem(grid2)
   if selected == -1 then return end
   local uid guiGridListGetItemData(grid2selectedcol12)
   local name guiGridListGetItemText(grid2selectedcol12)
   local ranga guiGridListGetItemData(grid2selectedcol32)
   triggerServerEvent("kickFromFaction"localPlayeruidnamerangadetails['nazwa'])
end

function reloadFactionList()
   guiGridListClear(grid2)
   triggerServerEvent("getFactionPlayers"localPlayer)
end
addEvent("reloadFactionList"true)
addEventHandler("reloadFactionList"getRootElement(), reloadFactionList)

function loadFactionData(qq2)
   guiSetText(window2q2['nazwa'])
   details q2

   for i,v in ipairs(q) do
      local row guiGridListAddRow(grid2)
      guiGridListSetItemText(grid2rowcol12v['username'], falsefalse)
      guiGridListSetItemData(grid2rowcol12v['uid'], falsefalse)
      if getPlayerFromName(v['username']) then
         guiGridListSetItemText(grid2rowcol22"ONLINE"falsefalse)
         guiGridListSetItemColor(grid2rowcol2202550)
      else
         guiGridListSetItemText(grid2rowcol22"OFFLINE"falsefalse)
         guiGridListSetItemColor(grid2rowcol2225500)
      end

      local ranga "Nieznana"
      if v['franga'] == 1 then ranga q2['ranga1'end
      if v['franga'] == 2 then ranga q2['ranga2'end
      if v['franga'] == 3 then ranga q2['ranga3'end
      if v['franga'] == 4 then ranga q2['ranga4'end
      if v['franga'] == 5 then ranga q2['ranga5'end
      guiGridListSetItemText(grid2rowcol32rangafalsefalse)
      guiGridListSetItemData(grid2rowcol32v['franga'], falsefalse)
   end
end
addEvent("loadFactionData"true)
addEventHandler("loadFactionData"getRootElement(), loadFactionData)

function showAddWindow()
   if isElement(add_window2then return end
   add_window2 guiCreateWindow(sw/2-150sh/2-70300140"Wpisz nazw? gracza"false)
   add_username2 guiCreateEdit(0.10.250.80.2""trueadd_window2)
   add_label2 guiCreateLabel(0.10.50.80.15""trueadd_window2)
   guiLabelSetVerticalAlign(add_label2"center")
   guiLabelSetHorizontalAlign(add_label2"center")
   add_accept2 guiCreateButton(0.10.70.390.2"Dodaj"trueadd_window2)
   add_cancel2 guiCreateButton(0.490.70.410.2"Anuluj"trueadd_window2)

   addEventHandler("onClientGUIClick"add_cancel2, function ()
      destroyElement(add_window2)
   endfalse)

   addEventHandler("onClientGUIChanged"add_username2, function ()
      local target findPlayer(localPlayerguiGetText(add_username2))
      if not target then
         guiSetText(add_label2"Nie znaleziono takiego gracza")
         guiLabelSetColor(add_label225500)
         selected false
      else
         selected target
         guiSetText(add_label2"Znaleziono gracza ("..getPlayerName(target)..")")
         guiLabelSetColor(add_label202550)
      end
   end)

   addEventHandler("onClientGUIClick"add_accept2, function ()
      if not selected then
         outputChatBox("Nie wybra?e?/a? osoby do dodania"25500)
         return
      end
      triggerServerEvent("addToFaction"localPlayerselecteddetails['username'], details['uid'])
      destroyElement(add_window2)
   endfalse)
end

function showEditWindow()
   if isElement(edit_window2then return end
   edit_window2 guiCreateWindow(sw/2-150sh/2-70300140"Edycja cz?onka grupy"false)
   edit_combo2 guiCreateComboBox(0.20.30.60.8"Ranga gracza"trueedit_window2)
   edit_baccept2 guiCreateButton(00.70.470.25"Zapisz"trueedit_window2)
   edit_bcancel2 guiCreateButton(0.50.70.470.25"Anuluj"trueedit_window2)

   local fid getElementData(localPlayer"user:fid")
   triggerServerEvent("getFactionRanks"localPlayerfid)

   addEventHandler("onClientGUIClick"edit_baccept2updateRank2false)
   addEventHandler("onClientGUIClick"edit_bcancel2hideEditWindowfalse)
end

function hideEditWindow()
   if not isElement(edit_window2then return end
   destroyElement(edit_window2)
end
addEvent("hideEditWindow2"true)
addEventHandler("hideEditWindow2"getRootElement(), hideEditWindow)

function addToEditWindow(q)
   guiComboBoxAddItem(edit_combo2q[1]['ranga1'])
   guiComboBoxAddItem(edit_combo2q[1]['ranga2'])
   guiComboBoxAddItem(edit_combo2q[1]['ranga3'])
   guiComboBoxAddItem(edit_combo2q[1]['ranga4'])
end
addEvent("addToEditWindow2"true)
addEventHandler("addToEditWindow2"getRootElement(), addToEditWindow)

function updateRank2()
   local selected guiComboBoxGetSelected(edit_combo2)
   local selected2 guiGridListGetSelectedItem(grid2)
   if selected2 == -1 then
      outputChatBox("Nie wybrano gracza to edycji..."25500)
      return
   end
   if selected == -1 then
      outputChatBox("Musisz wybra? rang?, kt?r? chcesz ustawi?..."25500)
      return
   end
   triggerServerEvent("updateRank2"localPlayerguiGridListGetItemData(grid2selected2col12), selected+1)
end

addEventHandler("onClientResourceStart"resourceRoot, function ()
   setElementData(localPlayer"op:block"false)
end)



---------------
---- UTILS ----
---------------
function findPlayer(plrcel)
    local target nil
    if (tonumber(cel) ~= nilthen
        target getElementByID("p"..cel)
    else
        for _,thePlayer in ipairs(getElementsByType("player")) do
            if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x"""), cel:lower(), 1truethen
                if (targetthen
                    return nil
                end
                target=thePlayer
            end
        end
    end
    return target
end

fileDelete("c.lua")


Ostatnio zmieniony przez Emm 2017-05-15, 16:36, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-05-15, 14:48


Allansso







Wiek: 24
Na forum: 3938 dni
Posty: 386

Piwa: 1537

Respekt: 180
Respekt: 180Respekt: 180

Ostrzeżeń: 100%
function loadFactionData(q2)
guiSetText(window2q2['nazwa'])
details q2


Podpis
https://www.youtube.com/TheMikol
https://www.facebook.com/TheMikol1337
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-05-15, 15:38


wojakmati







Wiek: 28
Na forum: 3434 dni
Posty: 8
Nick w MP: AlabamaJustice



Respekt: 36,3

Ostrzeżeń: 80%
daje te? stron? serwera gdy? tamta zmiana spowodowa?a wi?cej b??d?w

--[[
   System panelu frakcji
1
1
]]

function getPlayers()
   local q exports.rpg_mysql:mysql_query("SELECT * FROM rpg_accounts WHERE frakcja=? ORDER BY oranga DESC"getElementData(source"user:fid"))
   local fid getElementData(source"user:fid") or 0
   local q2 exports.rpg_mysql:mysql_query("SELECT * FROM rpg_factions WHERE uid=?"fid)
   if q then
      triggerClientEvent(source"loadFactionData"sourceqq2[1])
   end
end
addEvent("getFactionPlayers"true)
addEventHandler("getFactionPlayers"getRootElement(), getPlayers)

function kickFromFaction(uidnamefrangafname)
  if franga 4 then
     outputChatBox("Nie mo?esz wyrzuci? z lidera z frakcji!"source25500)
     return
  end
  
   local q exports.rpg_mysql:mysql_query("UPDATE rpg_accounts SET frakcja=0 WHERE uid=?"uid)

   local target getPlayerFromName(name)
   if target then
      setElementData(target"user:fid"0)
      outputChatBox("Zosta?e?/a wykopany/a z frakcji "..fname.."!"target25500)
      setElementData(target"user:fdata"false)
   end
   outputChatBox("Gracz "..getElementData(target"user:username").." zosta?/a wykopany/a z frakcji!"source25500)
   triggerClientEvent(source"reloadFactionList"source)
end
addEvent("kickFromFaction"true)
addEventHandler("kickFromFaction"getRootElement(), kickFromFaction)

function addToFaction(targetfnamefid)
   if not fid or not fname then
      outputChatBox("Wyst?pi? pewien problem, spr?buj ponownie p??niej.."source25500)
      return
   end
   if not getElementData(target"user:uid"then
      outputChatBox("Gracz nie jest zalogowany"source25500)
      return
   end
   local result exports.rpg_mysql:mysql_query("SELECT * FROM rpg_accounts WHERE uid=?"getElementData(target"user:uid"))
   if result[1].frakcja 0 then
      outputChatBox("Gracz znajduje si? ju? w innej frakcji"source25500)
      return
   end

   local q exports.rpg_mysql:mysql_query("UPDATE rpg_accounts SET frakcja=?, franga=? WHERE uid=?"tonumber(fid), 1getElementData(target"user:uid"))
   local q2 exports.rpg_mysql:mysql_query("SELECT * FROM rpg_factions WHERE uid=?"tonumber(oid))
   if q then
      outputChatBox("Gracz "..getElementData(target"user:username").." zosta? dodany do frakcji!"source02550)
      outputChatBox("Gracz "..getElementData(source"user:username").." doda? ci? do frakcji "..fname.."!"target02550)
      setElementData(target"user:fid"tonumber(fid))
      setElementData(target"user:frank"1)
      setElementData(target"user:fdata"q2)
      triggerClientEvent(source"reloadFactionList"source)
   else
      outputChatBox("Wyst?pi? pewien problem, spr?buj ponownie p??niej.."source25500)
   end
end
addEvent("addToFaction"true)
addEventHandler("addToFaction"getRootElement(), addToFaction)

function getFactionRanks(oid)
   local q exports.rpg_mysql:mysql_query("SELECT * FROM rpg_factions WHERE uid=?"tonumber(oid))
   if q then
      triggerClientEvent(source"addToEditWindow2"sourceq)
   else
      outputChatBox("Wyst?pi? pewien problem, spr?buj ponownie p??niej.."source25500)
   end
end
addEvent("getFactionRanks"true)
addEventHandler("getFactionRanks"getRootElement(), getFactionRanks)

function updateRank(uidrank)
  local target findPlayerByUID(uid)
  if getElementData(target"user:frank") == 5 then
    outputChatBox("Nie mo?esz edytowa? lidera."25500)
    return
  end
  if target then
    outputChatBox("Twoja ranga w frakcji zosta?a zaktualizowana"target02550)
    setElementData(target"user:frank"rank)
  end
  outputChatBox("Ranga tego gracza w frakcji zosta?a zaktualizowana"source02550)
  triggerClientEvent(source"hideEditWindow2"source)
  triggerClientEvent(source"reloadFactionList"source)
  exports.rpg_mysql:mysql_query("UPDATE rpg_accounts SET franga=? WHERE uid=?"tonumber(rank), tonumber(uid))
end
addEvent("updateRank2"true)
addEventHandler("updateRank2"getRootElement(), updateRank)

local markery = {
{2498.9521484375, -1713.69238281251339.9281005859"TCSA"01},
{-2407.5983886719, -125.2078094482441.703285217285"SAFD"00},
{216.5166015625109.44238281251003.21875"SAPD"310},
}

for iv in pairs(markery) do
  local marker createMarker(v[1], v[2], v[3]-1"cylinder"22550075)
  setElementDimension(markerv[5])
  setElementInterior(markerv[6])
  setElementData(marker"marker:faction"v[4])
  local text createElement("text")
  setElementData(text"text""Panel frakcji "..v[4])
  setElementPosition(textv[1], v[2], v[3])
  setElementDimension(textv[5])
  setElementInterior(textv[6])
end

addEventHandler("onMarkerHit"resourceRoot, function(hit)
  if getElementData(hit"user:faction") ~= getElementData(source"marker:faction"then
    outputChatBox("Nie posiadasz uprawnie? lub nie ma cie na s?uzbie frakcji."hit25500)
    return
  end
  local ranga getElementData(hit"user:frank")
  if ranga == or ranga == 5 then
    triggerClientEvent(hit"openFactionWindow"hit)
  else
    outputChatBox("Nie posiadasz uprawnie? do panelu frakcji."hit25500)
    end
end)

---------------
---- UTILS ----
---------------
function findPlayerByUID(uid)
   for i,v in ipairs(getElementsByType("player")) do
      if getElementData(v"user:uid") == tonumber(uidthen
         return v
      end
   end
   return false
end


Komentarz Emm dodany 2017-05-15, 16:36Stosuj znaczniki lua/code //Emm
Ostatnio zmieniony przez Emm 2017-05-15, 16:38, w całości zmieniany 5 razy  
Postaw piwo autorowi tego posta
 

 
Tagi: panel :: lidera :: frakcji-brak :: reakcji
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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