[YARDIM] Gridlistte Seçilen Kişiye İşlevi Verme

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı CastiaL

  • Yeni Üye
  • *
    • İleti: 62
Gridliste playerleri ekledim playeri işaretleyince butona işlev vericek
butonda o kişiye 10 dakika mute atıcak mesela

kodlar:
Kod: lua
root = getRootElement()

function center(center_window)
    local screenW, screenH = guiGetScreenSize()
    local windowW, windowH = guiGetSize(center_window, false)
    local x, y = (screenW - windowW) /2,(screenH - windowH) /2
    guiSetPosition(center_window, x, y, false)
end

addEventHandler("onClientResourceStart", resourceRoot,
    function()
        window = guiCreateWindow(320, 266, 758, 621, "Degistir", false)
center(window)
        guiWindowSetMovable(window, false)
        guiWindowSetSizable(window, false)
guiSetVisible(window, false)

        playerList = guiCreateGridList(9, 29, 173, 576, false, window)
        nick = guiCreateLabel(202, 64, 216, 18, "Nick:", false, window)
        guiSetFont(nick, "default-bold-small")
        mutedurum = guiCreateLabel(202, 121, 216, 18, "Mute Durumu:", false, window)
        guiSetFont(mutedurum, "default-bold-small")
        hg1 = guiCreateButton(202, 246, 216, 52, "Hoşgörüsüz 1 = 5 Dakika", false, window)
        guiSetFont(hg1, "default-bold-small")
        guiSetProperty(hg1, "NormalTextColour", "FFFFFFFF")


        hg2 = guiCreateButton(202, 327, 216, 52, "Hoşgörüsüz 2 = 10 Dakika", false, window)
        guiSetFont(hg2, "default-bold-small")
        guiSetProperty(hg2, "NormalTextColour", "FFFFFFFF")
        hg3 = guiCreateButton(202, 403, 216, 52, "Hoşgörüsüz 3 = 15 Dakika", false, window)
        guiSetFont(hg3, "default-bold-small")
        guiSetProperty(hg3, "NormalTextColour", "FFFFFFFF")
        hg4 = guiCreateButton(202, 484, 216, 52, "Hoşgörüsüz 4 = Kick", false, window)
        guiSetFont(hg4, "default-bold-small")
        guiSetProperty(hg4, "NormalTextColour", "FFFFFFFF")
        hgisim = guiCreateLabel(241, 215, 149, 17, "Hoşgörüsüz", false, window)
        guiSetFont(hgisim, "default-bold-small")
        guiLabelSetHorizontalAlign(hgisim, "center", false)
        al1 = guiCreateButton(518, 246, 216, 52, "Ailevi 1 = 10 Dakika", false, window)
        guiSetFont(al1, "default-bold-small")
        guiSetProperty(al1, "NormalTextColour", "FFFFFFFF")
        al2 = guiCreateButton(518, 327, 216, 52, "Ailevi 2 = 20 Dakika", false, window)
        guiSetFont(al2, "default-bold-small")
        guiSetProperty(al2, "NormalTextColour", "FFFFFFFF")
        al3 = guiCreateButton(518, 403, 216, 52, "Ailevi 3 = 30 Dakika", false, window)
        guiSetFont(al3, "default-bold-small")
        guiSetProperty(al3, "NormalTextColour", "FFFFFFFF")
        al4 = guiCreateButton(518, 484, 216, 52, "Ailevi 4 = 1 Saat Ban", false, window)
        guiSetFont(al4, "default-bold-small")
        guiSetProperty(al4, "NormalTextColour", "FFFFFFFF")
        alisim = guiCreateLabel(555, 212, 149, 17, "Ailevi", false, window)
        guiSetFont(alisim, "default-bold-small")
        guiLabelSetHorizontalAlign(alisim, "center", false)   
    end
)

-----

function createPlayerList ()
        -- Create a players column in the list
        local column = guiGridListAddColumn( playerList, "Player", 0.85 )
        if ( column ) then         -- If the column has been created, fill it with players
                for id, playeritem in ipairs(getElementsByType("player")) do
                        local row = guiGridListAddRow ( playerList )
                        guiGridListSetItemText ( playerList, row, column, string.gsub(getPlayerName( playeritem ), "#%x%x%x%x%x%x", ""), false, false)
end
                addEventHandler ( "onClientGUIClick", playerList, click )
        end
end
addEventHandler ( "onClientResourceStart", resourceRoot, createPlayerList )

function click ( button, state, sx, sy, x, y, z, elem, gui )
        -- if state is down ( not to trigger the function twice on mouse button up/down), clicked gui and the element is our player list
        if ( ( state == "down" ) and ( gui == true ) and ( source == playerList ) ) then
                -- get the player name from the selected row, first column
                local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 )
                outputChatBox ( playerName )     -- output it to chat box
        end
end


-------

function guiOpen()
if (guiGetVisible(window) == true) then --Check whether gui is visible or not
guiSetVisible(window, false) --if visible then close it
showCursor(false)
else
guiSetVisible(window, true) --if not open it
showCursor(true)
end
end
bindKey("o", "down", guiOpen) --bind F2 for that function



-------


« Son Düzenleme: 30 Ocak 2018, 21:40:55 Gönderen: Narkoz »
 


MTASATURK


Çevrimdışı #Serius

  • Uzman Üye
  • *
    • İleti: 685
Yanıtla #1 : 29 Ocak 2018, 22:53:37
Server.side? yokmu
 


Çevrimdışı Yavuzay

  • Yeni Üye
  • *
    • İleti: 37
