Jump to content

Citizen

Moderators
  • Posts

    1,803
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Citizen

  1. ok I should definitely check the functions I use before posting the code, sorry for that.
  2. Yeah that's what I said ...
  3. Try this: function blipDistanceChecker() local px, py, _ = getElementPosition ( localPlayer ) for k, blip in ipairs ( getElementsByType( "blip" ) ) local bx, by, _ = getElementPosition( blip ) local dist = getDistanceBetweenPoints2D ( px, py, bx, by ) if dist >= 300 then setElementVisibleTo(blip, localPlayer, false) else setElementVisibleTo(blip, localPlayer, true) end end end setTimer(blipDistanceChecker, 1000, 0)
  4. Show us your ACL.xml please.
  5. Yeah it should be the easiest way. A lot of servers do that.
  6. Oh yeah sorry my bad, I forgot to finish that part, so yeah Mr.Pres[T]ege finished my work by adding source for the 1st argument but it also could be GUIEditor.staticimage[2] like this: function FreeroamEnter () guiStaticImageLoadImage( GUIEditor.staticimage[2], "img/thumbs/FreeroamEnter.png" ) --'Hover state' end function FreeroamLeave () guiStaticImageLoadImage( GUIEditor.staticimage[2], "img/thumbs/FreeroamLeave.png" ) --'Normal state' end That's exactly the same because GUIEditor.staticimage[2] will always be the source of this event. For the baground problem, just set the property "AlwaysOnTop" for the staticimage[2]: guiSetProperty( GUIEditor.staticimage[2], "AlwaysOnTop" ) That should do the trick. Sorry again for that mistake. Best regards, Citizen
  7. You have to create your own CEGUI skin you can find the 3 skins that are already in MTA here: C:\Program Files (x86)\MTA San Andreas 1.3\skins (on my computer at least) But if you put your new CEGUI skin in ur game directory you will be the only one who would be able to use/see it. I remember that I read a long time ago that MTA would add functions to let the servers to use their own CEGUI skin. (btw I didn't find that function, so it probably not done yet) If you already saw some great GUI (Graphic User Interface) on some servers, that's because they made their own GUI with the dx functions. There should be a resource (not sure but it would be an awesome resource) that would let you load your own CEGUI skins. Best regards, Citizen
  8. I would proceed like this: function drawWorldGui() GUIEditor.staticimage[1] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/backround.png", true) showCursor(true) --'Normal state' GUIEditor.staticimage[2] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamLeave.png", true, GUIEditor.staticimage[1]) --(picture 1 & 3) addEventHandler( "onClientMouseEnter", GUIEditor.staticimage[2], FreeroamEnter) addEventHandler( "onClientMouseLeave", GUIEditor.staticimage[2], FreeroamLeave) end addEventHandler("onClientResourceStart", resourceRoot,drawWorldGui) function FreeroamEnter () guiStaticImageLoadImage( , "img/thumbs/FreeroamEnter.png" ) --'Hover state' end function FreeroamLeave () guiStaticImageLoadImage( , "img/thumbs/FreeroamLeave.png" ) --'Normal state' end So I only use 1 static image and then I just change the image displayed in that static image with guiStaticImageLoadImage. and I can add the two events ("onClientMouseEnter" and "onClientMouseLeave") on the correct element (which is the GUIEditor.staticimage[2]) (you added those events on the button you created and that is not needed at all) Should work but you still need to do the click detection but I guess you will do it well. Best regards, Citizen
  9. Citizen

    Help resource

    Ok just copy and paste this: Client: local sx, sy = guiGetScreenSize ( ) local pX, pY = ( sx / 2 - 485 / 2 ), ( sy / 2 - 231 / 2 ) local username = guiCreateEdit(pX+156, pY+61, 288, 33, "", false) guiSetVisible ( username, false ) local password = guiCreateEdit(pX+156, pY+121, 288, 33, "", false) guiSetVisible ( password, false ) guiEditSetMasked(password, true) local window = guiCreateWindow( ( sx / 2 - 266 / 2 ), ( sy / 2 - 208 / 2 ), 266, 208, "Error", false) guiWindowSetMovable(window, false) guiWindowSetSizable(window, false) guiSetVisible ( window, false ) guiSetAlpha ( window, 1 ) local exitBtn = guiCreateButton(155, 162, 101, 36, "Salir", false, window) local infoLbl = guiCreateLabel(18, 26, 228, 130, "Mensaje", false, window) local isOpen = false; local isLoggedin = false; local data = { login = { hovering = false, alphaMode = false, loginTextAlpha = 235, colors = { 255, 255, 255 } }, reg = { hovering = false, alphaMode = false, loginTextAlpha = 235, colors = { 255, 255, 255 } } } data.login.hovering = false data.reg.hovering = false data.inv.hovering = false function dxDrawLoginPanel( ) -- default: 350, 266 if ( isOpen ) then dxDrawRectangle(pX, pY, 485, 231, tocolor(0, 0, 0, 180), false) dxDrawRectangle(pX, pY+231, 100, 19, tocolor(0, 0, 0, 180), false) dxDrawText("Invitado", pX+105, pY+230, 150, 10, tocolor(255, 255, 255, 255), 0.5, "bankgothic", "center", "top", false, false, false, false, false) dxDrawText("Login", pX-220, pY, 870, 314, tocolor(0, 128, 255, 255), 1.50, "bankgothic", "center", "top", false, false, false, false, false) dxDrawLine(pX, pY+48, pX+485, pY+48, tocolor(255, 128, 0, 255), 1, false) dxDrawText("Usuario:", pX+10, pY+69, 506, 368, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Password:", pX+10, pY+129, 506, 428, tocolor(255, 255, 255, 255), 0.80, "bankgothic", "left", "top", false, false, false, false, false) dxDrawLine(pX+276, pY+168, pX+276, pY+168+34, tocolor(255, 128, 0, 255), 1, false) local r, g, b = unpack ( data.login.colors ) dxDrawText("Login", pX+156, pY+167, 600, 468, tocolor( r, g, b, data.login.loginTextAlpha), 1.00, "bankgothic", "left", "top", false, false, false, false, false) local r, g, b = unpack ( data.reg.colors ) dxDrawText("Register", pX+300, pY+167, 794, 468, tocolor(r, g, b, data.reg.loginTextAlpha), 1.00, "bankgothic", "left", "top", false, false, false, false, false) local r, g, b = unpack ( data.inv.colors ) dxDrawText("Invitado", pX+105, pY+230, 150, 10, tocolor(r, g, b, data.inv.loginTextAlpha), 0.5, "bankgothic", "center", "top", false, false, false, false, false) -- give fade effect if ( data.login.hovering ) then data.login.colors = { 0, 128, 255 } local alpha = data.login.loginTextAlpha if ( not data.login.alphaMode ) then data.login.loginTextAlpha = alpha - 5 if ( data.login.loginTextAlpha <= 50 ) then data.login.alphaMode = true end else data.login.loginTextAlpha = alpha + 5 if ( data.login.loginTextAlpha >= 235 ) then data.login.alphaMode = false end end elseif ( data.reg.hovering ) then data.reg.colors = { 0, 128, 255 } local alpha = data.reg.loginTextAlpha if ( not data.reg.alphaMode ) then data.reg.loginTextAlpha = alpha - 5 if ( data.reg.loginTextAlpha <= 50 ) then data.reg.alphaMode = true end else data.reg.loginTextAlpha = alpha + 5 if ( data.reg.loginTextAlpha >= 235 ) then data.reg.alphaMode = false end end elseif ( data.inv.hovering ) then data.inv.colors = { 0, 128, 255 } local alpha = data.inv.loginTextAlpha if ( not data.inv.alphaMode ) then data.inv.loginTextAlpha = alpha - 5 if ( data.inv.loginTextAlpha <= 50 ) then data.inv.alphaMode = true end else data.inv.loginTextAlpha = alpha + 5 if ( data.inv.loginTextAlpha >= 235 ) then data.inv.alphaMode = false end end data.login.loginTextAlpha = 235 data.reg.loginTextAlpha = 235 data.inv.lognTextAlpha = 235 data.login.colors = { 255, 255, 255 } data.reg.colors = { 255, 255, 255 } data.inv.colors = { 255, 255, 255 } end end end function cursorMove ( _, _, x, y ) if ( isCursorShowing ( ) and not guiGetVisible ( window ) and isOpen) then if ( x >= pX+156 and x <= pX+246 and y >= pY+170 and y <= pY+200 ) then data.login.hovering = true elseif ( y >= pY+170 and y <= pY+200 and x >= pX+300 and x <= pX+440 ) then data.reg.hovering = true elseif ( x >= pX+105 and x <= pX+195 and y >= pY+230 and y <= pY+260 ) then data.inv.hovering = true end end end function openLogin ( ) addEventHandler ( "onClientPreRender", root, dxDrawLoginPanel ) addEventHandler ( 'onClientCursorMove', root, cursorMove ) addEventHandler ( "onClientClick", root, clientClicking ) guiSetInputMode ( "no_binds_when_editing" ) guiSetVisible ( password, true ) guiSetVisible ( username, true ) showCursor ( true ) addEventHandler ( 'onClientGUIClick', root, clientClosingErrorWindowEvent ) isOpen = true showChat(false) showPlayerHudComponent ( 'all', false ) end addEvent ( "onClientPlayerLogout", true ) addEventHandler ( 'onClientPlayerLogout', root, openLogin ) function closeLogin ( ) removeEventHandler ( "onClientPreRender", root, dxDrawLoginPanel ) removeEventHandler ( 'onClientCursorMove', root, cursorMove ) removeEventHandler ( "onClientClick", root, clientClicking ) guiSetVisible ( password, false ) guiSetVisible ( username, false ) showCursor ( false ) removeEventHandler ( 'onClientGUIClick', root, clientClosingErrorWindowEvent ) guiSetVisible ( window, false ) isOpen = false isLoggedin = true showChat(true) showPlayerHudComponent ( 'all', true ) end addEvent ( "onClientPlayerLogin", true ) addEventHandler ( "onClientPlayerLogin", root, closeLogin ) function sendError ( msg ) if ( not guiGetVisible ( window ) ) then guiSetVisible ( window, true ) guiSetText ( infoLbl, msg ) guiBringToFront ( window ) end end addEvent ( "onPlayerLoginPanelError", true ) addEventHandler ( "onPlayerLoginPanelError", root, sendError ) function clientClicking ( btn, state, x, y ) if ( btn == 'left' and not guiGetVisible ( window ) and state == 'down' and isOpen ) then local user, pass = guiGetText ( username ), guiGetText ( password ) -- Login Button -- if ( x >= pX+156 and x <= pX+246 and y >= pY+170 and y <= pY+200 ) then if ( string.gsub ( user, ' ', '' ) ~= '' and string.gsub ( pass, ' ', '' ) ~= '' ) then if ( string.find ( user, '%s' ) ) then return sendError ( "Los espacios (' ') no estan permitido \npara colocarlo en el usuario." ) end if ( string.find ( pass, '%s' ) ) then return sendError ( "Los espacios (' ') no estan permitido \npara colocarlo en la password." ) end triggerServerEvent ( "Login:onClientAttemptLogin", localPlayer, user, pass ) else sendError ( "Un usuario y contraseña es requerido \npara ingresar al server..." ) end -- register button elseif ( y >= pY+170 and y <= pY+200 and x >= pX+300 and x <= pX+440 ) then if ( string.gsub ( user, ' ', '' ) ~= '' and string.gsub ( pass, ' ', '' ) ~= '' ) then if ( string.find ( user, '%s' ) ) then return sendError ( "No se permiten espacios \nen el usuario." ) end if ( string.find ( pass, '%s' ) ) then return sendError ( "No se permiten espacios \nen la contraseña." ) end if ( string.len ( user ) < 5 ) then return sendError ( "El usuario debe tener \ncomo minimo 5 caracteres de largo." ) end if ( string.len ( pass ) < 6 ) then return sendError ( "La contraseña debe tener \ncomo mínimo 6 caracteres de largo." ) end triggerServerEvent ( "Login:onClientAttemptRegistration", localPlayer, user, pass ) else sendError ( "Un usuario y contraseña es requerido \npara ingresar al server..." ) end -- invitado boton elseif ( x >= pX+105 and x <= pX+195 and y >= pY+230 and y <= pY+260 ) then outputChatBox( "I clicked on invitado button !") triggerServerEvent( "Login:onClientAttemptGuest", localPlayer ) end end end function clientClosingErrorWindowEvent( ) if ( source == exitBtn ) then guiSetVisible ( window, false ) end end function isClientLoggedin ( ) return isLoggedin end setTimer ( function ( ) openLogin ( ) end, 700, 1 ) Server: local cameras = { { 329.10980224609, -2117.2749023438, 50.161201477051, 329.65179443359, -2116.4926757813, 49.853763580322 }, { 1266.0053710938, -1965.7087402344, 114.59829711914, 1265.1549072266, -1966.1115722656, 114.25980377197 }, { 1514.0283203125, -1716.5743408203, 39.910701751709, 1514.5087890625, -1715.865234375, 39.394691467285 }, { 1338.7514648438, -875.66558837891, 99.84880065918, 1339.4935302734, -875.07824707031, 99.52579498291 }, { 1426.5421142578, -725.40289306641, 120.97090148926, 1427.3695068359, -725.00805664063, 120.571434021 }, { 1357.5914306641, -592.23327636719, 125.15190124512, 1357.1751708984, -593.02673339844, 124.70780944824 }, { 988.01123046875, -341.88409423828, 74.752601623535, 988.70251464844, -342.45135498047, 75.200187683105 }, { -224.32290649414, -153.71020507813, 35.085899353027, -223.61195373535, -153.04695129395, 34.852146148682 } } function openView( plr ) local theplr = nil if ( source and getElementType ( source ) == 'player' ) then theplr = source elseif ( plr and getElementType ( plr ) == 'player' ) then theplr = plr end setTimer ( function ( p ) local ind = math.random ( #cameras ) setCameraMatrix ( p, unpack ( cameras[ind] ) ) end, 700, 1, theplr ) end addEventHandler ( "onPlayerJoin", root, openView ) addEventHandler ( "onPlayerLogout", root, openView ) --addCommandHandler ( 'view', openView ) function attemptLogin ( user, pass ) if ( user and pass and type ( user ) == 'string' and type ( pass ) == 'string' ) then --local user = string.lower ( user ) --local pass = string.lower ( pass ) local account = getAccount ( user ) if ( account ) then if ( not logIn ( source, account, pass ) ) then message ( source, "Password incorrecta \npor favor verifique." ) return false end setCameraTarget ( source, source ) triggerLogin ( source, user, pass ) else message ( source, "Cuenta desconocida \npor favor verifique." ) return false end end return false end addEvent ( "Login:onClientAttemptLogin", true ) addEventHandler ( "Login:onClientAttemptLogin", root, attemptLogin ) function attemptRegister ( user, pass ) if ( user and pass and type ( user ) == 'string' and type ( pass ) == 'string' ) then --local user = string.lower ( user ) --local pass = string.lower ( pass ) local account = getAccount ( user ) if ( not account ) then local account = addAccount ( user, pass ) if ( account ) then if ( not logIn ( source, account, pass ) ) then return message ( source, "Ocurrio un error en el logeo." ) end setCameraTarget ( source, source ) triggerLogin ( source, user, pass ) else message ( source, "Error al registrar la cuenta. \nPor favor contacta con un Admin." ) end else message ( source, "Esta cuenta ya existe." ) end end return false end addEvent ( "Login:onClientAttemptRegistration", true ) addEventHandler ( "Login:onClientAttemptRegistration", root, attemptRegister ) function message ( source, msg ) triggerClientEvent ( source, "onPlayerLoginPanelError", source, msg ) end function triggerLogin ( source, user, pass ) triggerClientEvent ( source, "onClientPlayerLogin", source, user, pass ) end addEventHandler ( 'onPlayerLogout', root, function ( ) triggerClientEvent ( source, 'onClientPlayerLogout', source ) end ) addEvent( "Login:onClientAttemptGuest", true ) function attemptGuest() local pname = tostring(getPlayerName(source)) outputChatBox("Serverside: Logging "..source.." as guest !") -- Do your stuff here end addEventHandler( "Login:onClientAttemptGuest", root, attemptGuest) You definitly should use a correct text editor with syntax highlighting (for example Notepad++). There were some codes that were out of functions that you probably wanted put in them. Best regards, Citizen
  10. Hummmm on a du mal te renseigner car il n'y a aucun exécutable dans le dossier deathmatch. Pour bien commencer dans la création d'un serveur MTA et comprendre son organisation comme tu le demandes, je te renvois sur la page traduite en français: Introduction à la programmation Tu pourras comprendre ce qu'est une ressource, comment est elle représenté dans le dossier de MTA, comment en créer une et comment créer des commandes. Plus je vois le nombre de questions similaires, plus je me dit qu'il me faut faire une série de tutoriels sur youtube. En tout cas commence par là, lit bien et ne survole pas à la va vite. Prends le temps de tester les codes que le tutoriel te propose de faire et ne fait pas genre: "Oh ça va, pas besoin de tester, je devine ce que ça doit faire." Certes n'importe qui peut deviner ce que les commandes de ce tuto va produire, vu que c'est marqué et que les fonctions utilisées son très explicites comme par exemple la fonction createVehicle, tu devines tout de suite que c'est une fonction qui va créer un véhicule en fonction des arguments que tu vas lui donner. Voilà bon courage et tiens nous au courant de ta progression ou pour nous poser une question sur l'organisation d'un serveur MTA qui n'aurait pas été abordé dans ce tutoriel. Cordialement, Citizen
  11. Tu devrais pourtant, en effet, rien ne l'empêche de prendre un bazooka et de tirer à coté des autres joueurs et/ou véhicules du moment où il ne vise pas sur un élément de MTA. J'ai testé pour bien définir les conditions pour que l’événement soit triggered.
  12. Fait mon système client-side comme j'ai expliqué, et mon système n'a pas besoin de trigger oO (même si le setElementData synchronise la valeur client-side). Le code de Maxur est difficilement perfectible, y a même le break pour arrêter la boucle for Je me pose quand même la question de savoir si l'event onPedWeaponSwitch est triggered lors d'un giveWeapon Car si c'est le cas, on peut l'utiliser à la place de onPlayerTarget pour que l'arme soit immédiatement retirée alors que le système de maxur laisse quand même le gars se balader avec A tester.
  13. Bonjour tout le monde, Je passais par là et j'ai décidé de m'en mêler. C'est tout tout a fait normal que ça bug, car dès qu'un joueur quitte le serveur, son timer qui lui faisait référence continue toujours de tourner, il faudrait donc le killer (le timer hein, pas le joueur ). Mais imaginez 50 joueurs sur le serveur, ça va faire 50 timers qui appelle tous la même fonction mais avec un argument différent. En plus à 50 millisecondes, il va certainement y avoir des lags car le serveur va avoir du mal à gérer ces 50 timers et le reste du gamemode. Si ça ne tenait qu'à moi, j'aurais fait ça client-side comme ça chaque pc/joueur à son propre timer, et pour vérifier s'il à le droit de kick dans l'acl, je lui aurai mit un setElementData server-side lorsqu'il rejoint le serveur et ducoups côté client, je fais un petit getElementData et le tour est joué. Comme ça le serveur n'a rien à gérer et on gagne donc en performance. Mais bon ici pour faire simple et rester server-side: function antiMiniGun() setTimer(removeW, 50, 0) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), antiMiniGun) function removeW() for k, player in ipairs (getElementsByType ("player")) if not hasObjectPermissionTo (player, "function.kickPlayer") and takeWeapon(player, 38) then outputChatBox ("Vous n'avez pas le droit d'utiliser cette arme.", source, 255, 0, 0, true) end end end A noter qu'il n'y a plus qu'un timer qui est créé, et seulement au démarrage du serveur. La fonction removeW récupère tous les joueurs dans la partie (évite forcément les bug d'argument null lorsqu'un joueur quitte la partie). Voilà, on pourrai raccourcir le code pour le faire tenir en une fonction mais bon on rentrerai un peu plus dans des notions avancées de programming (les fonctions anonymes pour ceux à qui ça parleraient ) Cordialement, Citizen
  14. ça je veux bien le croire (à part ptetre la partie légale ^^) m'enfin je pense que cette version de Valhalla doit être tellement vielle par rapport à celle de maintenant qu'ils doivent surement s'en contre balancer.
  15. Enfait l'erreur est assez précise, quand tu démarres le Gm, il doit démarrer d'autres ressources nécessaires comme mysql mais apparemment, il n'y arrive pas. La seul raison pour que cette erreur s'affiche est qu'il faut rajouter les droits au GM. Pour ça il faut aller éditer l'acl.xml qui se trouve dans: C:\Program Files (x86)\MTA San Andreas 1.3\server\mods\deathmatch et de rajouter la ressource dans le group Admin: <object name="resource.<nom_de_la_ressource>"/> Tu sauvegardes et tu réessayes de lancer le gamemode. NOTE: Le GM de Vahlala est composé de plusieurs ressources comme tu auras pu le remarquer. Il doit surement y avoir un README.txt qui doit te dire quelle ressource doit être lancée (et d'après mes souvenirs, il doit démarrer toutes les autres à conditions que cette ressource de démarrage ait les droits Admin). Cordialement, Citizen EDIT: Heuuuuuuu WTF ?? Le gamemode de Vahlala ?! t'en es sûr ?! J'étais en train de confondre avec MTA PAradise qui lui est bien public, mais t'as trouvé le GM de Vahlala ?! Je sais pas s'ils sont au courant que leur GM à été rendu public, alors je serai toi, je ferais attention ...
  16. Citizen

    car spawer

    I think you don't really understand what TAPL was saying ... In your server.lua, you wrote this: local vehicles = {} local x, y, z = getElementPosition(source) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end vehicles[source] = createVehicle(id, x + 2, y, z) warpPedIntoVehicle(source, vehicles[source]) end addEvent("CreVehicePv",true) addEventHandler("CreVehicePv", root, spawnVehp) And it should be like this: local vehicles = {} function spawnVehp( model ) local x, y, z = getElementPosition( source ) if isElement( vehicles[ source ] ) then destroyElement( vehicles[ source ] ) end vehicles[ source ] = createVehicle( model, x + 2, y, z ) warpPedIntoVehicle( source, vehicles[ source ] ) end addEvent("CreVehicePv",true) addEventHandler("CreVehicePv", root, spawnVehp) Next time, try to check errors in the server console, you should get some errors about this script. Best regards, Citizen
  17. Je vous ai vu sur GTAO, je me suis dit que c'était pas mal et j'ai pas pensé à répondre mais comme je vous revois ici, je me dit pourquoi pas. J'aime le fait de faire votre GM de A à Z, je vous soutient à 100%. Je suis un des créateurs de Byston Evolution un serveur MTA RP Fr démarré en 2010 aussi entièrement fait de A à Z, mais est actuellement en stand-by par manque de motivation/temps. Peut être que vous avez entendu parlé de nous ? Je vous souhaite bonne chance pour votre projet, et concernant Byston, je peux vous assurez qu'il sortira un jour. Donc soyez compétitifs Cordialement, Citizen
  18. J'ai un peu regarder la ressource, il utilise la fonction get qui permet de récupérer des valeurs dans la meta.xml qui sont censé être dans des balises Or je ne vois rien. C'est seulement un bête copié coller de MTA Paradise sans comprendre a quoi sert la fonction get() Ensuite j'ai vu qu'il y avait un mysql.sql tu dois d'abord créer ta database ( par exemple "mta" ) puis cliquer sur importer et allez chercher ce mysql.sql Il devrai te créer les tables dont il a besoin ( accounts, characters, interiors, items et vehicles ). Une fois que c'est fait remplace ceci: local server = get( "server" ) or "" -- server local user = get( "user" ) or "" -- username local password = get( "password" ) or "" -- password local db = get( "database" ) or "" -- database local port = get( "port" ) or 3306 local socket = get( "socket" ) or nil par ceci: local server = "localhost" -- server local user = "root" -- username local password = "" -- password local db = "mta" -- database local port = 3306 local socket = nil et dit nous se que ça donne
  19. Ok so I made few tests and I found the problem, the problem is that when we set the streamable of the trains to false, then ok there aren't streamed but their positions stay streamed. If I go to the 2nd station, I see the trains moving but not their positions. So their positions aren't updated but If I go to the position where they spawned, the position is "unstreamed" and the brake function works Maybe someone can add this bug in bugtracker ( idk how to use it ) If you want to make a test, then take this: Server: 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) -- removeStreamable( loco ) -- removeStreamable( locool ) 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) -- removeStreamable( pilot1 ) -- removeStreamable( pilot2 ) createBlipAttachedTo(loco, 42) setTrainSpeed(loco, 0) setTrainSpeed(locool,0.203) outputChatBox("Train is here", source, 255, 255, 0) removeStreamable( loco ) setTimer(depart, 20000, 1) nextgare = 1 setTimer( check, 2000, 0 ) end addCommandHandler("traintest", makeTrain) -- local markerGare2 = createMarker(787, -1341.8, -1.8, "cylinder", 3, 255, 255, 255, 5) function stop (hitElement) -- outputChatBox("HIT") if not( getElementType( hitElement ) == "vehicle" ) then return end -- outputChatBox("c'est un véhicule") if not( getElementModel( hitElement ) == 537 ) then return end outputChatBox("Brake") setTrainSpeed(loco, 0) setTrainSpeed(locool, 0) -- if ( source ) then -- if ( source == markerGare2 )then -- outputChatBox("Le Train est dans Market Station.", getRootElement(), 255, 255, 0) -- end -- end setTimer(depart, 20000, 1) end -- addEventHandler( "onMarkerHit", getRootElement(), stop ) function depart () -- nextgare = nextgare+1 setTrainSpeed(loco, 1) setTrainSpeed(locool, 1) end function removeStreamable( theElement ) outputChatBox( "remove_s") triggerClientEvent( "removeStreamableLocos", getRootElement() ) end function check() local x, y, z = getElementPosition( getElementByID( "loco1" ) ) outputChatBox( x..", "..y..", "..z) if nextgare == 2 then if y >= -1341.8 then stop( loco ) nextgare = nextgare+1 end -- elseif nextgare == 3 then -- a decommenter pour continuer -- if >= then -- stop( loco ) -- end end end Client: addEvent("removeStreamableLocos", true ) function removeStreamableLocos( theElement ) setElementStreamable( getElementByID( "loco1" ), false ) setElementStreamable( getElementByID( "wagon1" ), false ) setElementStreamable( getElementByID( "pilot1" ), false ) setElementStreamable( getElementByID( "pilot2" ), false ) outputChatBox("destream") end addEventHandler("removeStreamableLocos", getRootElement(), removeStreamableLocos ) So go to the the station underground of LS then type /traintest ( the T on the map is the train ) wait 10 sec then the train will move. You will see that the position stay to 1725.9000244141, -1954, 16 and the train will not stop to the station. ok so now go to the spawn position and then the position will instantanly change to another position.
  20. Citizen

    Gui problem

    And in your meta.xml you have to make like this: <script src="server.lua" /> <!-- type="server" by default --> <!-- Now you can use server functions in this file --> <script src="client.lua" type="client" /> <!-- Now you can use client functions in this file --> and
  21. Citizen

    Problems

    If you mean the text, use this: guiSetText -- for labels, window title, edits, etc guiGridListSetItemText --for gridlist
  22. You right, I forgot that but I disabled the steam on my code ^^ You created a marker or a colShape to stop the train right ? Try this: function makeTrain(source) loco = createVehicle(537,1725.9,-1954,16) locool = createVehicle(538,1840,-1954,16) setTrainDerailable(loco, false) setTrainDerailable(locool, false) local pilot1 = createPed(241,1693.38,-1959,15.6) local pilot2 = createPed(241,1711,-1959,15.6) warpPedIntoVehicle (pilot1, loco) warpPedIntoVehicle (pilot2, locool) setTrainSpeed(loco, 0) setTrainSpeed(locool,0.21) -- why 0.21 ? outputChatBox("Train is here", source, 255, 255, 0) setTimer(stop, 10000, 1) setTimer(depart, 20000, 1) end addCommandHandler("traintest", makeTrain) local markerGare1 = createMarker( ... ) -- put the correct position function stop () setTrainSpeed(locool, 0) setTrainSpeed(locool, 0) if ( source ) then if ( source == markerGare1 )then -- if the marker hited is the markerGare1 outputChatBox("Le Train est en gare 1", getRootElement(), 255, 255, 0) end end setTimer(depart, 20000, 1) end addEventHandler( "onMarkerHit", getRootElement(), stop ) -- This is how to use addEventHandler function depart () setTrainSpeed(loco, 0.5) setTrainSpeed(locool, 0.5) end
  23. Yeah I know him ask your questions in this category, I'll help you in french ( if you need help of course )
  24. Hi, I think YOU have to translate it ( like me for french wiki ) and then ask to MTA developers to put your translated wiki because they are very busy with the 1.1
  25. Personnaly I create a colsphere, I send the message for every players in it, and then I destroy the colShape.
×
×
  • Create New...