Jump to content

Set Delay


Recommended Posts

I have a panel and i want to delay f player open the panel then he can open in 5 minutes again there is my codes

server file

function greeting2Handler () 
   setElementData(source, "M4A1 CCO", 1) 
   setElementData(source, "DMR", 1) 
   setElementData(source, "Hatchet", 1) 
   setElementData(source, "STANAG Mag", 100) 
   setElementData(source, "DMR Mag", 100) 
  
end 
addEvent( "Fegyverek", true ) 
addEventHandler( "Fegyverek", getRootElement(), greeting2Handler ) 
  
  
function PlayerHaveLevel( ) 
    local accName = getAccountName ( getPlayerAccount ( source ) ) 
    if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) ) then 
        triggerClientEvent(source, "ShowVipPanel", source ) 
    else 
        outputChatBox("Nem vagy V.I.P rangos!",source) 
    end 
end 
  
addEvent( "ClientHaveLevel", true ) 
addEventHandler( "ClientHaveLevel", getRootElement(), PlayerHaveLevel ) 
  
function Medicgombos () 
   setElementData(source, "Bandage", 1) 
   setElementData(source, "Morphine", 1) 
   setElementData(source, "Medic Kit", 1) 
   setElementData(source, "Painkiller", 1) 
   setElementData(source, "Heat Pack", 1) 
  
end 
addEvent( "Medic", true ) 
addEventHandler( "Medic", getRootElement(), Medicgombos ) 
  
function Kajas () 
   setElementData(source, "Water Bottle", 2) 
   setElementData(source, "Pasta Can", 2) 
   setElementData(source, "Beans Can", 2) 
   setElementData(source, "Milk", 2) 
   setElementData(source, "Soda Bottle", 2) 
  
end 
addEvent( "Kaja", true ) 
addEventHandler( "Kaja", getRootElement(), Kajas ) 
  
function toolbeltes () 
   setElementData(source, "Night Vision Goggles", 1) 
   setElementData(source, "Map", 1) 
   setElementData(source, "GPS", 1) 
   setElementData(source, "Toolbox", 1) 
   setElementData(source, "Watch", 1) 
  
end 
addEvent( "toolbelt", true ) 
addEventHandler( "toolbelt", getRootElement(), toolbeltes ) 
  
function Coyote () 
   setElementData(source, "MAX_Slots", 60) 
  
end 
addEvent( "CoyoteBackp", true ) 
addEventHandler( "CoyoteBackp", getRootElement(), Coyote ) 
  
function ACUU () 
   setElementData(source, "MAX_Slots", 16) 
  
end 
addEvent( "Survival_ACU", true ) 
addEventHandler( "Survival_ACU", getRootElement(), ACUU ) 
  
function vipveh () 
   setElementData(source, "Tire", 4) 
   setElementData(source, "Engine", 1) 
   setElementData(source, "Tank Parts", 1) 
  
end 
addEvent( "kocsiafaxfejeknek", true ) 
addEventHandler( "kocsiafaxfejeknek", getRootElement(), vipveh ) 
  

client

function vip() 
    triggerServerEvent ( "ClientHaveLevel", getLocalPlayer() ) 
end 
  
addCommandHandler ("vip", vip) 
  
function armavip () 
showCursor (true) 
triggerServerEvent ( "onGreeting", getLocalPlayer() ) 
  
end 
--Fegyók 
function equipvip () 
showCursor (true) 
triggerServerEvent ( "Fegyverek", getLocalPlayer() ) 
  
end 
  
function equipvipmedic () 
showCursor (true) 
triggerServerEvent ( "Medic", getLocalPlayer() ) 
  
end 
  
function equipvipkaja () 
showCursor (true) 
triggerServerEvent ( "Kaja", getLocalPlayer() ) 
  
end 
  
function equipviptoolbelt () 
showCursor (true) 
triggerServerEvent ( "toolbelt", getLocalPlayer() ) 
  
end 
  
function Coyote () 
showCursor (true) 
triggerServerEvent ( "CoyoteBackp", getLocalPlayer() ) 
  