Yanıtla #2 : 29 Ocak 2018, 22:54:14
Client
Alıntı
addEventHandler ( "onClientGUIClick", root,function ()
    if source == susturbutonu then
      local row,col = guiGridListGetSelectedItem(Oyuncular)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(Oyuncular, row, 1)
         triggerServerEvent("muteAt", localPlayer, oyuncu)
        else -- eğer seçili değilse herhangi bir lsiteden bişey
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
   end
end)

Server
Alıntı
addEvent("muteAt", true)
addEventHandler("muteAt", root, function(Oyuncular)
    setPlayerMuted(Oyuncular, true)
   outputChatBox(getPlayerName(source).." isimli yetkili " ..getPlayerName(Oyuncular).." susturdu.", root, 0,255,0, true)
end)
« Son Düzenleme: 29 Ocak 2018, 23:04:20 Gönderen: Yavuzay »
 


Çevrimdışı CastiaL

  • Yeni Üye
  • *
    • İleti: 62
Yanıtla #3 : 29 Ocak 2018, 22:55:32
Linki görebilmek için Kayıt olun yada Giriş yapın.
Client
Server
verdiğim koda uyarlıyabilirmisin
 


Çevrimdışı #Serius

  • Uzman Üye
  • *
    • İleti: 685
Yanıtla #4 : 29 Ocak 2018, 22:56:08
Yavuzay Settimer( nerde ?
 


Çevrimdışı CastiaL

  • Yeni Üye
  • *
    • İleti: 62
Yanıtla #5 : 29 Ocak 2018, 22:59:57
mesela hg1 atlı butona basınca 30000 milisecond hg2 ye basınca 60000 milisecond mute atıcak
 


MTASATURK

Ynt: Gridlistte seçilen kişiye butondaki işlevi vermek
« Yanıtla #5 : 29 Ocak 2018, 22:59:57 »

Çevrimdışı #Serius

  • Uzman Üye
  • *
    • İleti: 685
Yanıtla #6 : 29 Ocak 2018, 23:45:35
Buyur;

Client.side
Kod: lua
-- CLİENT SİDE --

gridlist_degisken_adi = guiCreateGridList(0, 0, 0, 0, false)
guiGridListAddColumn(gridlist_degisken_adi, "Oyuncu Listesi", 0.9)

function oyunculari_listeye_ekle()
guiGridListClear(gridlist_degisken_adi)
for i,Oyuncular in ipairs(getElementsByType("player")) do
Oyuncular1 = getLocalPlayer()
row = guiGridListAddRow(gridlist_degisken_adi)
if Oyuncular ~= Oyuncular1 then
guiGridListSetItemText (gridlist_degisken_adi,row,1,(string.gsub (getPlayerName(Oyuncular), "#%x%x%x%x%x%x", "")), false, false)
guiGridListSetItemData (gridlist_degisken_adi,row,1, getPlayerName(Oyuncular))
guiGridListSetSortingEnabled(gridlist_degisken_adi, false)
guiGridListSetItemText (gridlist_degisken_adi,row,1,(string.gsub (getPlayerName(Oyuncular), "#%x%x%x%x%x%x", "")), false, false)
guiGridListSetItemData (gridlist_degisken_adi,row,1, getPlayerName(Oyuncular))
guiGridListSetSortingEnabled(gridlist_degisken_adi, false)
end
end
addEventHandler ( "onClientGUIChanged", root,oyunculari_listeye_ekle)


addEventHandler("onClientGUIClick",root,function()
if source == buton_degisken_adi then
local row,col = guiGridListGetSelectedItem( gridlist_degisken_adi )
if row and col and row ~= -1 and col ~= -1 then
local liste_item_sec = guiGridListGetItemData(gridlist_degisken_adi, row, 1)
triggerServerEvent("Oyuncuya_mute_at", localPlayer, liste_item_sec)
else
outputChatBox("Lütfen listeden bir oyuncu seçiniz!", 255,0,0,true)   
end
end
end)


Server.side
Kod: lua
-- AYARLAR --

Element = root
dakika = 30

-- KODLAR SERVER SİDE --

addEvent("Oyuncuya_mute_at", true)
addEventHandler("Oyuncuya_mute_at", root,function ( kisi )
dakika_ = dakika*60000
setPlayerMuted(kisi, true)
outputChatBox(getPlayerName(source).."Adlı yetkili " ..getPlayerName(kisi).."Adlı oyuncuyu susturdu -"..dakika_.." Dakika", Element, 0,255,0, true)
setTimer(mute_ac, dakika_, 1, source)
end)

function mute_ac(oyuncu)
setPlayerMuted(oyuncu, false )
outputChatBox ("#FFFFFF"..getPlayerName(oyuncu).." #00ff00 Cezan bitti birdaha tekrarlama!",Element, 255, 255, 0,true )
end)

Denemedim hata çıkarsa yazarsın :)

Kadir düzelttiğin için teşekkür ederim :)
« Son Düzenleme: 30 Ocak 2018, 00:01:58 Gönderen: By.Angel »
 


Çevrimdışı Yavuzay

  • Yeni Üye
  • *
    • İleti: 37
Yanıtla #7 : 30 Ocak 2018, 00:05:16
Ailevi küfürlerde ban atılacak değil mi ?
 


Çevrimdışı CastiaL

  • Yeni Üye
  • *
    • İleti: 62
Yanıtla #8 : 30 Ocak 2018, 00:10:33
Linki görebilmek için Kayıt olun yada Giriş yapın.
Ailevi küfürlerde ban atılacak değil mi ?
onuda mute olarak değerlendir

