Jump to content

Help Script getRealTime


LucasBaker

Recommended Posts

Well I'm trying to create a script to do when someone asks Jarvis, what time is it answers But the time ta going as normal output help-me

local time = getRealTime() 
    local hours = time.hour 
    local minutes = time.minute 
local aTable2 = { 
    ['Jarvis, que horas são?'] = { "hours..":"..minutes" }, 
} 
  
addEventHandler('onPlayerChat',root, 
    function ( Massege ) 
        for v in pairs ( aTable2 ) do 
         if string.find ( Massege,v ) then 
            cancelEvent (  ) 
                outputChatBox ( 'Jarvis: São '..aTable2 [ v ] [ 1 ]..' ',root,r,g,b ) 
            end 
        end 
    end 
) 
  

Edited by Guest
Link to comment
local time = getRealTime( ); 
local hours = time.hour; 
local minutes = time.minute; 
  
local aTable2 =  
{ 
    [ 'Jarvis, what time is it?' ] = { hours.. ':' ..minutes }, 
} 
  
addEventHandler( 'onPlayerChat',root, 
    function ( Massege ) 
        for v in pairs ( aTable2 ) do 
            if string.find ( Massege,v ) then 
                cancelEvent (  ) 
                outputChatBox ( ' Jarvis: ' .. aTable2 [ v ] [ 1 ]..' ', root, r, g, b ) 
            end 
        end 
    end 
) 

Link to comment

Had already solved but still I have a doubt what I did wrong here?

local numPlayers = getPlayerCount() 
local maxPlayers = getMaxPlayers() 
local aTable3 = { 
    ['Jarvis, how many players are online?'] = { numPlayers .. "/" .. maxPlayers }, 
} 
  
addEventHandler('onPlayerChat',root, 
    function ( Massege ) 
        for v in pairs ( aTable ) do 
         if string.find ( Massege,v ) then 
            cancelEvent (  ) 
                outputChatBox ( 'Jarvis: The server possesses a total of '..aTable3 [ v ] [ 1 ]..' ',root,r,g,b ) 
            end 
        end 
    end 
) 

Edited by Guest
Link to comment
local aTable3 = { 
    ['Jarvis, how many players are online?'] = {numPlayers.."/"..maxPlayers}, 
} 

But you need to update the table.

still not working

local numPlayers = getPlayerCount() 
local maxPlayers = getMaxPlayers() 
local aTable3 = { 
    ['Jarvis, how many players are online?'] = {numPlayers.."/"..maxPlayers}, 
} 
  
addEventHandler('onPlayerChat',root, 
    function ( Massege2 ) 
        for v in pairs ( aTable3 ) do 
         if string.find ( Massege2,v ) then 
            cancelEvent (  ) 
                outputChatBox ( 'Jarvis: '..aTable3 [ v ] [ 1 ]..' ',root,r,g,b ) 
            end 
        end 
    end 
) 

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