mody134 Posted December 23, 2016 Share Posted December 23, 2016 عايز لما حد يغير الوقت يتغير عندة هو بس مش عند كل الناس --------------------------- -- Time --------------------------- function timeInit() local hours, minutes = getTime() setControlNumbers(wndTime, { hours = hours, minutes = minutes }) end function selectTime(leaf) setControlNumbers(wndTime, { hours = leaf.h, minutes = leaf.m }) end function applyTime() local hours, minutes = getControlNumbers(wndTime, { 'hours', 'minutes' }) server.setTime(hours, minutes) closeWindow(wndTime) end wndTime = { 'wnd', text = 'Set time', width = 220, controls = { { 'lst', id='timelist', width=200, height=150, columns={ {text='Time', attr='name'} }, rows={ {name='Midnight', h=0, m=0}, {name='Dawn', h=5, m=0}, {name='Morning', h=9, m=0}, {name='Noon', h=12, m=0}, {name='Afternoon', h=15, m=0}, {name='Evening', h=20, m=0}, {name='Night', h=22, m=0} }, onitemclick=selectTime, ondoubleclick=applyTime }, {'txt', id='hours', text='', width=40}, {'lbl', text=':'}, {'txt', id='minutes', text='', width=40}, {'btn', id='ok', onclick=applyTime}, {'btn', id='cancel', closeswindow=true} }, oncreate = timeInit } function setTimeCommand(cmd, hours, minutes) if not hours then return end local curHours, curMinutes = getTime() hours = tonumber(hours) or curHours minutes = minutes and tonumber(minutes) or curMinutes setTime(hours, minutes) end addCommandHandler('settime', setTimeCommand) addCommandHandler('st', setTimeCommand) function toggleFreezeTime() local state = guiCheckBoxGetSelected(getControl(wndMain, 'freezetime')) guiCheckBoxSetSelected(getControl(wndMain, 'freezetime'), not state) server.setTimeFrozen(state) end function setTimeFrozen(state, h, m, w) guiCheckBoxSetSelected(getControl(wndMain, 'freezetime'), state) if state then if not g_TimeFreezeTimer then g_TimeFreezeTimer = setTimer(function() setTime(h, m) setWeather(w) end, 5000, 0) setMinuteDuration(9001) end else if g_TimeFreezeTimer then killTimer(g_TimeFreezeTimer) g_TimeFreezeTimer = nil end setMinuteDuration(1000) end end Link to comment
#STZ Posted December 23, 2016 Share Posted December 23, 2016 خله يغير الجو للسورس فقط اللي ضغط الزر اللي هو اللاعب source Link to comment
Master_MTA Posted December 23, 2016 Share Posted December 23, 2016 بالكلنت خطا اخوي نايف بالكلنت تكون localPlayer اما السورس في حدث ضغط الزر يكون الزر بالتوفيق Link to comment
!#NssoR_) Posted December 23, 2016 Share Posted December 23, 2016 (edited) من قالكم ان الكود اصلا فيه بارمتر للاعب ! Edited December 23, 2016 by !#NssoR_) 2 Link to comment
Master_MTA Posted December 24, 2016 Share Posted December 24, 2016 انا اعقب على كلام اخوي نايف ما شفت الكود اصلا Link to comment
Jw8. Posted December 24, 2016 Share Posted December 24, 2016 (edited) أعتقد أنه بل فري روم ميتغير عند كل ألناس جرب أستخدم getLocalPlayer Edited December 24, 2016 by DmAr511 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