Mesaj Birleştirildi: [time]30 Ocak 2018, 01:17:29[/time]
Linki görebilmek için Kayıt olun yada Giriş yapın.
Buyur;

Client.side
Kod: lua
-- CLİENT SİDE --

gridlist_degisken_adi = guiCreateGridList(0, 0, 0, 0, false)
guiGridListAddColumn(gridlist_degisken_adi, "Oyuncu Listesi", 0.9)

function oyunculari_listeye_ekle()
guiGridListClear(gridlist_degisken_adi)
for i,Oyuncular in ipairs(getElementsByType("player")) do
Oyuncular1 = getLocalPlayer()
row = guiGridListAddRow(gridlist_degisken_adi)
if Oyuncular ~= Oyuncular1 then
guiGridListSetItemText (gridlist_degisken_adi,row,1,(string.gsub (getPlayerName(Oyuncular), "#%x%x%x%x%x%x", "")), false, false)
guiGridListSetItemData (gridlist_degisken_adi,row,1, getPlayerName(Oyuncular))
guiGridListSetSortingEnabled(gridlist_degisken_adi, false)
guiGridListSetItemText (gridlist_degisken_adi,row,1,(string.gsub (getPlayerName(Oyuncular), "#%x%x%x%x%x%x", "")), false, false)
guiGridListSetItemData (gridlist_degisken_adi,row,1, getPlayerName(Oyuncular))
guiGridListSetSortingEnabled(gridlist_degisken_adi, false)
end
end
addEventHandler ( "onClientGUIChanged", root,oyunculari_listeye_ekle)


addEventHandler("onClientGUIClick",root,function()
if source == buton_degisken_adi then
local row,col = guiGridListGetSelectedItem( gridlist_degisken_adi )
if row and col and row ~= -1 and col ~= -1 then
local liste_item_sec = guiGridListGetItemData(gridlist_degisken_adi, row, 1)
triggerServerEvent("Oyuncuya_mute_at", localPlayer, liste_item_sec)
else
outputChatBox("Lütfen listeden bir oyuncu seçiniz!", 255,0,0,true)   
end
end
end)


Server.side
Kod: lua
-- AYARLAR --

Element = root
dakika = 30

-- KODLAR SERVER SİDE --

addEvent("Oyuncuya_mute_at", true)
addEventHandler("Oyuncuya_mute_at", root,function ( kisi )
dakika_ = dakika*60000
setPlayerMuted(kisi, true)
outputChatBox(getPlayerName(source).."Adlı yetkili " ..getPlayerName(kisi).."Adlı oyuncuyu susturdu -"..dakika_.." Dakika", Element, 0,255,0, true)
setTimer(mute_ac, dakika_, 1, source)
end)

function mute_ac(oyuncu)
setPlayerMuted(oyuncu, false )
outputChatBox ("#FFFFFF"..getPlayerName(oyuncu).." #00ff00 Cezan bitti birdaha tekrarlama!",Element, 255, 255, 0,true )
end)

Denemedim hata çıkarsa yazarsın :)

Kadir düzelttiğin için teşekkür ederim :)

"end" expected hatası veriyor ilk function için
« Son Düzenleme: 30 Ocak 2018, 00:12:47 Gönderen: CastiaL »
 


Çevrimdışı #Serius

  • Uzman Üye
  • *
    • İleti: 685
Yanıtla #9 : 30 Ocak 2018, 00:13:34
Test etmediğimi belirttim.
 


Çevrimdışı CastiaL

  • Yeni Üye
  • *
    • İleti: 62
Yanıtla #10 : 30 Ocak 2018, 00:13:56
nasıl yapabilirm
 


Çevrimdışı Yavuzay

  • Yeni Üye
  • *
    • İleti: 37
Yanıtla #11 : 30 Ocak 2018, 00:16:12
Kopyala yapıştır direk kafan karışmasın diye tümünü attım. Ban sürelerinde sıkıntı olabilir çünkü mute gibi zaman verilmiyor onları denme yanılma yoluyla yap

Eğer mahlukat benden sonra atarsa onunkini kullan  :P :P



Kod: lua
root = getRootElement()
 
function center(center_window)
    local screenW, screenH = guiGetScreenSize()
    local windowW, windowH = guiGetSize(center_window, false)
    local x, y = (screenW - windowW) /2,(screenH - windowH) /2
    guiSetPosition(center_window, x, y, false)
