Jump to content

[HELP] I have doubts about Default MTA resources


Perseus

Recommended Posts

Hello

So i'm learning lua scripting for MTA, I got some doubts, i'll be very glad if you help me answering three questions.

1) I was attempting to read and understand one of the default MTA resources, that resource is "Play", you have it in your resources folder (if you didnt removed it). There's something that is really confusing to me, in the first lines you see a variable called VehiclesToSpawn, with coords and vehicle IDs, it confuses me because there's no such functions like spawnVehicle or createVehicle, I used the vscode filter to search those functions but nothing found. This makes me think ¿for real you can use only a variable to spawn vehicles? didnt know you can use a variable like that, I thought a function is needed, for example SpawnVehicle, please I need explanation how is that possible, how just with a variable you can spawn vehicles, without functions. I tried removing all resources in the "resources" folder, except for "Play" resource, I thought maybe there's some exported function, or maybe other resource was included in the xml file, the only resource included was "Freeroam". So I deleted the line in xml to include "Freeroam", and the resource "Freeroam" ofc. But still "Play" resource still working, vehicles still spawning only with that variable? or so it seems. Explain please, it confuses me :(

2) I saw in MTA wiki some functions like getDistanceBetweenPoints3D, in the description of the resource says something about pythagorean theorem, also in some resources from the community I saw some mathematical terms like "Sin Cos Tan", and some terms that looks like algebra. Then my question is ¿do you need advanced knowledge in algebra and trigonometry to script your own server in mta?
I mean good scripts that are within the standards ofc.

And the last
3) To enable OOP you have to activate it in a xml file. But I always thought the only programming you do in mta is OOP, if its not OOP then what kind of programming is? Procedural Programming, Logical Programming, Functional Programming, Object-Oriented Programming?
how many programming paradigms can be used in mta?

Sorry for bad english

Link to comment

Greetings.

1) No, you cannot create vehicles using only variables. I am sure that information from this table is taken in some other file and vehicles are created. (function: createVehicle) 

2) I'm not very good at these things, but I'm good at my personal server

Edited by shishani
  • Like 1
Link to comment
20 minutes ago, shishani said:

Greetings.

1) No, you cannot create vehicles using only variables. I am sure that information from this table is taken in some other file and vehicles are created. (function: createVehicle) 

2) I'm not very good at these things, but I'm good at my personal server

Well its weird because as I said, I removed all resources from the "resources" folder, the only resource I kept is "Play", I removed included resources in the xml file. Idk what file could be doing it

2 minutes ago, Perseus said:

Well its weird because as I said, I removed all resources from the "resources" folder, the only resource I kept is "Play", I removed included resources in the xml file, but vehicles from the table still spawning, resource "Play" still working normally. Idk what file could be doing it.

 

Link to comment
  • Moderators
3 hours ago, Perseus said:

3) To enable OOP you have to activate it in a xml file. But I always thought the only programming you do in mta is OOP, if its not OOP then what kind of programming is? Procedural Programming, Logical Programming, Functional Programming, Object-Oriented Programming?

OOP (Object-Oriented Programming) is just a way to organize (Lua) code. Mostly used when working with a lot of entities/objects  = things.

But this option is not for enabling OOP in Lua, it is for enabling OOP in MTA (user-data).

When enabled a lot of methods will available on the user-data of players, vehicles, peds etc.

element:setPosition(x, y, z) -- MTA OOP
setElementPosition(element, x, y, z) -- non MTA OOP

Those methods are also available as functions, so basically it is an enhancement but not required in most cases.

 

3 hours ago, Perseus said:

how many programming paradigms can be used in mta?

That is irrelevant, but feel free to count.

  • Like 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...