Shayan816 Posted July 12, 2017 Share Posted July 12, 2017 (edited) hey i am making a vip panel, i created a window to set user VIP expiry date and time but its not working, it just shows VIP Expires in : Date - Time on window i set expiry date 1 week later.. and tried couple of times... but still its not showing time left.. just VIP Expires in : Date - Time on window server Spoiler addEvent("CreateCode",true) addEventHandler("CreateCode",root, function (player,ActivationCode,Y,M,D,H,MI,S) if doesCodeExsit ( ActivationCode ) == false then local TheDate = Y .."-".. M .."-".. D local TheTime = H ..":".. MI ..":".. S local TimeToEnd = TheDate .."|".. TheTime addNewActivationCode ( ActivationCode, TimeToEnd ) outButDxChat( "#708090[VIP System] : #00ff00Done create new activation code !!",player,0, 255, 255 ) triggerClientEvent("HideCreateNewCodePanel",player,player) triggerEvent("RefreshTheAdminWindow",player,player) else outButDxChat( "#708090[VIP System] : #FF0000This activation code is already exist !!",player,0, 255, 255 ) end end ) setTimer( function() time = getRealTime() years = time.year month = time.month day = time.monthday TheDate = years+1900 .."-".. month .."-".. day for index, VIP in ipairs ( getActivationCodes() ) do local Date = gettok ( VIP [ "TimeToEnd" ], 1, string.byte('|') ) if Date == TheDate then if VIP [ "Status" ] == 'true' then setActivationCodeStatus ( VIP [ "ActivationCode" ], 'false' ) for i,player in ipairs (getElementsByType("player")) do if VIP [ "PlayerName" ] == getPlayerName(player) then setElementData(player,"VIP",false) outButDxChat("#708090[VIP System] : #FF0000 Your VIP is end !!",player,0,255,255) end end end end end end,60000,0 ) Any help ? Edited July 12, 2017 by Shayan816 Link to comment
Master_MTA Posted July 12, 2017 Share Posted July 12, 2017 13 minutes ago, Shayan816 said: hey i am making a vip panel, i created a window to set user VIP expiry date and time but its not working, it just shows VIP Expires in : Date - Time on window i set expiry date 1 week later.. and tried couple of times... but still its not showing time left.. just VIP Expires in : Date - Time on window client Hide contents VIPADANC.window[1] = guiCreateWindow(228, 188, 354, 172, "VIP - Admin Panel - Add New Code", false) centerWindow (VIPADANC.window[1]) guiWindowSetSizable(VIPADANC.window[1], false) guiSetVisible(VIPADANC.window[1], false) VIPADANC.label[1] = guiCreateLabel(10, 35, 98, 15, "Activation Code : ", false, VIPADANC.window[1]) guiSetFont(VIPADANC.label[1], "default-bold-small") guiLabelSetHorizontalAlign(VIPADANC.label[1], "center", false) VIPADANC.edit[1] = guiCreateEdit(108, 29, 197, 27, "", false, VIPADANC.window[1]) VIPADANC.button[1] = guiCreateButton(312, 29, 32, 26, "₪", false, VIPADANC.window[1]) VIPADANC.label[2] = guiCreateLabel(10, 70, 42, 16, "Date :", false, VIPADANC.window[1]) guiSetFont(VIPADANC.label[2], "default-bold-small") guiLabelSetHorizontalAlign(VIPADANC.label[2], "center", false) VIPADANC.edit[2] = guiCreateEdit(53, 66, 55, 20, "YYYY", false, VIPADANC.window[1]) guiEditSetMaxLength(VIPADANC.edit[2],4) VIPADANC.label[3] = guiCreateLabel(106, 65, 25, 21, "-", false, VIPADANC.window[1]) guiSetFont(VIPADANC.label[3], "default-bold-small") guiLabelSetHorizontalAlign(VIPADANC.label[3], "center", false) guiLabelSetVerticalAlign(VIPADANC.label[3], "center") VIPADANC.edit[3] = guiCreateEdit(131, 66, 41, 20, "MM", false, VIPADANC.window[1]) guiEditSetMaxLength(VIPADANC.edit[3],2) VIPADANC.label[4] = guiCreateLabel(172, 65, 25, 21, "-", false, VIPADANC.window[1]) guiSetFont(VIPADANC.label[4], "default-bold-small") guiLabelSetHorizontalAlign(VIPADANC.label[4], "center", false) guiLabelSetVerticalAlign(VIPADANC.label[4], "center") VIPADANC.edit[4] = guiCreateEdit(197, 66, 41, 20, "DD", false, VIPADANC.window[1]) guiEditSetMaxLength(VIPADANC.edit[4],2) VIPADANC.label[5] = guiCreateLabel(10, 96, 42, 16, "Time :", false, VIPADANC.window[1]) guiSetFont(VIPADANC.label[5], "default-bold-small") guiLabelSetHorizontalAlign(VIPADANC.label[5], "center", false) VIPADANC.edit[5] = guiCreateEdit(52, 92, 41, 20, "00", false, VIPADANC.window[1]) guiEditSetMaxLength(VIPADANC.edit[5],2) VIPADANC.label[6] = guiCreateLabel(91, 92, 25, 21, ":", false, VIPADANC.window[1]) guiSetFont(VIPADANC.label[6], "default-bold-small") guiLabelSetHorizontalAlign(VIPADANC.label[6], "center", false) guiLabelSetVerticalAlign(VIPADANC.label[6], "center") VIPADANC.edit[6] = guiCreateEdit(118, 92, 41, 20, "00", false, VIPADANC.window[1]) guiEditSetMaxLength(VIPADANC.edit[6],2) VIPADANC.label[7] = guiCreateLabel(157, 92, 25, 21, ":", false, VIPADANC.window[1]) guiSetFont(VIPADANC.label[7], "default-bold-small") guiLabelSetHorizontalAlign(VIPADANC.label[7], "center", false) guiLabelSetVerticalAlign(VIPADANC.label[7], "center") VIPADANC.edit[7] = guiCreateEdit(182, 92, 41, 20, "00", false, VIPADANC.window[1]) guiEditSetMaxLength(VIPADANC.edit[7],2) VIPADANC.button[2] = guiCreateButton(10, 122, 162, 38, "Create New", false, VIPADANC.window[1]) guiSetFont(VIPADANC.button[2], "default-bold-small") VIPADANC.button[4] = guiCreateButton(182, 122, 162, 38, "Cancel", false, VIPADANC.window[1]) guiSetFont(VIPADANC.button[4], "default-bold-small") addEventHandler("onClientGUIClick", root, function () if (source == VIPACTIVE.button[1]) then local ActiCode = guiGetText(VIPACTIVE.edit[1]) if #ActiCode == 0 then guiLabelSetColor(VIPACTIVE.label[12],255,0,0) guiSetText(VIPACTIVE.label[12],"Error : Please Write The Activation Code") else triggerServerEvent("ActiveVIP",localPlayer,localPlayer,ActiCode) end elseif (source == VIPADMIN.button[1]) then guiSetAlpha(VIPADMIN.window[1],0.5) guiBringToFront(VIPADANC.window[1]) guiSetVisible (VIPADANC.window[1], true) guiSetText(VIPADANC.edit[2],"YYYY") guiSetText(VIPADANC.edit[3],"MM") guiSetText(VIPADANC.edit[4],"DD") guiSetText(VIPADANC.edit[5],"00") guiSetText(VIPADANC.edit[6],"00") guiSetText(VIPADANC.edit[7],"00") elseif (source == VIPADANC.button[1]) then guiSetText(VIPADANC.edit[1],Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,26)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)] .."".. Generate[math.random(1,36)]) elseif (source == VIPADANC.edit[2]) then if guiGetText(VIPADANC.edit[2]) == "YYYY" then guiSetText(VIPADANC.edit[2],"") end elseif (source == VIPADANC.edit[3]) then if guiGetText(VIPADANC.edit[3]) == "MM" then guiSetText(VIPADANC.edit[3],"") end elseif (source == VIPADANC.edit[4]) then if guiGetText(VIPADANC.edit[4]) == "DD" then guiSetText(VIPADANC.edit[4],"") end elseif (source == VIPADANC.edit[5]) then if guiGetText(VIPADANC.edit[5]) == "00" then guiSetText(VIPADANC.edit[5],"") end elseif (source == VIPADANC.edit[6]) then if guiGetText(VIPADANC.edit[6]) == "00" then guiSetText(VIPADANC.edit[6],"") end elseif (source == VIPADANC.edit[7]) then if guiGetText(VIPADANC.edit[7]) == "00" then guiSetText(VIPADANC.edit[7],"") end elseif (source == VIPADANC.button[4]) then guiSetAlpha(VIPADMIN.window[1],0.8) guiSetVisible (VIPADANC.window[1], false) elseif (source == VIPADANC.button[2]) then local Code = guiGetText(VIPADANC.edit[1]) local year = guiGetText(VIPADANC.edit[2]) local month = guiGetText(VIPADANC.edit[3]) local day = guiGetText(VIPADANC.edit[4]) local hours = guiGetText(VIPADANC.edit[5]) local mintus = guiGetText(VIPADANC.edit[6]) local secound = guiGetText(VIPADANC.edit[7]) if year == "YYYY" then exports["guimessages"]:outputClient("#3399FF[VIP System] : #FF0000 Please write a 'Year' for the code !!",0,255,255) else if month == "MM" then exports["guimessages"]:outputClient("#3399FF[VIP System] : #FF0000 Please write a 'Month' for the code !!",0,255,255) else if day == "DD" then exports["guimessages"]:outputClient("[VIP System] : Please write a 'Day' for the code !!",0,255,255) else if hours == "00" then exports["guimessages"]:outputClient("[VIP System] : Please write a 'Hours' for the code !!",0,255,255) else if mintus == "00" then exports["guimessages"]:outputClient("[VIP System] : Please write a 'Minutes' for the code !!",0,255,255) else if secound == "00" then exports["guimessages"]:outputClient("[VIP System] : Please write a 'Seconds' for the code !!",0,255,255) else if Code == "" then exports["guimessages"]:outputClient("[VIP System] : Please write the activation code !!",0,255,255) else if tonumber(month) > 12 then exports["guimessages"]:outputClient("[VIP System] : The month must be less than 12 !!",0,255,255) else if tonumber(day) > 31 then exports["guimessages"]:outputClient("[VIP System] : The days must be less than 31 !!",0,255,255) else if tonumber(mintus) > 59 then exports["guimessages"]:outputClient("[VIP System] : The mintus must be less than 60 !!",0,255,255) else if tonumber(secound) > 59 then exports["guimessages"]:outputClient("[VIP System] : The secounds must be less than 60 !!",0,255,255) else if tonumber(hours) > 23 then exports["guimessages"]:outputClient("[VIP System] : The hours must be less than 24 !!",0,255,255) else triggerServerEvent("CreateCode",localPlayer,localPlayer,Code,year,month,day,hours,mintus,secound) guiSetAlpha(VipPanel.window[1],0.8) end end end end end end end end end end end end server Hide contents addEvent("CreateCode",true) addEventHandler("CreateCode",root, function (player,ActivationCode,Y,M,D,H,MI,S) if doesCodeExsit ( ActivationCode ) == false then local TheDate = Y .."-".. M .."-".. D local TheTime = H ..":".. MI ..":".. S local TimeToEnd = TheDate .."|".. TheTime addNewActivationCode ( ActivationCode, TimeToEnd ) outButDxChat( "#708090[VIP System] : #00ff00Done create new activation code !!",player,0, 255, 255 ) triggerClientEvent("HideCreateNewCodePanel",player,player) triggerEvent("RefreshTheAdminWindow",player,player) else outButDxChat( "#708090[VIP System] : #FF0000This activation code is already exist !!",player,0, 255, 255 ) end end ) setTimer( function() time = getRealTime() years = time.year month = time.month day = time.monthday TheDate = years+1900 .."-".. month .."-".. day for index, VIP in ipairs ( getActivationCodes() ) do local Date = gettok ( VIP [ "TimeToEnd" ], 1, string.byte('|') ) if Date == TheDate then if VIP [ "Status" ] == 'true' then setActivationCodeStatus ( VIP [ "ActivationCode" ], 'false' ) for i,player in ipairs (getElementsByType("player")) do if VIP [ "PlayerName" ] == getPlayerName(player) then setElementData(player,"VIP",false) outButDxChat("#708090[VIP System] : #FF0000 Your VIP is end !!",player,0,255,255) end end end end end end,60000,0 ) Any help ? it's so long codes so you should make it shorter for us to be able help u maybe u should show us the timer function only Link to comment
Shayan816 Posted July 12, 2017 Author Share Posted July 12, 2017 setTimer( function() time = getRealTime() years = time.year month = time.month day = time.monthday TheDate = years+1900 .."-".. month .."-".. day for index, VIP in ipairs ( getActivationCodes() ) do local Date = gettok ( VIP [ "TimeToEnd" ], 1, string.byte('|') ) if Date == TheDate then if VIP [ "Status" ] == 'true' then setActivationCodeStatus ( VIP [ "ActivationCode" ], 'false' ) for i,player in ipairs (getElementsByType("player")) do if VIP [ "PlayerName" ] == getPlayerName(player) then setElementData(player,"VIP",false) outButDxChat("#708090[VIP System] : #FF0000 Your VIP is end !!",player,0,255,255) end end end end end end,60000,0 ) Link to comment
Shayan816 Posted July 13, 2017 Author Share Posted July 13, 2017 where it gone wrong ?? client Spoiler info4 = guiCreateLabel(7, 398, 216, 23, "End Time : Date - Time", false, VipPanel.window[1]) guiSetFont(info4, "default-bold-small") function OpenPanel () if getElementData(localPlayer,"VIP") == true then if (guiGetVisible (VipPanel.window[1]) == true) then guiSetVisible (VipPanel.window[1], false) guiSetText( info4, "Time End VIP : ".. getElementData(localPlayer,"timetoend") ) guiSetAlpha(VipPanel.window[1],0.8) end server Spoiler addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS VIP (ActivationCode TEXT, AccountName TEXT, PlayerName TEXT, TimeToEnd TEXT, Status TEXT, Use TEXT)" ) for i,player in ipairs (getElementsByType("player")) do setElementData(player,"arCan",true) setElementData(player,"HeCan",true) local Account = getPlayerAccount(player) if not (isGuestAccount(Account)) then local AccountName = getAccountName(Account) if ( hasObjectPermissionTo ( player, "general.tab_resources", true ) ) then setElementData(player,"Admin",true) else setElementData(player,"Admin",false) end if isPlayerVIP ( AccountName ) == true then if isCodeEnable ( getAccountActivationCode(AccountName) ) == true then aclGroupAddObject(aclGetGroup("VIP"), "user."..getAccountName ( getPlayerAccount ( player ) )) setElementData(player,"VIP",true) local acc = getPlayerAccount(player) local accountn = getAccountName(acc) local timetoend = getActivationCodeTimeToEnd ( getAccountActivationCode ( accountn ) ) setElementData(player,"timetoend",timetoend) else setElementData(player,"VIP",false) end else setElementData(player,"VIP",false) end else setElementData(player,"VIP",false) end end end ) setTimer( function() time = getRealTime() years = time.year month = time.month day = time.monthday TheDate = years+1900 .."-".. month .."-".. day for index, VIP in ipairs ( getActivationCodes() ) do local Date = gettok ( VIP [ "TimeToEnd" ], 1, string.byte('|') ) if Date == TheDate then if VIP [ "Status" ] == 'true' then setActivationCodeStatus ( VIP [ "ActivationCode" ], 'false' ) for i,player in ipairs (getElementsByType("player")) do if VIP [ "PlayerName" ] == getPlayerName(player) then setElementData(player,"VIP",false) outButDxChat("#708090[VIP System] : #FF0000 Your VIP is end !!",player,0,255,255) end end end end end end,60000,0 ) any help please ? 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