Search the Community
Showing results for tags 'learning'.
-
Hello everyone, my name is Shay. I'm a 19 year old scripter from USA who started a good community called CoreMTA. This community is dedicated towards teaching people how to script. We also occasionally post public scripts for download on our website, which are free to download and edit. It's our goal to help the MTA community as much as possible. If you have any questions feel free to message me, email me, hit me up on discord, whatever you need. ~ ShayF Website: CoreMTA Forums: CoreMTA Forums Discord: CoreMTA Discord
-
Hello everyone, I recently started with Lua programming at MTA, for studies, I started to develop a small system, whose goal is to create items on the map. So far everything worked perfectly, so I decided to implement an event, so that I know when the player goes through an item, but it didn't work (there are no errors in the console or in the debugscript) REMEMBERING: I started recently, so anything I have done wrong besides said, or that can be improved, let me know, please. For item creation I have this, at first, everything is working here, this is on ServerSide -- Count VARS local definirItem_Count = 0; local criarItemNoMapa_Count = 0; -- Table which stores the defined items item_ID = {} item_NOME = {} -- Table which stores spawned items on the map spawnedItem_ID = {} spawnedItem_NOME = {} spawnedItem_X = {} spawnedItem_Y = {} spawnedItem_Z = {} -- Function that defines the items function definirItem(item, nome) definirItem_Count = definirItem_Count + 1 table.insert(item_ID, definirItem_Count, item) table.insert(item_NOME, definirItem_Count, nome) end -- Function that creates the items on the map function criarItemNoMapa(item, nome, x, y, z) criarItemNoMapa_Count = criarItemNoMapa_Count + 1 createObject(item, x, y, z) table.insert(spawnedItem_ID, criarItemNoMapa_Count, item) table.insert(spawnedItem_NOME, criarItemNoMapa_Count, nome) table.insert(spawnedItem_X, criarItemNoMapa_Count, X) table.insert(spawnedItem_Y, criarItemNoMapa_Count, Y) table.insert(spawnedItem_Z, criarItemNoMapa_Count, Z) end -- Item definition definirItem(1853, "Chave de Fenda") definirItem(1577, "Mala Verde") definirItem(1580, "Mala Vemelha") definirItem(1579, "Mala Azul") I believe the problem arises in clientSide, because I have this -- Timer that repeats setTimer(verificarPositition, 500, 0) -- Function called by the timer to check if the player is in the range of an item -- For that I looped up to the highest value in the table of spawned items -- And I took the X, Y and Z values from certain tables -- And if the player is in this range, trigger the event function verificarPosition() for i = 0, table.maxn(spawnedItem_ID), 1 do local x, y, z = getElementPosition(getLocalPlayer()) if(isElementInRange(getLocalPlayer(), spawnedItem_X[i], spawnedItem_Y[i], spawnedItem_Z[i], 5)) triggerEvent("onPlayerEnterItemArea", getLocalPlayer()) end end end -- Event (its not been called) addEvent("onPlayerEnterItemArea", false) addEventHandler("onPlayerEnterItemArea", getRootElement(), function() outputChatBox("CALLED") end) Any help and improvement in the code will be a great help
-
I recently dove into this simple thing called "scripting and building a server". Naturally —added to my already curious personality—, I always come up with a doubt, a question, or any sort of uncertainty. After a week of messing around with it, I noticed that 5 of the 10 last posts made in the Script section were from me. I was having so much fun —truthfully— that I just kept on finding new things to ask. I'm pretty sure they are common questions. I'm not asking to have a script from scratch, or to be taught absolutely everything. It is most commonly about errors and to help myself understand the colloquial language of the scripts. However, I can't help but think that maybe it's not the best approach. I always think to myself "try to find it on your own", but I frenquently find myself getting even more confused the more I tour into each command and function. Is there a certain tacit limit as to how many questions can be asked? Is there any way to get the necessary help without flooding the sections?
-
So, i choose MTA over SAMP recently, to start learn scripting and developing my own server. Okay... I'm reading some scripts and by them, start browsing about the MTA's integrated systems that could help me develop an amazing or at least good experience, to my self and other players. The first thing that I've been facing is SQLite. I understood that it's a language of some kind to create a database, which could have: group names with their slots and store any change related with those; Items in market with fluctuating price; Car names, colors or price that are owned by the players; Inventory system, etc... But, when i read about SQlite i noticed that there's some features that could be invasive, since it can access third-party programs or CSV files to create analysis between variables. In resume, i want to know if all assets that i could use normally with SQlite is available on MTA:SA.