Estevam2d Posted October 28, 2013 Share Posted October 28, 2013 how can I create a xDrawText? But when you want to arrive at a particular place. Sorry for the bad english. Link to comment
Chopper Posted October 28, 2013 Share Posted October 28, 2013 I dont really get what you mean, you can use dxDrawText Link to comment
Estevam2d Posted October 28, 2013 Author Share Posted October 28, 2013 but how do I create the coordinates (a position that will display the dxDrawText)? I am newbie in creating script. I want to create a dxDrawText, but I need to know how. And I want to create in a specific location. Link to comment
Chopper Posted October 28, 2013 Share Posted October 28, 2013 Specific Position? Well, you could attach it to something, right? for example, a player, object, vehicle. use attachElements Link to comment
Estevam2d Posted October 28, 2013 Author Share Posted October 28, 2013 thank you I am entering this line of script, but I need to learn more and do not know where I can learn. Could you tell me where I can learn more detailed script? Link to comment
Chopper Posted October 28, 2013 Share Posted October 28, 2013 The MTA Wiki is always a good place to learn it. You can find basically everything on it. Link to comment
Estevam2d Posted October 28, 2013 Author Share Posted October 28, 2013 Thanks again. Soon I will post the script here for help. Link to comment
Tete omar Posted October 28, 2013 Share Posted October 28, 2013 I think he wants to draw a text in some position in the world. You can use: dxDrawText getScreenFromWorldPosition Link to comment
Estevam2d Posted October 28, 2013 Author Share Posted October 28, 2013 I want to create a drawing on the screen. For example in Ammunation, if I got the position would appear to draw Link to comment
Dealman Posted October 28, 2013 Share Posted October 28, 2013 Do you mean sort of like a marker? You walk onto a marker, and the text appears on the screen. And if you leave it, it disappears? Link to comment
Estevam2d Posted October 28, 2013 Author Share Posted October 28, 2013 This is it even But I want without the marker. just get close already appears draw Link to comment
Dealman Posted October 28, 2013 Share Posted October 28, 2013 You can use ColShapes to see when a player is inside a ColShape and when one leaves. Link to comment
Estevam2d Posted October 28, 2013 Author Share Posted October 28, 2013 Look underneath the money. It appears that the drawtext for everyone and I did not want so I wanted to q appear only for a player and also in a certain position. Link to comment
Dealman Posted October 28, 2013 Share Posted October 28, 2013 Would be useful if you post the code you use to render it. What you could do would be to do it server-side(with ColShape), and then use triggerClientEventto pass the player element as an argument. As for the rendering, make an if statement to check if the local player's element/name is the same as the one passed down with triggerClientEvent. If true, render it. If false, don't render it. Hope I made it understandable Link to comment
Estevam2d Posted October 28, 2013 Author Share Posted October 28, 2013 sorry Here's cliente.lua I want to create a DrawText only for the player and not for all only one posisao de los santos local messagesList = { "Bem vindo", "Sempre olhe MTA-BRASIL", "Talves voce perca", "E sempre estaremos", "Traga jogadores", "Traga 3 e ganhe", "traga 5 e ganhe", "Tem alguma duvida?", "MTA-BRASIL JOB's", "Armas agora sao salvas ao morrer", } local currentMessage = 0 -- ******************** -- * Event handlers * -- ******************** addEventHandler("onClientPreRender", getRootElement(), function() local screenWidth, screenHeight = guiGetScreenSize() -- Draw the news sticker. dxDrawRectangle(screenWidth - 310, 325, 200, 20, tocolor(0, 0, 0, 100), false) -- Draw all strings. dxDrawText(messagesList[currentMessage + 1], screenWidth - 400, 330, screenWidth - 6, 16, tocolor(255, 255, 255, 150), 1, "default-bold", "center", "top", false, false, false) end ) function updateMessage() if (currentMessage == 11) then currentMessage = 0 else currentMessage = currentMessage + 1 end end setTimer(updateMessage, 4000, 0) Link to comment
Castillo Posted October 28, 2013 Share Posted October 28, 2013 You want to draw that only for the player if he/she is in Los Santos? Link to comment
Dealman Posted October 28, 2013 Share Posted October 28, 2013 So, I don't even know what I am thinking anymore. I was writing some examples for you, then I realized it's not even necessary. The problem you have, is that you're using the event onClientPreRender. So whenever a client loads that script, it will draw that. This is why everyone saw it. You can go ahead and try this, I haven't tested it - and you'll also have to create a proper ColShape. I just provided an example, you fill in the rest. Also, do try to read and understand it, instead of just copying and pasting. local messagesList = { "Bem vindo", "Sempre olhe MTA-BRASIL", "Talves voce perca", "E sempre estaremos", "Traga jogadores", "Traga 3 e ganhe", "traga 5 e ganhe", "Tem alguma duvida?", "MTA-BRASIL JOB's", "Armas agora sao salvas ao morrer" } local currentMessage = 0 local screenWidth, screenHeight = guiGetScreenSize() -- Create a ColShape when the script is loaded. (Most likely when Resource starts) local ammunitionColShape = createColRectangle(X, Y, Width, Height) function updateMessage() if (currentMessage == 11) then currentMessage = 0 else currentMessage = currentMessage + 1 end end setTimer(updateMessage, 4000, 0) -- Check when the client enters the ColShape. Start rendering. function onClientInAmmunition() -- Isolate it from other ColShapes, if you have any. if(source == ammunitionColShape) then -- Start the rendering addEventHandler("onClientRender", getRootElement(), ammunitionDXDrawings) end end addEventHandler("onClientColShapeHit", getRootElement(), onClientInAmmunition) -- Check when the client leaves the ColShape. Stop rendering. function onClientLeaveAmmunition() -- Isolate it from other ColShapes, if you have any. if(source == ammunitionColShape) then -- Stop the rendering removeEventHandler("onClientRender", getRootElement(), ammunitionDXDrawings) end end addEventHandler("onClientColShapeLeave", getRootElement(), onClientLeaveAmmunition) -- Do take note how this function does not have an event handler. That's because we add it manually with the above functions. function ammunitionDXDrawings() -- Draw the news sticker. dxDrawRectangle(screenWidth - 310, 325, 200, 20, tocolor(0, 0, 0, 100), false) -- Draw all strings. dxDrawText(messagesList[currentMessage + 1], screenWidth - 400, 330, screenWidth - 6, 16, tocolor(255, 255, 255, 150), 1, "default-bold", "center", "top", false, false, false) end Note: onClientRender and onClientPreRender repeats the entire function for every frame. That means it will repeat the one same function 30-60 times per second. Thus, you need to be very careful when working with it. In this case, you were getting the client's screen resolution with every frame. Not very efficient and might cause instability depending on what you're doing with it. Link to comment
Estevam2d Posted October 28, 2013 Author Share Posted October 28, 2013 I am beginner in script I try to understand with patience. But I do not need to put the positions x, y, z so it appears the drawText ? Solidsnake14 is nearly so, not only in los santos entire is only in store Ammunation. Like when I get near the shop appeared drawText with the rules Ammunation Link to comment
Dealman Posted October 28, 2013 Share Posted October 28, 2013 So, do you want the text on the actual screen? Or do you want it in-game, like above the ground? I am greatly confused. Link to comment
Estevam2d Posted October 28, 2013 Author Share Posted October 28, 2013 I want the screen real I want at particular location Link to comment
Dealman Posted October 29, 2013 Share Posted October 29, 2013 Then you'll have to use getScreenFromWorldPosition. Link to comment
Estevam2d Posted October 29, 2013 Author Share Posted October 29, 2013 Yeah but how do that? Link to comment
denny199 Posted October 29, 2013 Share Posted October 29, 2013 You need to use: https://wiki.multitheftauto.com/wiki/CreateColRectangle -- the position where you want to start the rendering https://wiki.multitheftauto.com/wiki/On ... olShapeHit -- start rendering https://wiki.multitheftauto.com/wiki/On ... ShapeLeave --stop rendering https://wiki.multitheftauto.com/wiki/RemoveEventHandler -- to remove the event "onClientRender" If you need help with the colshape, then feel free to ask me, or just post your used code here. Link to comment
Estevam2d Posted October 29, 2013 Author Share Posted October 29, 2013 The drawText already ready, I put the two dxDrawRectangle and is working. But what I need is to make this event start only in a particular area. need a funciton that allows me to put x, y, z. I tested the getScreenFromWorldPosition, only appears in the game I want just about to the display. Link to comment
myonlake Posted October 30, 2013 Share Posted October 30, 2013 Please search the Wiki before posting. It's not hard to type in the search box. https://wiki.multitheftauto.com/wiki/Ge ... enPoints3D Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now