Jump to content

Lormateve

Members
  • Posts

    39
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Lormateve's Achievements

Rat

Rat (9/54)

3

Reputation

  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
×
×
  • Create New...