0 Üye ve 1 Ziyaretçi konuyu incelemekte.
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
aMuteInputForm = nillocal 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 = playerendfunction 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 ) endendfunction aMuteInputBoxClick ( button ) if ( button == "left" ) then if ( source == aMuteInputOk ) then aMuteInputBoxFinish() aMuteInputPlayer = nil aMuteInputBoxClose ( false ) elseif ( source == aMuteInputCancel ) then aMuteInputPlayer = nil aMuteInputBoxClose ( false ) end endendfunction 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 ) endend
g_Prefs.mutedurations = getString('mutedurations','300,600,1200,1500,0')
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