end 
  
function equipviplegendary () 
showCursor (true) 
triggerServerEvent ( "Legendary", getLocalPlayer() ) 
  
end 
  
function equipvipacu () 
showCursor (true) 
triggerServerEvent ( "Survival_ACU", getLocalPlayer() ) 
  
end 
  
  
function vipveh () 
showCursor (true) 
triggerServerEvent ( "kocsiafaxfejeknek", getLocalPlayer() ) 
  
end 
  
  
function slotvip () 
showCursor (true) 
triggerServerEvent ( "onGreeting3", getLocalPlayer() ) 
  
end 
  
function vip2() 
   painel = guiCreateWindow(189, 81, 1106, 655, "V.I.P Panel!", false) 
    guiWindowSetSizable(painel, false) 
    showCursor ( true ) 
    guiSetAlpha(painel, 0.65) 
    guiSetProperty(painel, "CaptionColour", "FF6AE419") 
  
    equip = guiCreateButton(40, 72, 212, 29, "Weapon kit", false, painel) 
    fegyokep = guiCreateStaticImage(129, 26, 36, 36, "kepek/stuki.png", false, painel) 
    close = guiCreateButton(906, 47, 214, 37, "Close", false, painel) 
    kocsikep = guiCreateStaticImage(439, 398, 36, 36, "kepek/tire.png", false, painel) 
    kocsikgomb = guiCreateButton(353, 444, 212, 29, "Vehicle kit", false, painel) 
    survivalacgomb = guiCreateButton(353, 321, 212, 29, "Survival ACU", false, painel) 
    suvivalackep = guiCreateStaticImage(439, 275, 36, 36, "kepek/survivalacu.png", false, painel) 
    kocsigombok = guiCreateButton(796, 384, 130, 60, "Vehicles(Coming soon)", false, painel) 
    legendarygomb = guiCreateButton(353, 189, 212, 29, "Legendary Backpack(Coming soon)", false, painel) 
    legendarykep = guiCreateStaticImage(439, 143, 36, 36, "kepek/gunbag.png", false, painel) 
    coyote = guiCreateButton(353, 72, 212, 29, "Coyote Backpack", false, painel) 
    coyotekep = guiCreateStaticImage(439, 26, 36, 36, "kepek/Item_Backpack_Coyote.png", false, painel) 
    toolbeltgomb = guiCreateButton(40, 444, 212, 29, "Toolbelt items", false, painel) 
    toolbeltkep = guiCreateStaticImage(129, 398, 36, 36, "kepek/toolbelt.png", false, painel) 
    kajakep =  guiCreateStaticImage(129, 275, 36, 36, "kepek/can.png", false, painel) 
    kajagomb = guiCreateButton(40, 321, 212, 29, "Food&Drink pack", false, painel) 
    medickep = guiCreateStaticImage(129, 143, 36, 36, "kepek/medic.png", false, painel) 
    medicgomb = guiCreateButton(40, 189, 212, 29, "Medic kit", false, painel) 
    memo = guiCreateMemo(697, 99, 319, 100, "Köszönjük, hogy megvásároltad a VIP  Csomagot. ..Jó szórakozást a tételekkel... !", false, painel) 
    guiMemoSetReadOnly(memo, true) 
  
    addEvent( "showvip",true ) 
    addEventHandler ( "onClientGUIClick", arma, armavip, false ) 
    addEventHandler ( "onClientGUIClick", equip, equipvip, false ) 
    addEventHandler ( "onClientGUIClick", slot, slotvip, false ) 
    addEventHandler ( "onClientGUIClick", survivalacgomb, equipvipacu, false ) 
    addEventHandler ( "onClientGUIClick", kocsikgomb, vipveh, false ) 
    addEventHandler ( "onClientGUIClick", legendarygomb, equipviplegendary, false ) 
    addEventHandler ( "onClientGUIClick", coyote, Coyote, false ) 
    addEventHandler ( "onClientGUIClick", toolbeltgomb, equipviptoolbelt, false ) 
    addEventHandler ( "onClientGUIClick", kajagomb, equipvipkaja, false ) 
    addEventHandler ( "onClientGUIClick", medicgomb, equipvipmedic, false ) 
    addEventHandler ( "onClientGUIClick", close,  
     
    function() 
        guiSetVisible(painel, false) 
        showCursor(false) 
    end, false ) 
