Jump to content

Lormateve

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by Lormateve

  1. Thank you for your collaboration! I was able to solve it with: @Simple. if source == localPlayer then
  2. The function is activated twice, that is, when I go in my vehicle with a person sitting as a companion, when you get to the marker, you activate all the functions when you step on it, even though you do not see the marker or everything the function includes, Does anyone know how to solve it? --Client Side - Example addEventHandler("onClientGUIClick", guiRoot, function() addEventHandler( "onClientMarkerHit", Marker, First ) Bla bla bla end ) function First () if timer then killTimer(timer) timer = nil end veh = getPedOccupiedVehicle( localPlayer ) if veh then setElementFrozen ( veh, true ) Outputchatbox ("Example") --This is printed twice when there is a passenger in the vehicle setTimer (PreFuncParada, 1500, 1, pia) end end
  3. Gracias por la colaboración, lo solucionamos con SOURCE en vez de cliente, y la RamaGral como variable solo del cliente que lo activó, saludos.
  4. From what I could see, it's working perfectly, thank you very much I ended up using the source instead of the client, thanks to everyone!
  5. It's absolutely right, but it's not what I really need, what I wonder is how to make the condition only direct the player who started the trigger? That is to say that PasajENP = PasajENP_a1 is changed only to a player, do you understand?
  6. My question is how to send a data to the server in a personal way with the client, that is, without including all the clients. Client side function AAB (pia) triggerServerEvent ("KnowAmount", getLocalPlayer(), pia ) end --====================================================================== Server Side function KnowAmountFunction (pia) outputChatBox ("AA") -- This show ALL Client, and that's what I want to avoid if (pia == 1) then PasajENP = PasajENP_a1 -- This change for all players, and it should not be like that triggerClientEvent (client, "GotoClient", resourceRoot, PasajENP ) end end addEvent( "KnowAmount", true ) addEventHandler( "KnowAmount", getRootElement(), KnowAmountFunction )
  7. Sigue reproduciendo en el servidor a todos @-Rex- client side function EnPuntoAzul() pia = 2 triggerServerEvent ( "SaberRamaTrigger", getLocalPlayer() , pia ) --Aca lo dirijo al servidor para saber que valor de Rama tiene end function RamaFunc(RamaGral) outputChatBox (RamaGral) if (RamaGral == 0) and (Chuche > 0) then A1 = createMarker(1398.7294921875, 2585.896484375, 10.351558685303-1,"cylinder",2,255,255,0)--P2 else A2 = createMarker(1397.7236328125, 2589.505859375, 10.352198600769-1,"cylinder",2,255,255,0) end end addEvent( "RamaEs1", true ) addEventHandler( "RamaEs1", resourceRoot, RamaFunc ) server side function SaberRama (pia) if (pia == 1) and (Rama1 == 0) then Rama = 1 RamaGral = 0 triggerClientEvent ( "RamaEs1", getRootElement(), RamaGral) end end addEvent( "SaberRamaTrigger", true ) addEventHandler( "SaberRamaTrigger", root, SaberRama ) --aca quizás??? el root influirá?
  8. Esto me funciono perfecto, es una gran parte de lo que necesitaba, es decir que el trigger hacia "cliente" solo se la da a la persona que accionó el trigger, gracias!
  9. Sigue sin funcionar, debería declarar que es client¿? Es decir, mediante ese trigger, no llega al servidor, queda en cliente.
  10. Hola! Gracias por tomarse el tiempo de leer este post. Gracias a este lugar y sus recomendaciones aprendí a manejarme en la wiki, pero hay algo que me tiene loco, y a menudo me da demasiados problemas. El problema es que en el proyecto que estoy trabajando, utilizo mucho movimientos de datos de cliente a servidor y viceversa. El problema está cuando por ejemplo, desde cliente uso un trigger para preguntar en el servidor el valor de una variable, y al volver les devuelve el valor de esa variable A TODOS LOS USUARIOS, al igual que los Outputchatbox. ¿Como hago para que, le devuelva el valor que quiero averiguar en servidor, SOLAMENTE al usuario que utilizó el trigger? --Codigo de Ida Cliente > Servidor function EnPuntoAzul() pia = 2 triggerServerEvent ( "SaberRamaTrigger", resourceRoot, pia ) --Aca lo dirijo al servidor para saber que valor de Rama tiene end function RamaFunc(RamaGral) outputChatBox (RamaGral) if (RamaGral == 0) and (Chuche > 0) then A1 = createMarker(1398.7294921875, 2585.896484375, 10.351558685303-1,"cylinder",2,255,255,0)--P2 else A2 = createMarker(1397.7236328125, 2589.505859375, 10.352198600769-1,"cylinder",2,255,255,0) end end addEvent( "RamaEs1", true ) addEventHandler( "RamaEs1", resourceRoot, RamaFunc ) -- ===================================================================== --Codigo de vuelta Servidor > Cliente function SaberRama (pia) if (pia == 1) and (Rama1 == 0) then Rama = 1 RamaGral = 0 triggerClientEvent ( "RamaEs1", getRootElement(), RamaGral) end end addEvent( "SaberRamaTrigger", true ) addEventHandler( "SaberRamaTriggerServer", resourceRoot, SaberRama )
  11. Buenas!, les cuento que estoy teniendo un problema y no se cómo buscarlo en la wiki, y por eso recurro al foro. Lo que quiero hacer es varias paradas de recolección, y a partir de 30 segundos se le va a sumar 1 a cada parada de recolección. Estas paradas son de servidor para todos, y la idea es que cuando un jugador recolecta, se resta lo q habia sumado, para TODOS. Es decir el problema está que cuando al hacer un vector de parada X, se pone en Parada[X] ¿y ahí carga el dato, o no? Parada1 = 0 Parada2 = 0 Parada3 = 0 Parada4 = 0 function AgregarPasajeros() if (Parada1 < 8) then Parada1 = Parada1+1 if (Parada2 < 8) then Parada2 = Parada2+1 if (Parada3 < 8) then Parada3 = Parada3+1 if (Parada4 < 8) then Parada4 = Parada4+1 end end end end end addEventHandler("onResourceStart", getRootElement(AgregarPasajeros)) Timer = setTimer(AgregarPasajeros, 9000, 0) function FuncParada_58_A (DispPasajeros, pia) outputChatBox ("Se activa FUNC PARADA PRUEBA") outputChatBox ("La parada es:") outputChatBox (pia) if (Parada[pia] > 0) and (DispPasajeros > 0) then --Esto ¿? La "Parada[PIA]" con el pia que viene de cliente, está bien? outputChatBox ("Se cumple primera condicion") PasajSuben = 0 DispPasajeros = DispPasajeros -1 Parada[pia] = Parada[pia] -1 PasajSuben = PasajSuben +1 pia_server = pia setTimer ( SegundoPaso, 2000, 1, PasajSuben, pia_server) else if (Parada[pia] <= 0) or (DispPasajeros <= 0) then outputChatBox ("Se cumple segunda condicion") PasajSuben = 0 setTimer ( SegundoPaso, 1000, 1, PasajSuben, pia_server) else outputChatBox ("Algo falla") end end end addEvent( "HaciaServidor", true ) addEventHandler( "HaciaServidor", root, FuncParada_58_A )
  12. Yes, I could make it work with a trigger, since the settimer was out of the question, I ignored it, now with the trigger from client, everything works correctly, without using the setElementAttachedOffsets, thank you very much for the collaboration, I am very grateful!
  13. It's still happening exactly the same, it occurred to me to return with a trigger from client to server, instead of using a timer from server to server. I try it and I tell you. function SubenPasajeros (client) if CantidadDeAsientos >= 0 then if Asiento[1] == 0 then Asiento[1] = 1 local vehicle = getPedOccupiedVehicle( client ) local player = client if ( vehicle ) then local pos = {getElementPosition( vehicle )} Asiento1T = createObject( 2035, pos[1], pos[2], pos[3] ) attachElements( Asiento1T, vehicle, 0, 0, 0, 0, 0, 0 ) setElementAttachedOffsets (Asiento1T,pos[1],pos[2],pos[3],0,0,0) outputChatBox ("Asiento1")
  14. it still does not "teleport" the object. Thanks for the simplification, but it does not solve it.
  15. Good point, but anyway changing the name of the variables, still does not work Asiento1=0; Asiento2=0; Asiento3=0; Asiento4=0; Asiento5=0; Asiento6=0; Asiento7=0; Asiento8=0; Asiento9=0; Asiento10=0; Asiento11=0; Asiento12=0; Asiento13=0; Asiento14=0; Asiento15=0; Asiento16=0; Asiento17=0; Asiento18=0; Asiento19=0; Asiento20=0; Asiento21=0 function SubenPasajeros (client) if CantidadDeAsientos >= 0 then if Asiento1 == 0 then Asiento1 = 1 local vehicle = getPedOccupiedVehicle( client ) local x1,y1,z1 = getElementPosition(client ) Asiento1T = createObject (2035, 1423.2880859375, 2602.650390625, 10.8203125) -- add "T" setElementPosition ( Asiento1T, x1,y1,z1) attachElements( Asiento1T, vehicle, 0.95, 0.6, 0, 0, 0, 0 ) --Fila 1 A outputChatBox ("Asiento1") else if Asiento2 == 0 then Asiento2 = 1 outputChatBox ("Asiento2") local vehicle = getPedOccupiedVehicle( client ) x1, y1, z1 = getElementPosition ( client ) Asiento2T = createObject (2035, 1421.958984375, 2624.4677734375, 11.392612457275) setElementPosition ( Asiento2T, x1, y1, z1) attachElements( Asiento2T, vehicle, 0.5, -0.2, 0, 0, 0, 0 ) --Fila 2 B function greetingCommand ( playerSource, commandName ) local x1,y1,z1 = getElementPosition(client ) setTimer ( SubenPasajeros, 500, 1, client) triggerClientEvent ( "onGreetingb", getRootElement(), PasajSuben ) end
  16. asd function SubenPasajeros (client) if CantidadDeAsientos >= 0 then if Asiento1 == 0 then Asiento1 = 1 local vehicle = getPedOccupiedVehicle( client ) local x1,y1,z1 = getElementPosition( client ) Asiento1 = createObject (2035, 1423.2880859375, 2602.650390625, 10.8203125) setElementPosition ( Asiento1, x1,y1,z1) attachElements( Asiento1, vehicle, 0.95, 0.6, 0, 0, 0, 0 ) --Fila 1 A outputChatBox ("Asiento1") else if Asiento2 == 0 then Asiento2 = 1 outputChatBox ("Asiento2") local vehicle = getPedOccupiedVehicle( client ) x1, y1, z1 = getElementPosition ( client ) Asiento2 = createObject (2035, 1421.958984375, 2624.4677734375, 11.392612457275) setElementPosition ( Asiento2, x1, y1, z1) attachElements( Asiento2, vehicle, 0.5, -0.2, 0, 0, 0, 0 ) From another function, SubenPasajeros is activated as I show it here. What happens is that the SetElementPosition (Object Asiento1) does not work. But if you add it with the Upload command if you add the object function greetingCommand ( playerSource, commandName ) setTimer ( SubenPasajeros, 500, 1, client) triggerClientEvent ( "onGreetingb", getRootElement(), PasajSuben ) end
  17. La mayoría de los scripts que descargues tiene la posibilidad de editarlos, te vas a dar cuenta porque van a ser todos símbolos cuando no puedas.
  18. Con el CommandHandler "Sube" funciona, pero con el Pe, ¿Que hace? Crea el objeto, pero no lo redirecciona con el SetElementPosition y attach, es como si lo ignorara... ¿Alguna solución? function SubenPasajeros () if CantidadDeAsientos >= 0 then if Asiento1 == 0 then Asiento1 = 1 local vehicle = getPedOccupiedVehicle( client ) x1, y1, z1 = getElementPosition ( client ) Asiento1 = createObject (2035, 1421.958984375, 2624.4677734375, 11.392612457275) setElementPosition ( Asiento1, x1, y1, z1) attachElements( Asiento1, vehicle, 0.95, 0.6, 0, 0, 0, 0 ) --Fila 1 A outputChatBox ("Asiento1") else if Asiento2 == 0 then Asiento2 = 1 outputChatBox ("Asiento2") local vehicle = getPedOccupiedVehicle( client ) x1, y1, z1 = getElementPosition ( client ) Asiento2 = createObject (2035, 1421.958984375, 2624.4677734375, 11.392612457275) setElementPosition ( Asiento2, x1, y1, z1) attachElements( Asiento2, vehicle, 0.5, -0.2, 0, 0, 0, 0 ) --Fila 2 B end end end addCommandHandler("sube",SubenPasajeros) function PrenderFuncSubenPasajeros () outputChatBox ("JEJE") setTimer ( SubenPasajeros, 500, 1) end addCommandHandler("pe",PrenderFuncSubenPasajeros)
  19. Server Side, it does not work with the set timer directing it, but with the command function SubenPasajeros () if CantidadDeAsientos >= 0 then if Asiento1 == 0 then Asiento1 = 1 client = player local vehicle = getPedOccupiedVehicle( client ) x1, y1, z1 = getElementPosition ( client ) Asiento1 = createObject (2035, 1421.958984375, 2624.4677734375, 11.392612457275) setElementPosition ( Asiento1, x1, y1, z1) attachElements( Asiento1, vehicle, 0.95, 0.6, 0, 0, 0, 0 ) --Fila 1 A outputChatBox ("Asiento1") else if Asiento2 == 0 then Asiento2 = 1 outputChatBox ("Asiento2") local vehicle = getPedOccupiedVehicle( client ) x1, y1, z1 = getElementPosition ( client ) Asiento2 = createObject (2035, 1421.958984375, 2624.4677734375, 11.392612457275) setElementPosition ( Asiento2, x1, y1, z1) attachElements( Asiento2, vehicle, 0.5, -0.2, 0, 0, 0, 0 ) --Fila 2 B function D3 () outputChatBox ("JEJE") setTimer ( SubenPasajeros, 500, 1, DispPasajeros) end addCommandHandler("pe",D3)
  20. les comento que el problema de la función se encontraba en triggerClientEvent ( "onGreetingb", getRootElement(), PasajSuben Por la posición del ".." y el getRoot, gracias de todas maneras!
  21. Sigue sin funcionar function Parada_58_a_1 (DispPasajeros) if (PasajENP_a_1 > 0) and (DispPasajeros > 0) then DispPasajeros = DispPasajeros -1 PasajENP_a_1 = PasajENP_a_1 -1 PasajSuben = PasajSuben +1 outputChatBox ("Pasajeros que suben: " .. PasajSuben, source) outputChatBox ("Pasajeros Disponibles: " .. DispPasajeros, source) setTimer ( Parada_58_a_1, 1000, 1, source, DispPasajeros) else outputChatBox ("Pasajeros Nuevos Disponibles: " .. DispPasajeros, source) timer = setTimer (greetingCommand, 500, 1, client, PasajSuben) end end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", resourceRoot, Parada_58_a_1 ) function greetingCommand ( playerSource, PasajSuben ) triggerClientEvent ( playerSource, "onGreeting2", playerSource, PasajSuben ) --Aca es el dato que se pasa a Cliente outputChatBox ("Pasajeros que suben: " .. PasajSuben, playerSource) end
  22. Tengo un problema, ahora lo que sucede es que de cliente a servidor, no llega a comunicarse
  23. Al momento de dirigir un dato al servidor funciona todo bien, el caso es cuando al modificar ese valor y devolverlo otro con ClientTrigger, no funciona o por alguna razón no se activa. Client Side (NOTA: La function greetingHandler, el outputChatBox no aparece) function greetingCommand ( Parada01_Ramal_a ) if timer then killTimer(timer) timer = nil end if (actualspeed) <= 20 then veh = getPedOccupiedVehicle( localPlayer ) outputChatBox ("Disponibilidad:" ,255,0,0, true); outputChatBox (DispPasajeros ,255,0,0, true) triggerServerEvent ( "onGreeting", resourceRoot, DispPasajeros ) ---La disponibilidad es el valor que modifico en el servidor end end function greetingHandler ( PasajSuben ) ---Pasajeros Suben, es el valor modificado gracias a la disponibilidad (Y que necesito de vuelta en cliente) CantPasajeros = CantPasajeros + PasajSuben --- Sumo al total con ese dato outputChatBox ("CantidadNueva:" ,255,0,0, true); outputChatBox (CantPasajeros ,255,0,0, true) end addEvent( "onGreeting2", true ) addEventHandler( "onGreeting2", localPlayer, greetingHandler ) Server Side (NOTA: La idea era que con el ELSE que verán a continuación ya devuelva el dato, pero no encontraba la forma de hacerlo) ¿habría una forma de integrar el trigger a la func Parada_58_a_1? function Parada_58_a_1 (DispPasajeros) if (PasajENP_a_1 > 0) and (DispPasajeros > 0) then DispPasajeros = DispPasajeros -1 PasajENP_a_1 = PasajENP_a_1 -1 PasajSuben = PasajSuben +1 outputChatBox ("Pasajeros que suben: " .. PasajSuben, client) outputChatBox ("Pasajeros Disponibles: " .. DispPasajeros, client) setTimer ( Parada_58_a_1, 1000, 1, DispPasajeros) else outputChatBox ("Pasajeros Nuevos Disponibles: " .. DispPasajeros, client) timer = setTimer (greetingCommand, 500, 1, PasajSuben) --Pasa a la otra func, para realizar el Trigger Client end end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", resourceRoot, Parada_58_a_1 ) function greetingCommand ( playerSource, commandName ) local playerSource = getPlayerName( playerSource ) triggerClientEvent ( "onGreeting2", playerSource, PasajSuben ) --Aca es el dato que se pasa a Cliente outputChatBox ("Pasajeros que suben: " .. PasajSuben, client) end Gracias!
  24. Solucionado, >> <info description="Shader - Tex names" version="0.0.2" type="script" />
×
×
  • Create New...