Krujitoz Posted April 2, 2013 Posted April 2, 2013 (edited) [sOLUCIONADO] Buenas , mi pregunta es porque no funciona el script automáticamente al iniciar el scipt: -- Client function testc ( test ) for t = 1, #test do outputChatBox ( "[sERVER]: " .. test[t].n ) end end addEvent( "testc", true ) addEventHandler( "testc", getRootElement(), testc ) addEventHandler ( "onClientResourceStart", getRootElement(), function () triggerServerEvent ( "tests", getRootElement() ) end ) -- Server function tests () triggerClientEvent ( "testc", getRootElement(), { [1]={ n = 1 }, [2]={ n = 2 }, [3]={ n = 3 }, [4]={ n = 4 } } ) end addEvent( "tests", true ) addEventHandler( "tests", getRootElement(), tests ) Al iniciar el scipt con el "onResourceStart" obtengo los siguientes errores del /debugscript 3 [2013-04-01 22:17:23] ERROR: Server triggered clientside event test, but event is not added clientside [2013-04-01 22:17:23] ERROR: test\client.lua:2: attempt to get length of local 'table' (a userdata value) Sin embargo si utilizo el comando /tests muestra el resultado deseado (? [sERVER]: 1 [sERVER]: 2 [sERVER]: 3 [sERVER]: 4 En que estoy mal ? [sOLUCIONADO] Edited April 3, 2013 by Guest
Krujitoz Posted April 2, 2013 Author Posted April 2, 2013 emm y como podría cargar ambos al iniciar el script?
Castillo Posted April 2, 2013 Posted April 2, 2013 Lo que tenes que hacer es esto: Al iniciar el script client side ( onClientResourceStart ) ejecutas un evento server side asi: triggerServerEvent
Krujitoz Posted April 2, 2013 Author Posted April 2, 2013 No entendí, no es lo que yo ya estaba haciendo ._.
Castillo Posted April 2, 2013 Posted April 2, 2013 No, volve a leer lo que dije hasta que lo entiendas.
Krujitoz Posted April 3, 2013 Author Posted April 3, 2013 Quieres que use triggerClientEvent en Client side ._.
Castillo Posted April 3, 2013 Posted April 3, 2013 Ah, puse triggerClientEvent, queria decir triggerServerEvent.
Krujitoz Posted April 3, 2013 Author Posted April 3, 2013 Bueno ya lo solucione, gracias por tu ayuda Castillo, puedes cerrar el tema... PD: Regla #21...
Recommended Posts