I think it solved the problem, but now appears another problem:
ERROR: [admin]\sistema-home\coreh_server.lua:56: attempt to call field 'Query' (a nil value)
coreh_server.lua:
local sqly = { Query = executesqlQuery };
addEventHandler( 'onResourceStart', resourceRoot, function()
sqly.Query( "CREATE TABLE IF NOT EXISTS house_data (\
ID INTEGER, en_X REAL, en_Y REAL, en_Z REAL,\
en_tX REAL, en_tY REAL, en_tZ REAL,\
ex_X REAL, ex_Y REAL, ex_Z REAL,\
ex_tX REAL, ex_tY REAL, ex_tZ REAL,\
int INTEGER, dim INTEGER, cost INTEGER, owner TEXT, key TEXT )"
);
for i, v in ipairs( getElementsByType( 'player' ) ) do
setElementData( v, 'k_len', tonumber( get( 'keyLength' ) ) );
local acc = getPlayerAccount( v );
if not isGuestAccount( acc ) then
setElementData( v, 'HSV_accountName', getAccountName( acc ) );
end;
setElementData( v, 'mrk_in', nil );
end;
local hr = sqly.Query( "SELECT * FROM house_data" );
for i = 1, #hr do
createHouseVip( false, hr[i].ID, hr[i].owner, hr[i].key, hr[i].en_X, hr[i].en_Y, hr[i].en_Z, hr[i].en_tX, hr[i].en_tY, hr[i].en_tZ, hr[i].ex_X, hr[i].ex_Y, hr[i].ex_Z, hr[i].ex_tX, hr[i].ex_tY, hr[i].ex_tZ, hr[i].int, hr[i].dim, hr[i].cost );
end;
end );
addEventHandler( 'onResourceStop', resourceRoot, function()
for i, v in ipairs( getElementsByType( 'player' ) ) do
setElementData( v, 'k_len', nil );
setElementData( v, 'HSV_accountName', nil );
end;
end );
addEventHandler( 'onPlayerJoin', root, function()
setElementData( source, 'k_len', tonumber( get( 'keyLength' ) ) );
end );
addEventHandler( 'onPlayerLogin', root, function( _, acc )
setElementData( source, 'HSV_accountName', getAccountName( acc ) );
end );
addEventHandler( 'onPlayerLoout', root, function( _, acc )
setElementData( source, 'HSV_accountName', nil );
end );
addCommandHandler( 'home', function( player )
if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( 'Console' ) ) or hasObjectPermissionTo( player, 'function.banPlayer', false ) then
if not getElementData( player, 'HPV_Opened' ) and not getElementData( player, 'mrk_in' ) then
triggerClientEvent( player, 'HPV_SetVisible', root, true );
end;
else
outputChatBox( 'Acesso negado para este comando!', player, 255, 36, 51 );
end;
end );
addEvent( 'onPlayerAttemptCreateHouseVip', true );
addEventHandler( 'onPlayerAttemptCreateHouseVip', root, function( rt )
createHouseVip( true, #sqly.Query( "SELECT * FROM house_data" ) + 1, '', '', unpack( rt ) );
outputChatBox( 'A casa VIP foi criada com sucesso!', client, 255, 255, 0 );
end );