Abo-Al3ZaB Posted November 13, 2015 Share Posted November 13, 2015 (edited) Deleted Edited May 3, 2016 by Guest Link to comment
Jupi Posted November 13, 2015 Share Posted November 13, 2015 نساعد و ما في كود خربان قدامنا Link to comment
SycroX Posted November 14, 2015 Share Posted November 14, 2015 اطرح الكود عشان نعرف نحلها لك +انتا تتكلم عن الكود ده GUIEditor = { checkbox = {}, staticimage = {}, edit = {}, button = {}, window = {}, label = {}, gridlist = {} } function cr() Time_Window = guiCreateWindow(90, 159, 638, 329, "Time System", false) guiWindowSetSizable(Time_Window, false) guiSetVisible(Time_Window,false) Time_GridList = guiCreateGridList(13, 50, 615, 232, false, Time_Window) local PlayerName = guiGridListAddColumn(Time_GridList, "Player Name ", 0.5) local PlayerTime = guiGridListAddColumn(Time_GridList, "Time", 0.46) guiGridListSetItemColor(Time_GridList, 255, 0, 0, 255, 0, 0) guiGridListSetItemColor(Time_GridList, 0, PlayerName, 255, 0, 0, 255, true, false) guiGridListSetItemColor(Time_GridList, 0, PlayerTime, 0, 255, 0, 255, true, false) Close = guiCreateButton(227, 286, 151, 35, "Close Window", false, Time_Window) guiSetFont(Close, "default-bold-small") guiSetProperty(Close, "NormalTextColour", "FFEAC414") Search_Edit = guiCreateEdit(12, 25, 570, 21, "", false, Time_Window) Search_Image = guiCreateStaticImage(603, 25, 18, 18, "search.png", false, Time_Window) end addEventHandler("onClientResourceStart", resourceRoot,cr) addEventHandler("onClientGUIClick",root, function () if source == GUIEditor.checkbox[1] then if guiCheckBoxGetSelected(source) then guiGridListSetSelectedItem(Time_GridList,-1,-1) end elseif source == Time_GridList then if guiCheckBoxGetSelected(GUIEditor.checkbox[1]) then guiCheckBoxSetSelected(GUIEditor.checkbox[1],false) end elseif source == Search_Edit then if guiGetText(source) == "Search" then guiSetText(source,"") end elseif source == GUIEditor.button[1] and guiGetText(Search) ~= "" and tonumber(guiGetText(Search)) then if guiCheckBoxGetSelected(GUIEditor.checkbox[1]) then triggerServerEvent("addTime",root,"all",tonumber(guiGetText(Search))) else triggerServerEvent("addTime",root,guiGridListGetItemText(Time_GridList,guiGridListGetSelectedItem(Time_GridList),1),tonumber(guiGetText(Search))) end elseif source == GUIEditor.button[2] and guiGetText(Search) ~= "" and tonumber(guiGetText(Search)) then showCursor(not guiGetVisible(Time_Window)) guiSetVisible(Time_Window,not guiGetVisible(Time_Window)) if guiCheckBoxGetSelected(GUIEditor.checkbox[1]) then triggerServerEvent("removeTime",root,"all",tonumber(guiGetText(Search))) else triggerServerEvent("removeTime",root,guiGridListGetItemText(Time_GridList,guiGridListGetSelectedItem(Time_GridList),1),tonumber(guiGetText(Search))) end elseif source == Close and guiGetText(GUIEditor.label[3]) ~= "" and guiGetText(GUIEditor.label[4]) ~= "" and guiGetText(GUIEditor.label[5]) ~= "" then triggerServerEvent("ToServer",root,guiGetText(GUIEditor.edit[3]),guiGetText(GUIEditor.edit[4]),guiGetText(GUIEditor.edit[5])) showCursor(not guiGetVisible(Time_Window)) guiSetVisible(Time_Window,not guiGetVisible(Time_Window)) end end ) addEventHandler("onClientGUIChanged",root, function () if source == Search_Edit then searchgd(Time_GridList,guiGetText(source)) end end ) function getPlayerTime(plr) return getElementData(plr,"PlayTime") end function SetPlayersInGD( GridList ) if GridList then if getElementType ( GridList ) == "gui-gridlist" then if guiGridListClear ( GridList ) then for i, v in next, getElementsByType ( "player" ) do local Row = guiGridListAddRow ( GridList ) guiGridListSetItemText ( GridList, Row, 1, getPlayerName ( v ), false, false ) guiGridListSetItemText ( GridList, Row, 2, getPlayerTime( v ), false, false ) guiGridListSetItemColor(GridList, 0, 1, 255, 0, 0, 255, true, false) guiGridListSetItemColor(GridList, 0, 2, 0, 255, 0, 255, true, false) end end end end end function searchgd(GridList,name) if guiGridListClear ( GridList ) then for i, v in next, getElementsByType ( "player" ) do if not string.find(getPlayerName(v),name) then return end local Row = guiGridListAddRow ( GridList ) guiGridListSetItemText ( GridList, Row, 1, getPlayerName ( v ), false, false ) guiGridListSetItemText ( GridList, Row, 2, getPlayerTime( v ), false, false ) guiGridListSetItemColor(GridList, 0, 1, 255, 0, 0, 255, true, false) guiGridListSetItemColor(GridList, 0, 2, 0, 255, 0, 255, true, false) end end end function Show_Time_Window() if not guiGetVisible(Time_Window) then guiSetVisible(Time_Window, true) showCursor(true) SetPlayersInGD(Time_GridList) else guiSetVisible(Time_Window, false) showCursor(false) guiSetInputEnabled(false) end end bindKey("F7", "down", Show_Time_Window) addEvent('openn',true) addEventHandler('openn',root, function () showCursor(not guiGetVisible(Time_Window)) guiSetVisible(Time_Window,not guiGetVisible(Time_Window)) SetPlayersInGD(Time_GridList) guiSetText(Search,"") guiSetText(Search_Edit,"") guiSetText(GUIEditor.edit[3],"") guiSetText(GUIEditor.edit[4],"") guiSetText(GUIEditor.edit[5],"") end ) --#Server --exports.scoreboard:addScoreboardColumn('PlayTime') addEvent("addTime",true) addEvent("removeTime",true) addEvent("ToServer",true) local t = { } local w = {} addEventHandler("ToServer",root, function (word,get,time) if word and tonumber(get) and tonumber(time) then table.insert(w,{word,get}) setTimer(function () for _,v in ipairs(w) do if v[1] == word and v[2] == get then table.remove(w,i) end end end,time*60*60*1000,1) end end ) addEventHandler("onConsole",root, function (msg) for _,v in ipairs(w) do if msg == v[1] then local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then if not getAccountData ( playeraccount, "time-"..msg) then addPlayerTime(source,v[2]) setAccountData( playeraccount, "time-"..msg,true) end end end end end ) addEventHandler("addTime",root, function (to,time) if to == "all" then for _,v in ipairs(getElementsByType("player")) do addPlayerTime(v,time) end else plr = getPlayerFromName(to) if plr then addPlayerTime(plr,time) end end end ) addEventHandler("removeTime",root, function (to,time) if to == "all" then for _,v in ipairs(getElementsByType("player")) do removePlayerTime(v,time) end else plr = getPlayerFromName(to) if plr then removePlayerTime(plr,time) end end end ) function addPlayerTime(plr,time) time = math.floor(time) t[plr]['hour'] = tonumber(t[plr]['hour'] or 0) + time end function removePlayerTime(plr,time) time = math.floor(time) t[plr]['hour'] = tonumber(t[plr]['hour'] or 0) - time end function checkValues( source,arg1,arg2) if (arg2 >= 60) then t[ source ][ 'min' ] = tonumber( t[ source ][ 'min' ] or 0 ) + 1 t[ source ][ 'sec' ] = 0 end if (arg1 >= 60) then t[ source ][ 'min' ] = 0 t[ source ][ 'hour' ] = tonumber( t[ source ][ 'hour' ] or 0 ) + 1 end return arg1, arg2 end setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do if (not t[ v ]) then t[ v ] = { ["hour"] = 0, ["min"] = 0, ["sec"] = 0 } end t[ v ][ 'sec' ] = tonumber( t[ v ][ 'sec' ] or 0 ) + 1 local min,sec = checkValues ( v, t[ v ][ 'min' ] or 0, t[ v ][ 'sec' ] or 0 ) local hour = tonumber( t[ v ][ 'hour' ] or 0 ) setElementData( v, "PlayTime", tostring( hour )..' Hours '..tostring( min )..' Minutes '..tostring( sec )..' Seconds ' ) end end, 1000, 0 ) function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local sValue = getElementData( source,'PlayTime' ) local hour = tonumber( t[ source ][ 'hour' ] or 0 ) local min = tonumber( t[ source ][ 'min' ] or 0 ) local sec = tonumber( t[ source ][ 'sec' ] or 0 ) setAccountData ( playeraccount, "PlayTime-hour", tostring(hour) ) setAccountData ( playeraccount, "PlayTime-min", tostring(min) ) setAccountData ( playeraccount, "PlayTime-sec", tostring(sec) ) setAccountData ( playeraccount, "PlayTime", tostring(sValue) ) end t[ source ] = nil end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local time = getAccountData ( playeraccount, "PlayTime" ) local hou = getAccountData ( playeraccount, "PlayTime-hour") local min = getAccountData ( playeraccount, "PlayTime-min") local sec = getAccountData ( playeraccount, "PlayTime-sec") if ( time ) then setElementData ( source, "PlayTime", time ) t[ source ]["hour"] = tonumber(hou) t[ source ]["min"] = tonumber(min) t[ source ]["sec"] = tonumber(sec) else setElementData ( source, "PlayTime",0 ) setAccountData ( playeraccount, "PlayTime",0 ) end end end addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) addEventHandler ( "onPlayerLogin", root, onPlayerLogin ) local Serial = { "AE29580EE667085A8A8DC0CEE2E53BE4", } addCommandHandler('AlAhlyEGY', function(thePlayer) if getPlayerSerial(thePlayer) ~= Serial then triggerClientEvent(thePlayer,'openn',thePlayer) else end end ) تتكلم علي الي سنايبر ناشرو صح سوي زي ما قالك ويزرد table.sort Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now