FiveM Scripting 12 - Using Vectors to Create Blips and 3D Text

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys my name is Sophie Jeff today we're gonna be talking about vectors and how we use them to measure things and distances through using 3d text with vectors and we're also going to be doing blips as you can see that little X flip over there which hopefully you can hear because I can't hear anything right since my game yeah just get right into it I get right into this video we're gonna be talking about vectors in gta5 and how useful they are and so for start I'm gonna tell you again you're gonna need the code and description below because there's a function it takes super long to type and yeah it's a client download but this link will be in the description below for you guys so make sure to check this out and yeah let's get right into it I start off by I'm telling you what we're gonna make we're gonna be making a we're gonna make we're gonna be we're gonna be doing 3d text we're gonna be making a blip blip and using vectors and vectors are super important because they're just useful and they're data using like they're dynamic you know usage it's just a good way good practice for you know in using direction and like coordinates that sounded like a table that's my opinion so let's get right into it maybe creating the resource or to be calling it vectors and in here I'm going to be creating a new file I'm gonna call it under resourced I'm just creating another file and start off by going in the resource style Lua I'm gonna be in here I'm gonna be this up so in here I'm gonna be resource data low I'm gonna do a client which is my aunt Lula and in the climbed out Lula I'm going to be this you know this is what we're doing this is a client side here so I'm making I have three vectors that I am using for this it's like my spawn radius so like we don't have to walk around and find it I'm a copy and pasted from the github so this is where these are this is basically what it is what like the things that I made just for this video so we start off with vector one this first vector that we made I just called it v1 as a variable and this vector vector 3 is a it's a function I don't know if it's a native the Lulla function I think it's just part of 5m but this vector 3 means it's a 3d vector and of course three parameters so as you see over here I have three parameters that's set at the airport this vector - I did a 2d vector which just has two two points and vector three as it's four d four points and it's you know in the airport so we're gonna be using these three vectors for what we're doing here so let's start off with using the second vector we're gonna be we're gonna be using that I'm going to show you how to actually use it for creating a blip so it's create a blip I'm gonna call this create a variable called okay blip which is equal to at and then we're gonna be used since we're using this one I'm gonna get rid of these comments we're using the second one second also actually use the data from in here we just do v2 dot X and then v2 so we have it's it's using vector two x coordinate and vector two's y-coordinates and then we have to actually you know show it on the screen so and this is the setting B blep the blip type set blip sprite using this variable and then I have an ID that I picked out three six four I'll tell you where to get these IDs from its from the docs dot five and gotten that slash game references blips right here I'll put this link in the description below you can choose any one you want I just picked 364 which is just an X so yeah and then we have to also do set blip display you could also put this on on function I just I'm gonna do six which just shows that blip display displays it on the mini-map and the main menu map so that's that and then we have to do set scale set how big the blip is 0.9 do begin X sorry about that and actually get a charge begin text command spring or actually the context command set there should be a string type and then we type in and a new keyboard by the way it's actually new it's from before a long time ago keep pulling that string I just want to make sure I spelled this right I'm sorry okay yeah that's felt right and they took my cell phone because I don't really feel like going back and yeah that's all good so now we have to do and text actually just like I said you could put it on one function just do it like that but this is how I found it to do it and now we're gonna be using vector full art of the vector for which is the third vector I'm gonna be showing you how to use that so I'm just gonna do a register and call it teleports TP function you might need the source and then so in here I'm gonna do set entity to the towards player and T function this native works by just gonna teleport you somewhere so if you got I'd do the club for the person as the first parameter and since we're using vector three we just do vector three dot X vector 3 dot Y vector three dots as the three parameters and then you just need a true I forgot the reason but I know the fat last one was to like clear the area or something I just have that false you can search up this native right here from the github that link right there it'll be in the description so and the other one to use the W the vector for this protectors for dimensions so we're going to using this data right here so to do that we just do set entity entity heading which we're using the last dimension force we got to do player NID vector three dot W because it's XY z-- this is X Y Z W X Y Z and X Y yeah that's that's that that's using that now I'm going to show you how to do 3d text using vectors so this one this one takes a while so I'm gonna I'm gonna showing you to copy a market right here you got a copy from the line 54 or from 33 to 50 for this is where I got it from this link right here it wasn't working at first he just put it in I don't know how he got it but yeah I got it to work so I just used his code so shout out to mix 0 but I'm just gonna be using this code in this video because it's uh it wasn't working for him but I yeah I got it to work for myself so I'm gonna do I'm gonna copy that into there and then now in here I'm gonna be creating a thread citizen dot eight function did we have to do a while true loop here and this loop every time we have to do you guys know how it works no wait so in here we're gonna be checking this basically we're gonna be it let's actually first draw the text 3d text so right here as you can see up here this requires four parameters X Y Z and the text so in here we're gonna be doing X Y Z so we have already a vector here that says we're using vector one because it only has three dimensions so literally all you got to do is just type in and then comma test and yeah so it's gonna be actually when you run this it'll just be showing everywhere like it'll it'll be in that direction where it is like it's kind of hard to confuse it's a little complicated but this 3d text will be showing everywhere so we have to be showing if if the distance between you and the 3d text is distance between here and you is far like far enough it'll disappear but if it's close by you'll see it so we're actually going to using a function that's made for made for checking the distance between two vectors so it's called it's called if we're gonna be using like this so the just two reasons to because it's a function it's like a faster function apparently when I was doing research on it but it's just a faster function so this this fungus the distance between two vectors like efficient manner so we have to check the distance between two vectors to do that it requires six parameters if I the math is right there six parameters so sketching at one XYZ and then another XYZ but the thing is with vectors all you got to do is have probably gonna make a variable here I'm gonna call local player or is equal to table actually waiter you need to do that it's just that actually we don't even need to do that either I think I'm just making it complicated just type in get entity chords and I were just doing player pet ID that's the first parameter for this feed is native this is sending out one vector right here which is three data sets and then we're checking vector one which is our first vector right here we're checking the distance if it's like constantly in this loop I'm not doing a good job explaining it but I'm sorry about that I'm trying my first so we have to check if the distance between the player and the first vector up here is less than let's say what I did 5,000 now this is 5,000 units I don't know the exact real unit for it but like it's just that it's just 5,000 so or I mean it's just I'll show you how works out but I just do any print I'm gonna do print just so you guys see like how it works it's gonna be always printing that's it that's that so now I'll see you guys in game and see if this works mistake I think it's because this is just not how the function works so in here we just have to do what's called you can either change the function to allow to have a vector but this just has three parameters and I was stupid for thinking you just fit right in I could have made the function to do that but I just I just didn't it just be a lot better if I just did it like set a fee one we do me one that X just sail along in here you could see the test is right there when I was it's gonna spam output you can see how far away you are from the vector so I move a little farther away as you can see it's a thousand to a point where I go to like let me get like a little far you could see it disappears you can see in here it's five thousand where five thousand nine you want to move a little back or four thousand so that's just basically this I don't know what the exact unit is but I'm sure you can do something for the flip you can see that the blip and says do not enter right there using that look and we use that vector to show that it's right here in this exact place which is like a little far away but that's how you use 3d 3d texts and vectors and yeah hope you guys enjoy the video these videos take a long time to make kinda and you know I got other stuff to do you know I appreciate if you like the video subscribe and yeah sorry about that a little error but yeah hope you guys enjoy the video and I'll see you in the next one
Info
Channel: Jeva
Views: 57,587
Rating: undefined out of 5
Keywords: Fivem, zua, fivem scripting, fivem coding, fivem lua, how to code, lua, gta v modding, gta v scripting, gta 5 scripting, gta 5 modding, fivem roleplay, fivem rp, fivem js, learn fivem code, fivem LUA, vectors, lua vectors, gta 5 vectors, gta v blips, blips, 3d text vectors, 3d text
Id: Pb_kB1sDd30
Channel Id: undefined
Length: 15min 11sec (911 seconds)
Published: Wed Apr 03 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.