LucasBaker Posted November 22, 2013 Share Posted November 22, 2013 (edited) 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 November 22, 2013 by Guest Link to comment
Blaawee Posted November 22, 2013 Share Posted November 22, 2013 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
LucasBaker Posted November 22, 2013 Author Share Posted November 22, 2013 (edited) 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 November 22, 2013 by Guest Link to comment
TAPL Posted November 22, 2013 Share Posted November 22, 2013 local aTable3 = { ['Jarvis, how many players are online?'] = {numPlayers.."/"..maxPlayers}, } But you need to update the table. Link to comment
LucasBaker Posted November 22, 2013 Author Share Posted November 22, 2013 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
Castillo Posted November 22, 2013 Share Posted November 22, 2013 You ain't updating the table, so the player count will be always the same as when the resource started. Link to comment
LucasBaker Posted November 22, 2013 Author Share Posted November 22, 2013 You ain't updating the table, so the player count will be always the same as when the resource started. works thanks 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