[YARDIM] \"P\" Admin Paneli - \"Mute Durations\"

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı ardaabo

  • Acemi Üye
  • *
    • İleti: 145
Merhaba, "p" admin paneli üstünde biraz oynamalar yaptım, Türkçeleştirdim vs. Ama tek yapamadığım bu Mute ve Ban Sürelerini değiştirmem. Saniyeye göre yapılmış, bu saniyeleri dakikalarına göre değiştirdim ama hala kendi orjinal halinde. Yardımcı olabilecek birisi var mı acaba

Fotoğraf:
Spoiler for Hiden:

Durations kod:
Kod
function cachePrefs()
g_Prefs = {}
g_Prefs.maxmsgs = getNumber('maxmsgs',99)
g_Prefs.bandurations = getString('bandurations','60,3600,43200,0')
g_Prefs.mutedurations = getString('mutedurations','300,600,1200,1500,0')
g_Prefs.reportCategories = getString('reportCategories','Soru,Öneri,Diğer')
g_Prefs.playerReportCategories = getString('playerReportCategories','Hileci/Moder,Spamcı')
g_Prefs.clientcheckban = getBool('clientcheckban',false)
g_Prefs.securitylevel = getNumber('securitylevel',2)
g_Prefs.maxchatmsgs = getNumber('maxchatmsgs',10)
triggerClientEvent( root, "onClientUpdatePrefs", resourceRoot, g_Prefs )
end


Panel:
Kod
aMuteInputForm = nil
local aMuteDurations = {}

