Jump to content

Time script and ghostmode:ON/OFF table


Reflex#

Recommended Posts

----->meta.xml

    "ReFleX" type">type="script" name="Server Time" version="1.0" /> 
    

function showtime () 
    local time = getRealTime() 
    local hours = time.hour 
    local minutes = time.minute 
    outputChatBox ( "Local Time: "..hours..":"..minutes ) 
end 

I create this..but thing dont work..dont show in resource column,whats wrong?

And 2-nd question

How i can to create Ghostmode:On/off table in place what i want?

Link to comment
----->meta.xml
    "ReFleX" type">type">type="script" name="Server Time" version="1.0" /> 
    >type="server" /> 

function showtime () 
    local time = getRealTime() 
    local hours = time.hour 
    local minutes = time.minute 
    outputChatBox ( "Local Time: "..hours..":"..minutes ) 
end 

I create this..but thing dont work..dont show in resource column,whats wrong?

And 2-nd question

How i can to create Ghostmode:On/off table in place what i want?

You didnt write it you copied it from the wiki, and what exactly do you want to be done?

Link to comment
----->meta.xml
    "ReFleX" type">type">type">type="script" name="Server Time" version="1.0" /> 
    

function showtime () 
    local time = getRealTime() 
    local hours = time.hour 
    local minutes = time.minute 
    outputChatBox ( "Local Time: "..hours..":"..minutes ) 
end 

I create this..but thing dont work..dont show in resource column,whats wrong?

And 2-nd question

How i can to create Ghostmode:On/off table in place what i want?

You didnt write it you copied it from the wiki, and what exactly do you want to be done?

I want to create table in what will be write Server Time:[here time]

Link to comment
You can use the server side text functions to create a text server side:

https://wiki.multitheftauto.com/wiki/Ser ... _functions

function showTextDisplay ( player, command ) 
   local serverDisplay = textCreateDisplay()                              
   textDisplayAddObserver ( serverDisplay, player )                       
   local serverText = textCreateTextItem ( "Server Time:", 0.5, 0.5 )     
   textDisplayAddText ( serverDisplay, serverText )                       
end 
addCommandHandler( "showText", showTextDisplay ) 
  
function showtime () 
    local time = getRealTime() 
    local hours = time.hour 
    local minutes = time.minute 
end 

Something like this?

Link to comment
function showTextDisplay ( ) 
    local serverDisplay = textCreateDisplay ( ) 
    for index, player in ipairs ( getElementsByType ( "player" ) ) do 
        textDisplayAddObserver ( serverDisplay, player ) 
    end 
    serverText = textCreateTextItem ( "Server time:", 0.5, 0.5 )     
    textDisplayAddText ( serverDisplay, serverText ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, showTextDisplay ) 
  
function updateText ( ) 
    local realTime = getRealTime() 
    local hours = realTime.hour 
    local minutes = realTime.minute 
    local seconds = realTime.second 
    if ( serverText ) then 
        textItemSetText ( serverText, "Server time: ".. hours ..":".. minutes ..":".. seconds ) 
    end 
end 
setTimer ( updateText, 1000, 0 ) 

Link to comment
function showTextDisplay ( ) 
    local serverDisplay = textCreateDisplay ( ) 
    for index, player in ipairs ( getElementsByType ( "player" ) ) do 
        textDisplayAddObserver ( serverDisplay, player ) 
    end 
    serverText = textCreateTextItem ( "Server time:", 0.5, 0.5 )     
    textDisplayAddText ( serverDisplay, serverText ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, showTextDisplay ) 
  
function updateText ( ) 
    local realTime = getRealTime() 
    local hours = realTime.hour 
    local minutes = realTime.minute 
    local seconds = realTime.second 
    if ( serverText ) then 
        textItemSetText ( serverText, "Server time: ".. hours ..":".. minutes ..":".. seconds ) 
    end 
end 
setTimer ( updateText, 1000, 0 ) 

Oh thx man that work :)

How i can change font?

and place of this thing?now it in the center.I want it in upper right corner..

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