end 
  
addEvent( "ShowVipPanel", true ) 
addEventHandler( "ShowVipPanel", getRootElement(), vip2) 
  

Link to comment

Use getTickCount whenever the player opens the panel and store it. Then just compare that with the current tick.

function openPanel() 
 if (open_tick and getTickCount() - open_tick > 300000) then 
  open_tick = getTickCount() 
  -- code 
 end 
end 

Link to comment

Like this :

function openPanel() 
 if (open_tick and getTickCount() - open_tick > 300000) then 
  open_tick = getTickCount() 
  
function vip() 
    triggerServerEvent ( "ClientHaveLevel", getLocalPlayer() ) 
end 
  
addCommandHandler ("vip", vip) 
  
function armavip () 
showCursor (true) 
triggerServerEvent ( "onGreeting", getLocalPlayer() ) 
  
end 
--Fegyók 
function equipvip () 
showCursor (true) 
triggerServerEvent ( "Fegyverek", getLocalPlayer() ) 
  
end 
  
function equipvipmedic () 
showCursor (true) 
triggerServerEvent ( "Medic", getLocalPlayer() ) 
  
end 
  
function equipvipkaja () 
showCursor (true) 
triggerServerEvent ( "Kaja", getLocalPlayer() ) 
  
end 
  
function equipviptoolbelt () 
showCursor (true) 
triggerServerEvent ( "toolbelt", getLocalPlayer() ) 
  
end 
  
function Coyote () 
showCursor (true) 
triggerServerEvent ( "CoyoteBackp", getLocalPlayer() ) 
  
end 
  
function equipviplegendary () 
showCursor (true) 
triggerServerEvent ( "Legendary", getLocalPlayer() ) 
  
end 
  
function equipvipacu () 
showCursor (true) 
triggerServerEvent ( "Survival_ACU", getLocalPlayer() ) 
  
end 
  
  
function vipveh () 
showCursor (true) 
triggerServerEvent ( "kocsiafaxfejeknek", getLocalPlayer() ) 
  
end 
  
  
function slotvip () 
showCursor (true) 
triggerServerEvent ( "onGreeting3", getLocalPlayer() ) 
  
end 
  