end
 
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        window = guiCreateWindow(320, 266, 758, 621, "Degistir", false)
                center(window)
        guiWindowSetMovable(window, false)
        guiWindowSetSizable(window, false)
                guiSetVisible(window, false)
 
        playerList = guiCreateGridList(9, 29, 173, 576, false, window)
        nick = guiCreateLabel(202, 64, 216, 18, "Nick:", false, window)
        guiSetFont(nick, "default-bold-small")
        mutedurum = guiCreateLabel(202, 121, 216, 18, "Mute Durumu:", false, window)
        guiSetFont(mutedurum, "default-bold-small")

        hg1 = guiCreateButton(202, 246, 216, 52, "Hoşgörüsüz 1 = 5 Dakika", false, window)
        guiSetFont(hg1, "default-bold-small")
        guiSetProperty(hg1, "NormalTextColour", "FFFFFFFF")
 
 
        hg2 = guiCreateButton(202, 327, 216, 52, "Hoşgörüsüz 2 = 10 Dakika", false, window)
        guiSetFont(hg2, "default-bold-small")
        guiSetProperty(hg2, "NormalTextColour", "FFFFFFFF")

        hg3 = guiCreateButton(202, 403, 216, 52, "Hoşgörüsüz 3 = 15 Dakika", false, window)
        guiSetFont(hg3, "default-bold-small")
        guiSetProperty(hg3, "NormalTextColour", "FFFFFFFF")

        hg4 = guiCreateButton(202, 484, 216, 52, "Hoşgörüsüz 4 = Kick", false, window)
        guiSetFont(hg4, "default-bold-small")
        guiSetProperty(hg4, "NormalTextColour", "FFFFFFFF")

        hgisim = guiCreateLabel(241, 215, 149, 17, "Hoşgörüsüz", false, window)
        guiSetFont(hgisim, "default-bold-small")
        guiLabelSetHorizontalAlign(hgisim, "center", false)

        al1 = guiCreateButton(518, 246, 216, 52, "Ailevi 1 = 10 Dakika", false, window)
        guiSetFont(al1, "default-bold-small")
        guiSetProperty(al1, "NormalTextColour", "FFFFFFFF")

        al2 = guiCreateButton(518, 327, 216, 52, "Ailevi 2 = 20 Dakika", false, window)
        guiSetFont(al2, "default-bold-small")
        guiSetProperty(al2, "NormalTextColour", "FFFFFFFF")

        al3 = guiCreateButton(518, 403, 216, 52, "Ailevi 3 = 30 Dakika", false, window)
        guiSetFont(al3, "default-bold-small")
        guiSetProperty(al3, "NormalTextColour", "FFFFFFFF")

        al4 = guiCreateButton(518, 484, 216, 52, "Ailevi 4 = 1 Saat Ban", false, window)
        guiSetFont(al4, "default-bold-small")
        guiSetProperty(al4, "NormalTextColour", "FFFFFFFF")

        alisim = guiCreateLabel(555, 212, 149, 17, "Ailevi", false, window)
        guiSetFont(alisim, "default-bold-small")
        guiLabelSetHorizontalAlign(alisim, "center", false)   
    end
)
 
-----
 
function createPlayerList ()
        -- Create a players column in the list
        local column = guiGridListAddColumn( playerList, "Player", 0.85 )
        if ( column ) then         -- If the column has been created, fill it with players
                for id, playeritem in ipairs(getElementsByType("player")) do
                        local row = guiGridListAddRow ( playerList )
                        guiGridListSetItemText ( playerList, row, column, string.gsub(getPlayerName( playeritem ), "#%x%x%x%x%x%x", ""), false, false)
guiGridListSetItemData(playerList, row,column, playeritem)
                        end
                addEventHandler ( "onClientGUIClick", playerList, click )
        end
end
addEventHandler ( "onClientResourceStart", resourceRoot, createPlayerList )
 
function click ( button, state, sx, sy, x, y, z, elem, gui )
        -- if state is down ( not to trigger the function twice on mouse button up/down), clicked gui and the element is our player list
        if ( ( state == "down" ) and ( gui == true ) and ( source == playerList ) ) then
                -- get the player name from the selected row, first column
                local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 )
                outputChatBox ( playerName )     -- output it to chat box
        end
end
 
 
-------
 
function guiOpen()
if (guiGetVisible(window) == true) then --Check whether gui is visible or not
guiSetVisible(window, false) --if visible then close it
showCursor(false)
else
guiSetVisible(window, true) --if not open it
showCursor(true)
end
end
bindKey("o", "down", guiOpen) --bind F2 for that function

--Butonlar
addEventHandler ( "onClientGUIClick", root,function ()
    if source == hg1 then
      local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("muteAt", localPlayer, oyuncu,1)
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
elseif source == hg2 then
local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("muteAt", localPlayer, oyuncu,10)
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
elseif source == hg3 then
local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("muteAt", localPlayer, oyuncu,15)
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
elseif source == hg4 then
local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("kickAt", localPlayer, oyuncu,"Hoşgörüsüz")
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
elseif source == al1 then
local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("banAt", localPlayer, oyuncu,0.15,"Ailevi Küfür")
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
elseif source == al2 then
local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("banAt", localPlayer, oyuncu,0.2,"Ailevi Küfür")
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
elseif source == al3 then
local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("banAt", localPlayer, oyuncu,0.25,"Ailevi Küfür")
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
elseif source == al4 then
local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("banAt", localPlayer, oyuncu,1,"Ailevi Küfür")
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
end
end)

Kod: lua
zaman = 60000
addEvent("muteAt", true)
addEventHandler("muteAt", root, function(Oyuncular,sure)
    setPlayerMuted(Oyuncular, true)
setTimer ( muteAc, (sure*zaman), 1, source)
outputChatBox(getPlayerName(source).." isimli yetkili " ..getPlayerName(Oyuncular).."adlı oyuncuyu susturdu.", root, 0,255,0, true)
end)

function muteAc (player)
if (isElement (player) and isPlayerMuted (player)) then
setPlayerMuted (player, false )
outputChatBox ("#FFFFFF"..getPlayerName ( player ).." #bbfa00 artık konuşabilirsin. ",getRootElement(), 255, 255, 0,true )
end
end

addEvent("kickAt", true)
addEventHandler("kickAt", root, function(Oyuncular,sebep)
    kickPlayer ( Oyuncular, source, sebep )
outputChatBox("#FFFFFF"..getPlayerName(Oyuncular).."#FF0000adlı oyuncu "..getPlayerName(source).." tarafından kicklendi.", root, 255,255,255,true)
end)

