Jump to content

dolmen62

Members
  • Posts

    42
  • Joined

  • Last visited

Everything posted by dolmen62

  1. Tu souhaite lister tout les véhicules du serveur ? Veux-tu des données sauvegardées ? (Base de données) Car sinon une simple boucle suffit ! function carlist () local tablecar = {{car}} local cars = getElementsByType( "vehicle" ) for k, veh in ipairs( carrs ) do tablecar[k] = {car=veh} end
  2. dolmen62

    Train System?

    Yes ! But I've tryed everything and nothing work without client. It work great because it use only the best Ping client.
  3. Hello ! Now I want to finish it ! I've work on other script now and I know a lot of things. The train script is impossible to read ! its Amazing ! I've seen some big error! Well, It need to be optimized. And the last problems is when there is nobody in the server and the start up of the train that need a player next to the train !
  4. dolmen62

    Train System?

    I've made a train system ! But I have problem when nobody is in the server. The train stop in the Stations ! And it's automatic, nobody have to drive it. But it's very very laggy, and something went wrong when nobody is in the server.
  5. Moi j'ai connu MTA avant SA:MP. Et la première fois que j'y ai joué (pour voir la différence) c'est au niveau de la personnalisation que j'ai trouvé MTA meilleur. En effet, SA:MP conserve énormément de choses du jeu original. (Un bon exemple, le chargement de démarrage, ou encore les couleurs de véhicules, qui sont entièrement personnalisée dans MTA). Voilà une petite remarque sans argumenter des pages (je ne suis pas expert ).
  6. Bug found ! when there is no player in the server ! I'm working to repare it. I will make a vidéo soon.
  7. It is finish now, this is the first version, before MTA 1.1 Thank you all for your help, Citizen, CrystalMV, Solidsnake14.
  8. I need to program station now. But timer are not presise it change in function of the processor charge.
  9. Thank you !!! It work great now !!! Now I have to program station ^^
  10. Well, I've a new idea. view my code : It don't work. Client Side : addEvent("removeStreamableLocos", true ) function removeStreamableLocos( theElement ) setElementStreamable( getElementByID( "loco1" ), false ) setElementStreamable( getElementByID( "wagon1" ), false ) setElementStreamable( getElementByID( "pilot1" ), false ) setElementStreamable( getElementByID( "pilot2" ), false ) end addEventHandler("removeStreamableLocos", getRootElement(), removeStreamableLocos ) addEvent("getTrain", true ) function getTrain () local x, y, z = getElementPosition(getElementByID( "loco1" )) local a, b, c = getElementPosition(getElementByID( "wagon1" )) local g, h, i = getElementPosition(getElementByID( "pilot2" )) local d, e, f = getElementPosition(getElementByID( "pilot1" )) triggerServerEvent("setTrainPosition",getRootElement(),x,y,z,a,b,c,g,h,i,d,e,f) end addEventHandler("getTrain", getRootElement(), getTrain) and Server Side : function makeTrain(source) loco = createVehicle(537,1725.9,-1954,16) locool = createVehicle(538,1840,-1954,16) setElementID( loco, "loco1" ) setElementID( locool, "wagon1" ) setTrainDerailable(loco, false) setTrainDerailable(locool, false) local pilot1 = createPed(241,1693.38,-1959,15.6) local pilot2 = createPed(241,1711,-1959,15.6) setElementID( pilot1, "pilot1" ) setElementID( pilot2, "pilot2" ) warpPedIntoVehicle (pilot1, loco) warpPedIntoVehicle (pilot2, locool) setTimer(setTrain, 5000, 0) createBlipAttachedTo(loco, 42) setTrainSpeed(loco, 0) setTrainSpeed(locool,0.203) setTimer(assemblage, 10000, 1) outputChatBox("Train is here", source, 255, 255, 0) removeStreamable( loco ) setTimer(depart, 20000, 1) nextgare = 0 end addCommandHandler("traintest", makeTrain) function assemblage () nextgare = nextgare+1 setTrainSpeed(loco, 0) setTrainSpeed(locool, 0) setTimer(depart, 20000,1) end function depart () nextgare = nextgare+1 setTrainSpeed(loco, 1) setTrainSpeed(locool, 1) if nextgare == 0 then setTimer(assemblage, 88000, 1) else if nextgare == 2 then setTimer(assemblage, 23000, 1) else if nextgare == 4 then setTimer(assemblage, 93000, 1) else if nextgare == 6 then setTimer(assemblage,102000, 1) else if nextgare == 8 then setTimer(assemblage, 50000, 1) else if nextgare == 10 then nextgare = 0 end end end end end end end function speed () setTrainSpeed(loco, 1) setTrainSpeed(locool, 1) end function removeStreamable( theElement ) triggerClientEvent( "removeStreamableLocos", getRootElement() ) end addEvent("setTrainPosition",true) function setTrain (x,y,z,a,b,c,g,h,i,d,e,f) triggerClientEvent( "getTrain", getRootElement()) setElementPosition(loco, x, y, z, false) setElementPosition(locool, a, b, c, false) setElementPosition(pilot1, d, e, f, false) setElementPosition(pilot2, g, h, i, false) end addEventHandler("setTrainPosition",getRootElement(),setTrain)
  11. I have an Idea : refresh coordinates only when the train is in the station.
  12. It don't work, I have error, when i want to setElement Position !
  13. No... Ok I will try ! But how to execute the function, only for the nearest player ?
  14. I don't think I will use that, because, it's to laggy. I'm working on a system of marker, to put the player into the train. But only when it is here "if nextgare == number of the station "
  15. It don't work, the train can't move, and it's very laggy.
  16. I just have an idea. If I warp the man into the train, with a marker, It can work !
  17. Yes, I have to use the ping of the player. If the ping is > 150 ten ...
  18. View my code : Client side : addEvent("getTrain", true ) function getTrain () local x, y, z = getElementPosition(getElementByID( "loco1" )) local a, b, c = getElementPosition(getElementByID( "wagon1" )) local g, h, i = getElementPosition(getElementByID( "pilot2" )) local d, e, f = getElementPosition(getElementByID( "pilot1" )) end addEventHandler("getTrain", getRootElement(), getTrain) Server side : function setTrain (theElement) triggerClientEvent( "getTrain", getRootElement()) setElementPosition(loco, x, y, z, false) setElementPosition(locool, a, b, c, false) setElementPosition(pilot1, d, e, f, false) setElementPosition(pilot2, g, h, i, false) end
  19. No, coordinates don't change in the server, that's why I Want to take coordinates from the client, to the server. But I try to use triggerClientEvent, but it don't work. I can't sens you code because I'm on my iPod.
  20. I don't know how to get client coordinates on the server.
  21. Thank you for your help. I Hope it work !
  22. Yes I Will try it today. But, if no body is connected to the server, what happen ?
  23. Error found !!! Train's coordinates are used by the client, and not by the server !
  24. I change my system, now I use Timer. My new problem is how to get in the train ! because it respawn when I want to get in !
×
×
  • Create New...