function vip2() 
   painel = guiCreateWindow(189, 81, 1106, 655, "V.I.P Panel!", false) 
    guiWindowSetSizable(painel, false) 
    showCursor ( true ) 
    guiSetAlpha(painel, 0.65) 
    guiSetProperty(painel, "CaptionColour", "FF6AE419") 
  
    equip = guiCreateButton(40, 72, 212, 29, "Weapon kit", false, painel) 
    fegyokep = guiCreateStaticImage(129, 26, 36, 36, "kepek/stuki.png", false, painel) 
    close = guiCreateButton(906, 47, 214, 37, "Close", false, painel) 
    kocsikep = guiCreateStaticImage(439, 398, 36, 36, "kepek/tire.png", false, painel) 
    kocsikgomb = guiCreateButton(353, 444, 212, 29, "Vehicle kit", false, painel) 
    survivalacgomb = guiCreateButton(353, 321, 212, 29, "Survival ACU", false, painel) 
    suvivalackep = guiCreateStaticImage(439, 275, 36, 36, "kepek/survivalacu.png", false, painel) 
    kocsigombok = guiCreateButton(796, 384, 130, 60, "Vehicles(Coming soon)", false, painel) 
    legendarygomb = guiCreateButton(353, 189, 212, 29, "Legendary Backpack(Coming soon)", false, painel) 
    legendarykep = guiCreateStaticImage(439, 143, 36, 36, "kepek/gunbag.png", false, painel) 
    coyote = guiCreateButton(353, 72, 212, 29, "Coyote Backpack", false, painel) 
    coyotekep = guiCreateStaticImage(439, 26, 36, 36, "kepek/Item_Backpack_Coyote.png", false, painel) 
    toolbeltgomb = guiCreateButton(40, 444, 212, 29, "Toolbelt items", false, painel) 
    toolbeltkep = guiCreateStaticImage(129, 398, 36, 36, "kepek/toolbelt.png", false, painel) 
    kajakep =  guiCreateStaticImage(129, 275, 36, 36, "kepek/can.png", false, painel) 
    kajagomb = guiCreateButton(40, 321, 212, 29, "Food&Drink pack", false, painel) 
    medickep = guiCreateStaticImage(129, 143, 36, 36, "kepek/medic.png", false, painel) 
    medicgomb = guiCreateButton(40, 189, 212, 29, "Medic kit", false, painel) 
    memo = guiCreateMemo(697, 99, 319, 100, "Köszönjük, hogy megvásároltad a VIP  Csomagot. ..Jó szórakozást a tételekkel... !", false, painel) 
    guiMemoSetReadOnly(memo, true) 
  
    addEvent( "showvip",true ) 
    addEventHandler ( "onClientGUIClick", arma, armavip, false ) 
    addEventHandler ( "onClientGUIClick", equip, equipvip, false ) 
    addEventHandler ( "onClientGUIClick", slot, slotvip, false ) 
    addEventHandler ( "onClientGUIClick", survivalacgomb, equipvipacu, false ) 
    addEventHandler ( "onClientGUIClick", kocsikgomb, vipveh, false ) 
    addEventHandler ( "onClientGUIClick", legendarygomb, equipviplegendary, false ) 
    addEventHandler ( "onClientGUIClick", coyote, Coyote, false ) 
    addEventHandler ( "onClientGUIClick", toolbeltgomb, equipviptoolbelt, false ) 
    addEventHandler ( "onClientGUIClick", kajagomb, equipvipkaja, false ) 
    addEventHandler ( "onClientGUIClick", medicgomb, equipvipmedic, false ) 
    addEventHandler ( "onClientGUIClick", close, 
    
    function() 
        guiSetVisible(painel, false) 
        showCursor(false) 
    end, false ) 
end 
  
addEvent( "ShowVipPanel", true ) 
addEventHandler( "ShowVipPanel", getRootElement(), vip2) 

Link to comment
function vip() 
    triggerServerEvent ( "ClientHaveLevel", getLocalPlayer() ) 
end 
  
addCommandHandler ("vip", vip) 
  
function armavip () 
showCursor (true) 
triggerServerEvent ( "onGreeting", getLocalPlayer() ) 
  
end 
--Fegyók 
function equipvip () 
showCursor (true) 
triggerServerEvent ( "Fegyverek", getLocalPlayer() ) 
  
end 
  
function equipvipmedic () 
showCursor (true) 
triggerServerEvent ( "Medic", getLocalPlayer() ) 
  
end 
  
function equipvipkaja () 
showCursor (true) 
triggerServerEvent ( "Kaja", getLocalPlayer() ) 
  
end 
  
function equipviptoolbelt () 
showCursor (true) 
triggerServerEvent ( "toolbelt", getLocalPlayer() ) 
  
end 
  
function Coyote () 
showCursor (true) 
triggerServerEvent ( "CoyoteBackp", getLocalPlayer() ) 
  
end 
  
function equipviplegendary () 
showCursor (true) 
triggerServerEvent ( "Legendary", getLocalPlayer() ) 
  
end 
  
function equipvipacu () 
showCursor (true) 
triggerServerEvent ( "Survival_ACU", getLocalPlayer() ) 
  
end 
  
  
function vipveh () 
showCursor (true) 
triggerServerEvent ( "kocsiafaxfejeknek", getLocalPlayer() ) 
  
end 
  
  
function slotvip () 
showCursor (true) 
triggerServerEvent ( "onGreeting3", getLocalPlayer() ) 
  
end 
  
local openTick 
  
