Jump to content

Question about Timers


Chopper

Recommended Posts

okay, so im having a small problem with timers, i have a function, lets just say, for example, i have a function which outputs something to the chat. Now i want to make that function, execute, every 30 minutes, for example. How can i do that?

My other question is about GUI. how can i do that, for example, i have a command. and an arguement, that is a player name. so for example, my command is /h Josh. I want a gui window, to open for the player with the name "Josh", when i enter the command.

Thanks for the help.

Link to comment

you can use "setTimer" and set loop at 0 after setting time after that specific time it get triggger

Example : setTimer ( function()

outputChatBox ( "text!" )

end, 5000, 0 )

this text come after each 5 sec just change it acc to your time.

2nd

you can use this i think

function getPlayerFromlName(thePlayerName)

local thePlayer = getPlayerFromName(thePlayerName)

if thePlayer then

return thePlayer

end

for _,thePlayer in ipairs(getElementsByType("player")) do

if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then

return thePlayer

end

end

return false

end

function showGUI(sourcePlayer, commandName, thePlayerName)

if ( hasObjectPermissionTo (sourcePlayer, "command.ban", true ) ) then

if (thePlayerName) then

targetPlayer = getPlayerFromParticalName(tostring(thePlayerName))

triggerClientEvent(targetPlayer, "eventName", rootElement)

else

outputChatBox("Error", sourcePlayer, 255,255,255,true)

end

end

end

hope it will work i didnt tested

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