function aMuteInputBox ( player )
-- parse 'mutedurations' setting
local durations = {}
for i,dur in ipairs( split( g_Prefs.mutedurations, string.byte(',') ) ) do
if tonumber( dur ) then
table.insert( durations, tonumber( dur ) )
end
end
-- destroy form if number of durations has changed
if #aMuteDurations ~= #durations then
if aMuteInputForm then
_widgets["MuteInputBox"] = nil
destroyElement( aMuteInputForm )
aMuteInputForm = nil
end
end
aMuteDurations = durations
if ( aMuteInputForm == nil ) then
local x, y = guiGetScreenSize()
aMuteInputForm = guiCreateWindow ( x / 2 - 150, y / 2 - 64, 300, 150 + #aMuteDurations * 15, "", false )
  guiWindowSetSizable ( aMuteInputForm, false )
guiSetAlpha(aMuteInputForm, 1)
y = 24

aMuteInputLabel = guiCreateLabel ( 20, y, 270, 15, "", false, aMuteInputForm )
guiLabelSetHorizontalAlign ( aMuteInputLabel, "center" )
y = y + 23

aMuteInputValue = guiCreateEdit ( 35, y, 230, 24, "", false, aMuteInputForm )
y = y + 33

local height2 = math.floor( #aMuteDurations * 1.02 * 15 ) + 20
aMuteInputRadioSet2bg = guiCreateTabPanel( 55, y, 300-55*2, height2, false, aMuteInputForm)
aMuteInputRadioSet2 = guiCreateStaticImage(0,0,1,1, 'client\\images\\empty.png', true, aMuteInputRadioSet2bg)
guiSetAlpha ( aMuteInputRadioSet2bg, 0.3 )
guiSetProperty ( aMuteInputRadioSet2, 'InheritsAlpha', 'false' )

local yy = 5
aMuteInputRadio2Label = guiCreateLabel ( 10, yy, 270, 15, "Süre:", false, aMuteInputRadioSet2 )
aMuteInputRadio2s = {}
for i,dur in ipairs(aMuteDurations) do
aMuteInputRadio2s[i] = guiCreateRadioButton ( 70, yy, 120, 15, "-", false, aMuteInputRadioSet2 )
yy = yy + 15
end
y = y + height2 + 10

aMuteInputOk = guiCreateButton ( 90, y, 55, 17, "Tamam", false, aMuteInputForm )
aMuteInputCancel = guiCreateButton ( 150, y, 55, 17, "Kapat", false, aMuteInputForm )
y = y + 30

guiSetSize ( aMuteInputForm, guiGetSize ( aMuteInputForm, false ), y, false )

guiSetProperty ( aMuteInputForm, "AlwaysOnTop", "true" )
aMuteInputPlayer = nil

addEventHandler ( "onClientGUIClick", aMuteInputForm, aMuteInputBoxClick )
addEventHandler ( "onClientGUIAccepted", aMuteInputValue, aMuteInputBoxFinish )
--Register With Admin Form
aRegister ( "MuteInputBox", aMuteInputForm, aMuteInputBox, aMuteInputBoxClose )
end

-- update duration values in the form
for i,dur in ipairs(aMuteDurations) do
guiSetText ( aMuteInputRadio2s[i], dur>0 and secondsToTimeDesc(dur) or "Süresiz" )
end

guiSetText ( aMuteInputForm, "Oyuncuyu Sustur | " .. getPlayerName(player) )
guiSetText ( aMuteInputLabel, "Açıklama giriniz" )
aHideFloaters()
guiSetVisible ( aMuteInputForm, true )
guiBringToFront ( aMuteInputForm )
aMuteInputPlayer = player
end

function aMuteInputBoxClose ( destroy )
if ( ( destroy ) or ( guiCheckBoxGetSelected ( aPerformanceInput ) ) ) then
if ( aMuteInputForm ) then
removeEventHandler ( "onClientGUIClick", aMuteInputForm, aMuteInputBoxClick )
removeEventHandler ( "onClientGUIAccepted", aMuteInputValue, aMuteInputBoxFinish )
aMuteInputPlayer = nil
destroyElement ( aMuteInputForm )
aMuteInputForm = nil
end
else
guiSetVisible ( aMuteInputForm, false )
end
end

function aMuteInputBoxClick ( button )
if ( button == "left" ) then
if ( source == aMuteInputOk ) then
aMuteInputBoxFinish()
aMuteInputPlayer = nil
aMuteInputBoxClose ( false )
elseif ( source == aMuteInputCancel ) then
aMuteInputPlayer = nil
aMuteInputBoxClose ( false )
end
end
end


function aMuteInputBoxFinish ()
-- Get duration
local seconds = false
for i,dur in ipairs(aMuteDurations) do
if guiRadioButtonGetSelected( aMuteInputRadio2s[i] ) then
seconds = dur
end
end

-- Get reason
local reason = guiGetText ( aMuteInputValue )

-- Validate settings
if seconds == false then
aMessageBox ( "Hata", "Süre seçilmedi!" )
return
end

-- Send mute info to the server
triggerServerEvent ( "aPlayer", localPlayer, aMuteInputPlayer, "mute", reason, seconds )

-- Clear input
guiSetText ( aMuteInputValue, "" )
for i,dur in ipairs(aMuteDurations) do
guiRadioButtonSetSelected( aMuteInputRadio2s[i], false )
end
end

Mesaj Birleştirildi: [time]14 Ocak 2021, 13:22:12[/time]
Ah, sorunu çözdüm. Konu silinebilir;

Sorun:
Kod
g_Prefs.mutedurations	= getString('mutedurations','300,600,1200,1500,0')

mutedurations satırını "durations" olarak değiştirdiğim de sorun çözüldü

Kod
function aMuteInputBox ( player )
-- parse 'mutedurations' setting
local durations = {}
for i,dur in ipairs( split( g_Prefs.mutedurations, string.byte(',') ) ) do
if tonumber( dur ) then
table.insert( durations, tonumber( dur ) )
end
end
« Son Düzenleme: 14 Ocak 2021, 13:22:40 Gönderen: ardaabo »
 


MTASATURK

[YARDIM] \"P\" Admin Paneli - \"Mute Durations\"
« : 14 Ocak 2021, 13:13:43 »