Other Languages Moderators Lord Henry Posted November 10, 2016 Other Languages Moderators Share Posted November 10, 2016 I can't find an error in this script, what's wrong here? The message says that the event is not added serverside... coreh_client.lua local tableToSendVip = { [1] = guiGetText( hc_edith['edith_ec_X'] ), [4] = guiGetText( hc_edith['edith_etc_X'] ), [2] = guiGetText( hc_edith['edith_ec_Y'] ), [5] = guiGetText( hc_edith['edith_etc_Y'] ), [3] = guiGetText( hc_edith['edith_ec_Z'] ), [6] = guiGetText( hc_edith['edith_etc_Z'] ), [7] = guiGetText( hc_edith['edith_exc_X'] ), [10] = guiGetText( hc_edith['edith_extc_X'] ), [8] = guiGetText( hc_edith['edith_exc_Y'] ), [11] = guiGetText( hc_edith['edith_extc_Y'] ), [9] = guiGetText( hc_edith['edith_exc_Z'] ), [12] = guiGetText( hc_edith['edith_extc_Z'] ), [13] = guiGetText( hc_guih['edith_intID'] ), [14] = guiGetText( hc_guih['edith_dim'] ), [15] = guiGetText( hc_guih['edith_cost'] ) }; for i, v in ipairs( tableToSendVip ) do tableToSendVip[ i ] = tonumber( tableToSendVip[ i ] ); end; triggerServerEvent( 'onPlayerAttemptCreateHouseVip', me, tableToSendVip ); triggerEvent( 'HPV_SetVisible', me, false ); end, false ); coreh_server.lua 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 ); Any ideas? Link to comment
LoPollo Posted November 10, 2016 Share Posted November 10, 2016 in the client it's triggered onPlayerAttemptCreateHouseVip while in the server the event is called onPlayerAttemptcreateHouseVip It seems like it's case sensitive: Create ~= create Let us know if it was the problem, editing the "c" solved the problem in a compact copy of you script i used to test 1 Link to comment
Other Languages Moderators Lord Henry Posted November 10, 2016 Author Other Languages Moderators Share Posted November 10, 2016 1 hour ago, LoPollo said: in the client it's triggered onPlayerAttemptCreateHouseVip while in the server the event is called onPlayerAttemptcreateHouseVip It seems like it's case sensitive: Create ~= create Let us know if it was the problem, editing the "c" solved the problem in a compact copy of you script i used to test 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 ); Link to comment
LoPollo Posted November 10, 2016 Share Posted November 10, 2016 I never used db, so do not expect too much from me about this argument. However i only found executeSQLQuery, which is different from "executesqlQuery" (first line). Still if it does not throw an error when it's called at line 4 i don't think this is an issue 1 Link to comment
Other Languages Moderators Lord Henry Posted November 10, 2016 Author Other Languages Moderators Share Posted November 10, 2016 13 minutes ago, LoPollo said: I never used db, so do not expect too much from me about this argument. However i only found executeSQLQuery, which is different from "executesqlQuery" (first line). Still if it does not throw an error when it's called at line 4 i don't think this is an issue OMG! Awesome! Thanks a lot! It's working fine now 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