function vip2() 
  
    if openTick and openTick + 300000 > getTickCount() then 
        return 
    elseif not openTick then  
        openTick = getTickCount() 
    end 
  
    painel = guiCreateWindow(189, 81, 1106, 655, "V.I.P Panel!", false) 
    guiWindowSetSizable(painel, false) 
    showCursor ( true ) 
    guiSetAlpha(painel, 0.65) 
    guiSetProperty(painel, "CaptionColour", "FF6AE419") 
  
    equip = guiCreateButton(40, 72, 212, 29, "Weapon kit", false, painel) 
    fegyokep = guiCreateStaticImage(129, 26, 36, 36, "kepek/stuki.png", false, painel) 
    close = guiCreateButton(906, 47, 214, 37, "Close", false, painel) 
    kocsikep = guiCreateStaticImage(439, 398, 36, 36, "kepek/tire.png", false, painel) 
    kocsikgomb = guiCreateButton(353, 444, 212, 29, "Vehicle kit", false, painel) 
    survivalacgomb = guiCreateButton(353, 321, 212, 29, "Survival ACU", false, painel) 
    suvivalackep = guiCreateStaticImage(439, 275, 36, 36, "kepek/survivalacu.png", false, painel) 
    kocsigombok = guiCreateButton(796, 384, 130, 60, "Vehicles(Coming soon)", false, painel) 
    legendarygomb = guiCreateButton(353, 189, 212, 29, "Legendary Backpack(Coming soon)", false, painel) 
    legendarykep = guiCreateStaticImage(439, 143, 36, 36, "kepek/gunbag.png", false, painel) 
    coyote = guiCreateButton(353, 72, 212, 29, "Coyote Backpack", false, painel) 
    coyotekep = guiCreateStaticImage(439, 26, 36, 36, "kepek/Item_Backpack_Coyote.png", false, painel) 
    toolbeltgomb = guiCreateButton(40, 444, 212, 29, "Toolbelt items", false, painel) 
    toolbeltkep = guiCreateStaticImage(129, 398, 36, 36, "kepek/toolbelt.png", false, painel) 
    kajakep =  guiCreateStaticImage(129, 275, 36, 36, "kepek/can.png", false, painel) 
    kajagomb = guiCreateButton(40, 321, 212, 29, "Food&Drink pack", false, painel) 
    medickep = guiCreateStaticImage(129, 143, 36, 36, "kepek/medic.png", false, painel) 
    medicgomb = guiCreateButton(40, 189, 212, 29, "Medic kit", false, painel) 
    memo = guiCreateMemo(697, 99, 319, 100, "Köszönjük, hogy megvásároltad a VIP  Csomagot. ..Jó szórakozást a tételekkel... !", false, painel) 
    guiMemoSetReadOnly(memo, true) 
  
    addEvent( "showvip",true ) 
    addEventHandler ( "onClientGUIClick", arma, armavip, false ) 
    addEventHandler ( "onClientGUIClick", equip, equipvip, false ) 
    addEventHandler ( "onClientGUIClick", slot, slotvip, false ) 
    addEventHandler ( "onClientGUIClick", survivalacgomb, equipvipacu, false ) 
    addEventHandler ( "onClientGUIClick", kocsikgomb, vipveh, false ) 
    addEventHandler ( "onClientGUIClick", legendarygomb, equipviplegendary, false ) 
    addEventHandler ( "onClientGUIClick", coyote, Coyote, false ) 
    addEventHandler ( "onClientGUIClick", toolbeltgomb, equipviptoolbelt, false ) 
    addEventHandler ( "onClientGUIClick", kajagomb, equipvipkaja, false ) 
    addEventHandler ( "onClientGUIClick", medicgomb, equipvipmedic, false ) 
    addEventHandler ( "onClientGUIClick", close, 
    
    function() 
        guiSetVisible(painel, false) 
        showCursor(false) 
    end, false ) 
end 
  
addEvent( "ShowVipPanel", true ) 
addEventHandler( "ShowVipPanel", getRootElement(), vip2) 
  

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...