addEvent("banAt", true)
addEventHandler("banAt", root, function(Oyuncular,sure,sebep)
    banPlayer(Oyuncular,true,false,true,source,sebep,sure)
outputChatBox("#FFFFFF"..getPlayerName(Oyuncular).."#FF0000adlı oyuncu "..getPlayerName(source).." tarafından banlandı. #FFFFFF[Sebep :"..sebep.."]", root, 255,255,255,true)
end)
« Son Düzenleme: 30 Ocak 2018, 00:20:35 Gönderen: Yavuzay »
 


Çevrimdışı Mahlukat

  • Uzman Üye
  • *
    • İleti: 637
Yanıtla #12 : 30 Ocak 2018, 00:18:09
sec begen al xd

client
Kod: lua
function center(center_window)
    local screenW, screenH = guiGetScreenSize()
    local windowW, windowH = guiGetSize(center_window, false)
    local x, y = (screenW - windowW) /2,(screenH - windowH) /2
    guiSetPosition(center_window, x, y, false)
end

        window = guiCreateWindow(320, 266, 758, 621, "Degistir", false)
        center(window)
        guiWindowSetMovable(window, false)
        guiWindowSetSizable(window, false)
        guiSetVisible(window, false)
 
        playerList = guiCreateGridList(9, 29, 173, 576, false, window)
column = guiGridListAddColumn( playerList, "Player", 0.85 ) 
        nick = guiCreateLabel(202, 64, 216, 18, "Nick:", false, window)
        guiSetFont(nick, "default-bold-small")
        mutedurum = guiCreateLabel(202, 121, 216, 18, "Mute Durumu:", false, window)
        guiSetFont(mutedurum, "default-bold-small")

        hg1 = guiCreateButton(202, 246, 216, 52, "Hoşgörüsüz 1 = 5 Dakika", false, window)
        guiSetFont(hg1, "default-bold-small")
        guiSetProperty(hg1, "NormalTextColour", "FFFFFFFF")
        hg2 = guiCreateButton(202, 327, 216, 52, "Hoşgörüsüz 2 = 10 Dakika", false, window)
        guiSetFont(hg2, "default-bold-small")
        guiSetProperty(hg2, "NormalTextColour", "FFFFFFFF")
        hg3 = guiCreateButton(202, 403, 216, 52, "Hoşgörüsüz 3 = 15 Dakika", false, window)
        guiSetFont(hg3, "default-bold-small")
        guiSetProperty(hg3, "NormalTextColour", "FFFFFFFF")
        hg4 = guiCreateButton(202, 484, 216, 52, "Hoşgörüsüz 4 = Kick", false, window)
        guiSetFont(hg4, "default-bold-small")
        guiSetProperty(hg4, "NormalTextColour", "FFFFFFFF")
        hgisim = guiCreateLabel(241, 215, 149, 17, "Hoşgörüsüz", false, window)
        guiSetFont(hgisim, "default-bold-small")
        guiLabelSetHorizontalAlign(hgisim, "center", false)
        al1 = guiCreateButton(518, 246, 216, 52, "Ailevi 1 = 10 Dakika", false, window)
        guiSetFont(al1, "default-bold-small")
        guiSetProperty(al1, "NormalTextColour", "FFFFFFFF")
        al2 = guiCreateButton(518, 327, 216, 52, "Ailevi 2 = 20 Dakika", false, window)
        guiSetFont(al2, "default-bold-small")
        guiSetProperty(al2, "NormalTextColour", "FFFFFFFF")
        al3 = guiCreateButton(518, 403, 216, 52, "Ailevi 3 = 30 Dakika", false, window)
        guiSetFont(al3, "default-bold-small")
        guiSetProperty(al3, "NormalTextColour", "FFFFFFFF")
        al4 = guiCreateButton(518, 484, 216, 52, "Ailevi 4 = 1 Saat Ban", false, window)
        guiSetFont(al4, "default-bold-small")
        guiSetProperty(al4, "NormalTextColour", "FFFFFFFF")
        alisim = guiCreateLabel(555, 212, 149, 17, "Ailevi", false, window)
        guiSetFont(alisim, "default-bold-small")
        guiLabelSetHorizontalAlign(alisim, "center", false)   

function createPlayerList()
for id, playeritem in ipairs(getElementsByType("player")) do
local row = guiGridListAddRow ( playerList )
guiGridListSetItemText( playerList, row, column, string.gsub(getPlayerName( playeritem ), "#%x%x%x%x%x%x", ""), false, false)
guiGridListSetItemData(playerList, row, column, playeritem)
end
end
 
 
addEventHandler("onClientGUIClick", resourceRoot, function()
if seciliKisiCek() then
if source == hg1 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), 1, "Mute")
elseif source == hg2 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), 10, "Mute")
elseif source == hg3 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), 15, "Mute")
elseif source == hg4 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), _, "Kick")
elseif source == al1 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), 10, "Mute")
elseif source == al2 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), 20, "Mute")
elseif source == al3 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), 30, "Mute")
elseif source == al4 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), 3600, "Ban") -- 3600 = 1 saat (saniye olarak)
end
else
outputChatBox("Lütfen listeden bir kişi seç.", 255,0,0, true)
end
end)
 
function seciliKisiCek()
local row,col = guiGridListGetSelectedItem(playerList)
if row and col and row ~= -1 and col ~= -1 then
secilenKisi = guiGridListGetItemData ( playerList, row, 1 )
else
return false
end
return secilenKisi
end
 
