Jump to content

getTime help


marty000123

Recommended Posts

Hello

function zombieChange()
    local timehour, timeminute = getTime()
    if timehour == 12 then
    outputChatBox( "works", player, 255, 0, 255 )
    end
end

It doesn't work. Help would be appreciated.

It basically needs to put out ''works'' when it's 12:00 ingame time. But I think that was already clear :P

 

Edited by marty000123
Link to comment

Is that client side or server side code?

If client side:

function zombieChange()
    local timehour, timeminute = getTime()
    if timehour == 12 then
    	outputChatBox( "works", 255, 0, 255 ) -- No need to add player here, as it a client script it will only show the output for the client it self.
    end
end

If server side:

function zombieChange(player) -- Add player argument here
    local timehour, timeminute = getTime()
    if timehour == 12 then
    	outputChatBox( "works", player, 255, 0, 255 ) -- Show the output only for the player who called the function.
    end
end

And also if its a server side code, where did you call it?

Link to comment

The only thing I see is that there's no event handler so it doesn't know when to execute the function. I'd advise you to make it client side and put onClientRender as the event handler. Then when the time comes it'll display the chatbox. If it still doesn't work I don't know as your code looks ok. 

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