Jump to content

:@ إستفسارءءءء :@


Recommended Posts

سلآلآم عليكم , كيف حالكم ؟ عساكم طيبين بس ~"؟

المهم بغيت كل المطلوب عشان اسوي اللي رح اقوله تحت :)

الحين لنفرض عندي لوحة فيها 3 تشيك بوكس تمام ؟

وانا مسوي قيم لكل واحد منهم , على اساس انه كل واحد فيه تايمر خاص~

وابي لما احدد واحد مثلآ اختاريت اللي تايمر حقه 15 يوم

ابي الاشياء المطلوبه عشان يجيب تاريخ اليوم ويطلع لي التاريخ اللي يخلص فيه التايمر بالضبطء :roll:

اعرف انه

getRealTime 

يجيب تاريخ اليوم وكذا

لاكن محتار وش العملية اللي اطلع فيها التاريخ حق التايمر

Link to comment
عندي طريقه سهله ,

تجيب الوقت الحقيقي

وتسوي تايمر كل ثانيه يتحقق

إذا كان الوقت الحقيقي صار بالتاريخ المطلوب

سو الوظيفه الي تبيها

ولو كان عندي ليبل ابي احط فيه تاريخ انتهاء التايمر :D

Link to comment

شوف مثال

Timer = {} 
addCommandHandler ( 'date', 
function ( player ) 
    local rTime = getRealTime () 
    local rDay = rTime.monthday 
    local rMonth = rTime.month +1 
    local rYear = rTime.year 
    setElementData ( player, 'Day', rDay ) 
    setElementData ( player, 'Month', rMonth ) 
    setElementData ( player, 'Year', rYear ) 
    Timer[player] = setTimer ( checkDate, 1000,0, player ) 
end) 
  
function checkDate ( player ) 
    local cTime = getRealTime () 
    local cDay = cTime.monthday 
    local cMonth = cTime.month 
    local cYear = cTime.year 
    if getElementData ( player, 'Day' ) == cDay and getElementData ( player, 'Month' ) == cMonth and getElementData ( player, 'Year' ) == cYear then 
        outputChatBox ( 'Date '..cDay..' / '..cMonth..' / '..cYear, player ) 
        if isTimer ( Timer[Player] ) then killTimer ( Timer[player] ) end 
    end 
end 
     

على فكرة مو مجربها الطريقه !

Link to comment
شوف مثال
Timer = {} 
addCommandHandler ( 'date', 
function ( player ) 
    local rTime = getRealTime () 
    local rDay = rTime.monthday 
    local rMonth = rTime.month +1 
    local rYear = rTime.year 
    setElementData ( player, 'Day', rDay ) 
    setElementData ( player, 'Month', rMonth ) 
    setElementData ( player, 'Year', rYear ) 
    Timer[player] = setTimer ( checkDate, 1000,0, player ) 
end) 
  
function checkDate ( player ) 
    local cTime = getRealTime () 
    local cDay = cTime.monthday 
    local cMonth = cTime.month 
    local cYear = cTime.year 
    if getElementData ( player, 'Day' ) == cDay and getElementData ( player, 'Month' ) == cMonth and getElementData ( player, 'Year' ) == cYear then 
        outputChatBox ( 'Date '..cDay..' / '..cMonth..' / '..cYear, player ) 
        if isTimer ( Timer[Player] ) then killTimer ( Timer[player] ) end 
    end 
end 
     

على فكرة مو مجربها الطريقه !

مثل م قلت لك مو هذا اللي ابيه :wink:

Link to comment
انت تقول تبي يجيب تاريخ الإنتهاء

انا جبت لك الوقت حقك

وزودت عليه شهر , عشان يحسبه تاريخ إنتهاء

إلا إذا تبي غير كذا يفيدونك الشباب

م ابي شهر ابي انا الي احطه يجيبه يعني حطيت 15 يوم يشوف كم التايمر ويحطه حسب التايمر

Link to comment
انا فهمت حسب كودك الأول انك مخزن المدة على sql

عندي لك طريقة

سوي تايمر لكل ثانية وجيب جميع القيم (المدة) ونقص منها ثانية

مدري فهمت ولا لا

وضح اكثر

+ يب انا خازن كل شيء على sql

Link to comment
ايه فهمتك
setTimer 
getTimerDetails 

بس هذا الي تحتاجه

وعشان تحطها بليبل سو ترايقر وارسل معه المتغير حق التايمر

وانا سويتها كذا

لاكن المتغير اللي رسلته ثابت ومتى م يجي الاعب يدخل ويشوف الليبل مايتغير شي

يبقى مثل م هو

مثلا 15 يوم

تجي بكرا تدخل تشوف الليبل تبقى 15 يوم

ماتتغير تصير 14

Link to comment
ايه فهمتك
setTimer 
getTimerDetails 