function guiOpen()
if (guiGetVisible(window) == true) then --Check whether gui is visible or not
guiSetVisible(window, false) --if visible then close it
showCursor(false)
else
guiSetVisible(window, true) --if not open it
showCursor(true)
createPlayerList()
end
end
bindKey("o", "down", guiOpen) --bind F2 for that function

server.lua
Kod: lua
addEvent("CezaVer", true)
addEventHandler("CezaVer", root, function(oyuncu, sure, olay)
if olay == "Mute" then
setPlayerMuted(oyuncu, true)
outputChatBox(getPlayerName(oyuncu).. " #FFFFFFİsimli oyuncu #cc0000"..sure.." #FFFFFFdakika susturuldu", root, 0,255,0, true)
setTimer(muteKaldir, 60000*sure,1, oyuncu)
elseif olay == "Kick" then
kickPlayer ( oyuncu, source, "Hosgorusuz davrandıgın icin kick" )
elseif olay == "Ban" then
banPlayer(oyuncu, true, false, true, source, "Ailevi küfürden dolayı banlandın", sure )
end
end)

function muteKaldir(oyuncu)
if isElement(oyuncu) then
if isPlayerMuted(oyuncu) then
setPlayerMuted(oyuncu, false)
outputChatBox(getPlayerName(oyuncu).. " Artık konuşabilirsin.", root, 0,255,0, true)
end
end
end

Scripte yetki vermeyi unutma
Linki görebilmek için Kayıt olun yada Giriş yapın.
 


Çevrimdışı CastiaL

  • Yeni Üye
  • *
    • İleti: 62
Yanıtla #13 : 30 Ocak 2018, 00:19:06
Linki görebilmek için Kayıt olun yada Giriş yapın.
Kopyala yapıştır direk kafan karışmasın diye tümünü attım

Eğer mahlukat benden sonra atarsa onunkini kullan  :P :P



Kod: lua
root = getRootElement()
 
function center(center_window)
    local screenW, screenH = guiGetScreenSize()
    local windowW, windowH = guiGetSize(center_window, false)
    local x, y = (screenW - windowW) /2,(screenH - windowH) /2
    guiSetPosition(center_window, x, y, false)
end
 
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        window = guiCreateWindow(320, 266, 758, 621, "Degistir", false)
                center(window)
        guiWindowSetMovable(window, false)
        guiWindowSetSizable(window, false)
                guiSetVisible(window, false)
 
        playerList = guiCreateGridList(9, 29, 173, 576, false, window)
        nick = guiCreateLabel(202, 64, 216, 18, "Nick:", false, window)
        guiSetFont(nick, "default-bold-small")
        mutedurum = guiCreateLabel(202, 121, 216, 18, "Mute Durumu:", false, window)
        guiSetFont(mutedurum, "default-bold-small")

        hg1 = guiCreateButton(202, 246, 216, 52, "Hoşgörüsüz 1 = 5 Dakika", false, window)
        guiSetFont(hg1, "default-bold-small")
        guiSetProperty(hg1, "NormalTextColour", "FFFFFFFF")
 
 
        hg2 = guiCreateButton(202, 327, 216, 52, "Hoşgörüsüz 2 = 10 Dakika", false, window)
        guiSetFont(hg2, "default-bold-small")
        guiSetProperty(hg2, "NormalTextColour", "FFFFFFFF")

        hg3 = guiCreateButton(202, 403, 216, 52, "Hoşgörüsüz 3 = 15 Dakika", false, window)
        guiSetFont(hg3, "default-bold-small")
        guiSetProperty(hg3, "NormalTextColour", "FFFFFFFF")

        hg4 = guiCreateButton(202, 484, 216, 52, "Hoşgörüsüz 4 = Kick", false, window)
        guiSetFont(hg4, "default-bold-small")
        guiSetProperty(hg4, "NormalTextColour", "FFFFFFFF")

        hgisim = guiCreateLabel(241, 215, 149, 17, "Hoşgörüsüz", false, window)
        guiSetFont(hgisim, "default-bold-small")
        guiLabelSetHorizontalAlign(hgisim, "center", false)

        al1 = guiCreateButton(518, 246, 216, 52, "Ailevi 1 = 10 Dakika", false, window)
        guiSetFont(al1, "default-bold-small")
        guiSetProperty(al1, "NormalTextColour", "FFFFFFFF")

        al2 = guiCreateButton(518, 327, 216, 52, "Ailevi 2 = 20 Dakika", false, window)
        guiSetFont(al2, "default-bold-small")
        guiSetProperty(al2, "NormalTextColour", "FFFFFFFF")

        al3 = guiCreateButton(518, 403, 216, 52, "Ailevi 3 = 30 Dakika", false, window)
        guiSetFont(al3, "default-bold-small")
        guiSetProperty(al3, "NormalTextColour", "FFFFFFFF")

        al4 = guiCreateButton(518, 484, 216, 52, "Ailevi 4 = 1 Saat Ban", false, window)
        guiSetFont(al4, "default-bold-small")
        guiSetProperty(al4, "NormalTextColour", "FFFFFFFF")

        alisim = guiCreateLabel(555, 212, 149, 17, "Ailevi", false, window)
        guiSetFont(alisim, "default-bold-small")
        guiLabelSetHorizontalAlign(alisim, "center", false)   
    end
)
 
-----
 
