verdao Posted April 19, 2014 Share Posted April 19, 2014 how do I get the player can use /vip every 30 minutes function vip() triggerServerEvent ( "ClientHaveLevel", getLocalPlayer() ) end addCommandHandler ("vip", vip) function armavip () showCursor (true) triggerServerEvent ( "onGreeting", getLocalPlayer() ) end function equipvip () showCursor (true) triggerServerEvent ( "onGreeting2", getLocalPlayer() ) end function vip2() painel = guiCreateWindow(450, 250, 448, 280, "Painel V.I.P", false) guiWindowSetSizable(painel, false) showCursor ( true ) guiSetAlpha(painel, 1.00) guiSetProperty(painel, "CaptionColour", "FF6AE419") arma = guiCreateButton(48, 144, 341, 38, "Pegar Armamento", false, painel) equip = guiCreateButton(48, 193, 341, 38, "Pegar Equipamento", false, painel) close = guiCreateButton(156, 250, 114, 37, "Fechar", false, painel) memo = guiCreateMemo(17, 30, 421, 104, "Bem Vindo Ao Painel VIP, Nao Abuse dos Seus Privilegios", false, painel) guiMemoSetReadOnly(memo, true) addEvent( "showvip",true ) addEventHandler ( "onClientGUIClick", arma, armavip, false ) addEventHandler ( "onClientGUIClick", equip, equipvip, false ) addEventHandler ( "onClientGUIClick", close, function() guiSetVisible(painel, false) showCursor(false) end, false ) end addEvent( "ShowVipPanel", true ) addEventHandler( "ShowVipPanel", getRootElement(), vip2) Link to comment
TrapLord Studios™ Posted April 19, 2014 Share Posted April 19, 2014 Try using setTimer Link to comment
Mr_Moose Posted April 19, 2014 Share Posted April 19, 2014 create a cooldown timer: cooldown = setTimer(function() end, 30*60, 1) and check if it exists by using: if not isTimer(cooldown) then -- Do something end if you plan to use this server side (multiple players), use a table: cooldown = { } -- Creates the table cooldown[thePlayer] = ... -- Assign a timer for a specific player (call this inside the function) if not isTimer(cooldown[thePlayer]) then --Check for a specific player -- Check if a cooldown timer for a specific player not exist and does something end Link to comment
Castillo Posted April 19, 2014 Share Posted April 19, 2014 Unless you want to execute something after determinate time, you should use getTickCount, which is way more efficient than timers. 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