بس هذا الي تحتاجه

وعشان تحطها بليبل سو ترايقر وارسل معه المتغير حق التايمر

عطيته الفنكشن قبل كذا هع

+ للتوضيح فيه 3 ارقمنتات

int, int, int getTimerDetails ( timer theTimer ) 

شرحها لك الويكي تحت السنتاكس , وتقدر تجرب المثال راح يفيدك

Edited by Guest
Link to comment

كلنت

:

addEvent( 'YesVIPuser', true) 
addEventHandler( 'YesVIPuser', root, 
function(VIPstatus, expireTime) 
if (VIPstatus) then 
guiSetEnabled(LOGIN.BUTTON.Window, false) 
guiSetText(STTATUSlogin.LABEL.Window, "* Seccessfully Logined In !") 
setTimer( guiSetVisible, 5000, 1, STTATUSlogin.LABEL.Window, false ) 
guiSetText(LOGIN.BUTTON.Window, "Logined as [VIP]") 
guiLabelSetColor(STTATUSlogin.LABEL.Window, 0, 255, 0) 
guiSetText(Expire.Label.Window, expireTime) 
guiSetVisible(STTATUSlogin.LABEL.Window, true) 
guiSetVisible(SetSkinVIP.Button.Window, true) 
guiSetVisible(GiveVIPCar.Button.Window, true) 
guiSetVisible(GiveJetpack.Button.Window, true) 
guiSetVisible(Get100Health.Button.Window, true) 
guiSetVisible(Get100Armour.Button.Window, true) 
guiSetVisible(DaysRemaining.Note.Window, true) 
guiSetVisible(GiveM16.Button.Window, true) 
guiSetVisible(ExpireAt.Note.Window, true) 
guiSetVisible(Expire.Label.Window, true) 
triggerServerEvent( 'playerLogined', localPlayer) 
end 
end 
) 

addEvent('CheckPlayerSerial', true) 
addEventHandler( 'CheckPlayerSerial', root, 
function(Serial, getIndex, Standerd, Mini, SuperStar) 
if (not getIndex or getIndex <= 29) then outputChatBox( '* Error : #FFFFFF Inviled player serial', source, 255, 0, 0, true) return end 
local player = getPlayerFromSerial ( Serial ) 
local serialExists = getPlayerSerial(player) 
local checkIFexists = executeSQLQuery( ' SELECT * FROM `VIPsystemUSERS#` WHERE userSerial=? ', serialExists ) 
if ( type (checkIFexists) == "table" and #checkIFexists == 0 or not checkIFexists ) then 
if (Standerd ~= nil) then 
  
ExipreTimer = setTimer( function(  ) 
local getPlayer = getPlayerFromSerial(Serial) 
local serialRemove = getPlayerSerial(getPlayer) 
executeSQLQuery( ' DELETE FROM `VIPsystemUSERS#` WHERE userSerial=? ', serialRemove) 
triggerClientEvent( getPlayer, 'resetVIPsystem', getPlayer ) 
end, Standerd, 1) 
  
else if (Mini ~= nil) then 
ExipreTimer = setTimer( function(  ) 
local getPlayer = getPlayerFromSerial(Serial) 
local serialRemove = getPlayerSerial(getPlayer) 
executeSQLQuery( ' DELETE FROM `VIPsystemUSERS#` WHERE userSerial=? ', serialRemove) 
triggerClientEvent( getPlayer, 'resetVIPsystem', getPlayer ) 
end, Mini, 1) 
  
else if (SuperStar ~= nil) then 
ExipreTimer = setTimer( function(  ) 
local getPlayer = getPlayerFromSerial(Serial) 
local serialRemove = getPlayerSerial(getPlayer) 
executeSQLQuery( ' DELETE FROM `VIPsystemUSERS#` WHERE userSerial=? ', serialRemove) 
triggerClientEvent( getPlayer, 'resetVIPsystem', getPlayer ) 
end, SuperStar, 1) 
else return end 
end 
end 
playerStatus = "activated" 
expiredRemaining, RemainingExcutes, TotalExcutes = getTimerDetails(ExipreTimer) 
expiredIn = math.floor(expiredRemaining / 86400000) 
executeSQLQuery( ' INSERT INTO `VIPsystemUSERS#` (userSerial,status,expiretime) VALUES(?,?,?) ', Serial, playerStatus, expiredIn ) 
triggerClientEvent( source, 'SeccessfullyMessage', source) 
else if (checkIFexists) then outputChatBox( '* Error : #FFFFFF This user is already activated !', source, 255, 0, 0, true) return end 
end 
end 
) 

لاحظ قيمة التايمر المتبقى expiretime

وبالكلنت تبقى مثل م هي

ماتتغير يوم ثاني وثالث

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...