function createPlayerList ()
        -- Create a players column in the list
        local column = guiGridListAddColumn( playerList, "Player", 0.85 )
        if ( column ) then         -- If the column has been created, fill it with players
                for id, playeritem in ipairs(getElementsByType("player")) do
                        local row = guiGridListAddRow ( playerList )
                        guiGridListSetItemText ( playerList, row, column, string.gsub(getPlayerName( playeritem ), "#%x%x%x%x%x%x", ""), false, false)
guiGridListSetItemData(playerList, row,column, playeritem)
                        end
                addEventHandler ( "onClientGUIClick", playerList, click )
        end
end
addEventHandler ( "onClientResourceStart", resourceRoot, createPlayerList )
 
function click ( button, state, sx, sy, x, y, z, elem, gui )
        -- if state is down ( not to trigger the function twice on mouse button up/down), clicked gui and the element is our player list
        if ( ( state == "down" ) and ( gui == true ) and ( source == playerList ) ) then
                -- get the player name from the selected row, first column
                local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 )
                outputChatBox ( playerName )     -- output it to chat box
        end
end
 
 
-------
 
function guiOpen()
if (guiGetVisible(window) == true) then --Check whether gui is visible or not
guiSetVisible(window, false) --if visible then close it
showCursor(false)
else
guiSetVisible(window, true) --if not open it
showCursor(true)
end
end
bindKey("o", "down", guiOpen) --bind F2 for that function

--Butonlar
addEventHandler ( "onClientGUIClick", root,function ()
    if source == hg1 then
      local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("muteAt", localPlayer, oyuncu,1)
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
elseif source == hg2 then
local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("muteAt", localPlayer, oyuncu,10)
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
elseif source == hg3 then
local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("muteAt", localPlayer, oyuncu,15)
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
elseif source == hg4 then
local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("kickAt", localPlayer, oyuncu,"Hoşgörüsüz")
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
elseif source == al1 then
local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("banAt", localPlayer, oyuncu,0.15,"Ailevi Küfür")
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
elseif source == al2 then
local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("banAt", localPlayer, oyuncu,0.2,"Ailevi Küfür")
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
elseif source == al3 then
local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("banAt", localPlayer, oyuncu,0.25,"Ailevi Küfür")
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
elseif source == al4 then
local row,col = guiGridListGetSelectedItem(playerList)
      if row and col and row ~= -1 and col ~= -1 then
         local oyuncu = guiGridListGetItemData(playerList, row, 1)
         triggerServerEvent("banAt", localPlayer, oyuncu,1,"Ailevi Küfür")
        else
            outputChatBox("Lütfen bir oyuncu seçiniz!", 255,0,0)   
        end
end
end)

Kod: lua
zaman = 60000
addEvent("muteAt", true)
addEventHandler("muteAt", root, function(Oyuncular,sure)
    setPlayerMuted(Oyuncular, true)
setTimer ( muteAc, (sure*zaman), 1, source)
outputChatBox(getPlayerName(source).." isimli yetkili " ..getPlayerName(Oyuncular).."adlı oyuncuyu susturdu.", root, 0,255,0, true)
end)

function muteAc (player)
if (isElement (player) and isPlayerMuted (player)) then
setPlayerMuted (player, false )
outputChatBox ("#FFFFFF"..getPlayerName ( player ).." #bbfa00 artık konuşabilirsin. ",getRootElement(), 255, 255, 0,true )
end
end

addEvent("kickAt", true)
addEventHandler("kickAt", root, function(Oyuncular,sebep)
    kickPlayer ( Oyuncular, source, sebep )
outputChatBox("#FFFFFF"..getPlayerName(Oyuncular).."#FF0000adlı oyuncu "..getPlayerName(source).." tarafından kicklendi.", root, 255,255,255,true)
end)

addEvent("banAt", true)
addEventHandler("banAt", root, function(Oyuncular,sure,sebep)
    banPlayer(Oyuncular,true,false,true,source,sebep,sure)
outputChatBox("#FFFFFF"..getPlayerName(Oyuncular).."#FF0000adlı oyuncu "..getPlayerName(source).." tarafından banlandı. #FFFFFF[Sebep :"..sebep.."]", root, 255,255,255,true)
end)
ERROR:client (benim nick) triggered serverside event muteAt, but event is not added serverside

Mesaj Birleştirildi: 30 Ocak 2018, 00:20:37
Linki görebilmek için Kayıt olun yada Giriş yapın.
sec begen al xd

client
Kod: lua
function center(center_window)
    local screenW, screenH = guiGetScreenSize()
    local windowW, windowH = guiGetSize(center_window, false)
    local x, y = (screenW - windowW) /2,(screenH - windowH) /2
    guiSetPosition(center_window, x, y, false)
end

        window = guiCreateWindow(320, 266, 758, 621, "Degistir", false)
        center(window)
        guiWindowSetMovable(window, false)
        guiWindowSetSizable(window, false)
        guiSetVisible(window, false)
 
        playerList = guiCreateGridList(9, 29, 173, 576, false, window)
column = guiGridListAddColumn( playerList, "Player", 0.85 ) 
        nick = guiCreateLabel(202, 64, 216, 18, "Nick:", false, window)
        guiSetFont(nick, "default-bold-small")
        mutedurum = guiCreateLabel(202, 121, 216, 18, "Mute Durumu:", false, window)
        guiSetFont(mutedurum, "default-bold-small")

        hg1 = guiCreateButton(202, 246, 216, 52, "Hoşgörüsüz 1 = 5 Dakika", false, window)
        guiSetFont(hg1, "default-bold-small")
        guiSetProperty(hg1, "NormalTextColour", "FFFFFFFF")
        hg2 = guiCreateButton(202, 327, 216, 52, "Hoşgörüsüz 2 = 10 Dakika", false, window)
        guiSetFont(hg2, "default-bold-small")
        guiSetProperty(hg2, "NormalTextColour", "FFFFFFFF")
        hg3 = guiCreateButton(202, 403, 216, 52, "Hoşgörüsüz 3 = 15 Dakika", false, window)
        guiSetFont(hg3, "default-bold-small")
        guiSetProperty(hg3, "NormalTextColour", "FFFFFFFF")
        hg4 = guiCreateButton(202, 484, 216, 52, "Hoşgörüsüz 4 = Kick", false, window)
        guiSetFont(hg4, "default-bold-small")
        guiSetProperty(hg4, "NormalTextColour", "FFFFFFFF")
        hgisim = guiCreateLabel(241, 215, 149, 17, "Hoşgörüsüz", false, window)
        guiSetFont(hgisim, "default-bold-small")
        guiLabelSetHorizontalAlign(hgisim, "center", false)
        al1 = guiCreateButton(518, 246, 216, 52, "Ailevi 1 = 10 Dakika", false, window)
        guiSetFont(al1, "default-bold-small")
        guiSetProperty(al1, "NormalTextColour", "FFFFFFFF")
        al2 = guiCreateButton(518, 327, 216, 52, "Ailevi 2 = 20 Dakika", false, window)
        guiSetFont(al2, "default-bold-small")
        guiSetProperty(al2, "NormalTextColour", "FFFFFFFF")
        al3 = guiCreateButton(518, 403, 216, 52, "Ailevi 3 = 30 Dakika", false, window)
        guiSetFont(al3, "default-bold-small")
        guiSetProperty(al3, "NormalTextColour", "FFFFFFFF")
        al4 = guiCreateButton(518, 484, 216, 52, "Ailevi 4 = 1 Saat Ban", false, window)
        guiSetFont(al4, "default-bold-small")
        guiSetProperty(al4, "NormalTextColour", "FFFFFFFF")
        alisim = guiCreateLabel(555, 212, 149, 17, "Ailevi", false, window)
        guiSetFont(alisim, "default-bold-small")
        guiLabelSetHorizontalAlign(alisim, "center", false)   

function createPlayerList()
for id, playeritem in ipairs(getElementsByType("player")) do
local row = guiGridListAddRow ( playerList )
guiGridListSetItemText( playerList, row, column, string.gsub(getPlayerName( playeritem ), "#%x%x%x%x%x%x", ""), false, false)
guiGridListSetItemData(playerList, row, column, playeritem)
end
end
 
 
addEventHandler("onClientGUIClick", resourceRoot, function()
if seciliKisiCek() then
if source == hg1 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), 1, "Mute")
elseif source == hg2 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), 10, "Mute")
elseif source == hg3 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), 15, "Mute")
elseif source == hg4 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), _, "Kick")
elseif source == al1 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), 10, "Mute")
elseif source == al2 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), 20, "Mute")
elseif source == al3 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), 30, "Mute")
elseif source == al4 then
triggerServerEvent("CezaVer", localPlayer, seciliKisiCek(), 3600, "Ban") -- 3600 = 1 saat (saniye olarak)
end
else
outputChatBox("Lütfen listeden bir kişi seç.", 255,0,0, true)
end
end)
 
function seciliKisiCek()
local row,col = guiGridListGetSelectedItem(playerList)
if row and col and row ~= -1 and col ~= -1 then
secilenKisi = guiGridListGetItemData ( playerList, row, 1 )
else
return false
end
return secilenKisi
end
 
function guiOpen()
if (guiGetVisible(window) == true) then --Check whether gui is visible or not
guiSetVisible(window, false) --if visible then close it
showCursor(false)
else
guiSetVisible(window, true) --if not open it
showCursor(true)
createPlayerList()
end
end
bindKey("o", "down", guiOpen) --bind F2 for that function

server.lua
Kod: lua
addEvent("CezaVer", true)
addEventHandler("CezaVer", root, function(oyuncu, sure, olay)
if olay == "Mute" then
setPlayerMuted(oyuncu, true)
outputChatBox(getPlayerName(oyuncu).. " #FFFFFFİsimli oyuncu #cc0000"..sure.." #FFFFFFdakika susturuldu", root, 0,255,0, true)
setTimer(muteKaldir, 60000*sure,1, oyuncu)
elseif olay == "Kick" then
kickPlayer ( oyuncu, source, "Hosgorusuz davrandıgın icin kick" )
elseif olay == "Ban" then
banPlayer(oyuncu, true, false, true, source, "Ailevi küfürden dolayı banlandın", sure )
end
end)

function muteKaldir(oyuncu)
if isElement(oyuncu) then
if isPlayerMuted(oyuncu) then
setPlayerMuted(oyuncu, false)
outputChatBox(getPlayerName(oyuncu).. " Artık konuşabilirsin.", root, 0,255,0, true)
end
end
end

Scripte yetki vermeyi unutma

aynı hatayı veriyor yavuzaydakiyle
« Son Düzenleme: 30 Ocak 2018, 00:20:37 Gönderen: CastiaL »
 


Çevrimdışı Mahlukat

  • Uzman Üye
  • *
    • İleti: 637
Yanıtla #14 : 30 Ocak 2018, 00:23:29
meta.xml dosyanı kontrol et

Bende bir sorun yok :P
Spoiler for Hiden:
Linki görebilmek için Kayıt olun yada Giriş yapın.