Jump to content

Shady1

Members
  • Posts

    840
  • Joined

  • Last visited

  • Days Won

    56

Everything posted by Shady1

  1. run mtadiag, and send to me pastebin/xxx link https://mtasa.com/mtadiag
  2. MTA tarafındaki bir çok host tarafını denemişimdir ancak şunu söylemeliyimki testlerim başarıyla gerçekleştirildi ve harika bir host sağlayıcısılar, benim tavsiyem sizlerinde bir göz atmasındır.
  3. Lua Metatables Guide Introduction Hello, I’m Shady, and I’m here with a new tutorial. At the bottom of this section, in the credits, you will find all the links to my other tutorials. Those should be your first priorities. I have prepared a tutorial that will help you explore metatables at an advanced level and set you on your way,The Lua programming language has gained popularity for its simple yet powerful syntax, making it a common choice for both game development and general-purpose programming. This guide will enable you to delve deep into the metatable feature of Lua and demonstrate how to apply object-oriented programming (OOP) concepts using metatables. Metatables are used to customize the behavior of tables in Lua and manage complex data structures. In this guide, we will focus on the following topics: What is a Metatable?: We will understand the concept of metatables and why they are used. Creating Classes with Metatables: We will create a simple Vector class and explore operator overloading methods. Inheritance: We will learn how to implement inheritance and override functions using metatables. Complex Scenarios: We will create more complex structures, such as a character class, using metatables in real-world applications. By the end of this guide, you will learn how to effectively utilize metatables in Lua, enhancing the functionality of your games or applications. So, let's step into the world of Lua metatables! What is Metatable? A metatable is a special table used to change the behavior of tables in Lua. With a metatable, you can inherit between tables and perform special operations. Creating Metatable... First, we need to create a metatable. We can define it as a simple table. myMetatable = {} Using Metatable in a Table To assign a metatable to a table, we use the setmetatable function myTable = {} setmetatable(myTable, myMetatable) Operator Overloading with Metatable Metatables can also be used for operator overloading. For example, let's define the __add function for addition. myMetatable.__add = function(t1, t2) return t1.value + t2.value end Adjusting the Values of Tables We can use the __index and __newindex methods in the metatable to set the values of tables. myMetatable.__index = function(table, key) return "Key not found: " .. key end myMetatable.__newindex = function(table, key, value) rawset(table, key, value) end Example of Use myTable.value = 5 local anotherTable = { value = 10 } setmetatable(anotherTable, myMetatable) local result = myTable + anotherTable print(result) -- 15 Metatable and Mapping Functions Metatables are used to provide functionality and inheritance relationships between tables in Lua. With special keys provided by the metatable, we can map between tables. Operator overloading functions like __index, __newindex, __add, and __sub allow us to change the behavior of tables. An Example in Depth: Vector Class Below, we will create a Vector class. This class will support addition, subtraction, and other vector operations. -- Creating the vector metatable Vector = {} Vector.__index = Vector -- Create a new vector function Vector:new(x, y) local vec = setmetatable({}, Vector) vec.x = x or 0 vec.y = y or 0 return vec end -- Vector addition function Vector:__add(other) return Vector:new(self.x + other.x, self.y + other.y) end -- Vector subtraction function Vector:__sub(other) return Vector:new(self.x - other.x, self.y - other.y) end -- Calculate vector length function Vector:length() return math.sqrt(self.x^2 + self.y^2) end -- Usage example local v1 = Vector:new(3, 4) local v2 = Vector:new(1, 2) local v3 = v1 + v2 print("Sum Vector:", v3.x, v3.y) -- 4, 6 print("Length of Vector 1:", v1:length()) -- 5 Metatables control the operations listed next. Each operation is identified by its corresponding name. The key for each operation is a string with its name prefixed by two underscores, '__'; for instance, the key for operation "add" is the string "__add". The semantics of these operations is better explained by a Lua function describing how the interpreter executes the operation. add": the + operation. The function getbinhandler below defines how Lua chooses a handler for a binary operation. First, Lua tries the first operand. If its type does not define a handler for the operation, then Lua tries the second operand. function getbinhandler (op1, op2, event) return metatable(op1)[event] or metatable(op2)[event] end By using this function, the behavior of the op1 + op2 is function add_event (op1, op2) local o1, o2 = tonumber(op1), tonumber(op2) if o1 and o2 then -- both operands are numeric? return o1 + o2 -- '+' here is the primitive 'add' else -- at least one of the operands is not numeric local h = getbinhandler(op1, op2, "__add") if h then -- call the handler with both operands return (h(op1, op2)) else -- no handler available: default behavior error(···) end end end "sub": the - operation. Behavior similar to the "add" operation. "mul": the * operation. Behavior similar to the "add" operation. "div": the / operation. Behavior similar to the "add" operation. "mod": the % operation. Behavior similar to the "add" operation, with the operation o1 - floor(o1/o2)*o2 as the primitive operation. "pow": the ^ (exponentiation) operation. Behavior similar to the "add" operation, with the function pow (from the C math library) as the primitive operation. "unm": the unary - operation. function unm_event (op) local o = tonumber(op) if o then -- operand is numeric? return -o -- '-' here is the primitive 'unm' else -- the operand is not numeric. -- Try to get a handler from the operand local h = metatable(op).__unm if h then -- call the handler with the operand return (h(op)) else -- no handler available: default behavior error(···) end end end "concat": the .. (concatenation) operation. function concat_event (op1, op2) if (type(op1) == "string" or type(op1) == "number") and (type(op2) == "string" or type(op2) == "number") then return op1 .. op2 -- primitive string concatenation else local h = getbinhandler(op1, op2, "__concat") if h then return (h(op1, op2)) else error(···) end end end "newindex": The indexing assignment table[key] = value. function settable_event (table, key, value) local h if type(table) == "table" then local v = rawget(table, key) if v ~= nil then rawset(table, key, value); return end h = metatable(table).__newindex if h == nil then rawset(table, key, value); return end else h = metatable(table).__newindex if h == nil then error(···) end end if type(h) == "function" then h(table, key,value) -- call the handler else h[key] = value -- or repeat operation on it end end "call": called when Lua calls a value. function function_event (func, ...) if type(func) == "function" then return func(...) -- primitive call else local h = metatable(func).__call if h then return h(func, ...) else error(···) end end end Override and Inheritance We can achieve inheritance using metatables in Lua. By creating subclasses and using the superclass's metatable, we can override some functions. -- 2D Vector Metatable Vector2D = setmetatable({}, Vector) Vector2D.__index = Vector2D -- Create a new 2D vector function Vector2D:new(x, y) local vec = Vector:new(x, y) setmetatable(vec, Vector2D) return vec end -- Rotate the 2D vector function Vector2D:rotate(angle) local cosA = math.cos(angle) local sinA = math.sin(angle) local newX = self.x * cosA - self.y * sinA local newY = self.x * sinA + self.y * cosA return Vector2D:new(newX, newY) end -- Usage example local v2d = Vector2D:new(1, 0) local v2dRotated = v2d:rotate(math.pi / 2) print("Rotated Vector:", v2dRotated.x, v2dRotated.y) -- 0, 1 More Complex scripts Metatables can be used to model complex data structures and behaviors. For example, we can create a class representing the attributes of a game character. -- Character metatable Character = {} Character.__index = Character function Character:new(name, health, power) local char = setmetatable({}, Character) char.name = name or "Unknown" char.health = health or 100 char.power = power or 10 return char end function Character:attack(target) target.health = target.health - self.power print(self.name .. " attacked " .. target.name .. "!") end -- Usage example local hero = Character:new("Hero", 150, 20) local monster = Character:new("Monster", 80, 15) hero:attack(monster) print(monster.name .. " remaining health: " .. monster.health) -- 60 NOT : Metatables form one of the foundations of object-oriented programming in Lua, allowing you to create complex structures and functionalities. In this guide, you learned how to create classes using metatables, inherit from them, and perform operator overloading. Metamethods: metatables and metamethods offer powerful functionality that enhances the flexibility and behavior of tables. Metatables allow you to customize the behavior of tables, while metamethods are functions that define this behavior. This tutorial will explore the fundamentals of these concepts with fun and practical examples,Metamethods are special functions defined within a metatable that get triggered when specific operations occur. Credits and Additional Resources Official Lua Documentation; Explore the official Lua documentation for comprehensive details on Lua features, including metatables. https://www.lua.org/manual/5.4/manual.html#2.4 https://www.lua.org/manual/5.1/manual.html#2.8 Lua 5.1 Reference Manual Lua 5.4 Reference Manual Metatable Events https://devdocs.io/lua~5.1/
  4. ilk öncelikle merhabalar, alt-tab problem için ayarlar sekmesinden Sadece pencereli modu veya pencereli bordürsüz modu kullanmanı öneririm böylelikle sorun düzelecektir, ek olarak FPS drop ve diğer hataların meydana gelmesinin sebebi, GTA ya da MTA dosyasında modlanmış dosyalar kaynaklar görüyorum, bunun çözümü GTA ve MTA'yı modsuz temiz bir şekilde kurmanı tavsiye ederim.
  5. Shady1

    Colar #2936198459

    you have too many non-standard errors, please install gta:sa cleanly and without mods
  6. You will use an if statement with the setWorldSoundEnabled function to set it to false when the player enters a vehicle, and to true when the player exits the vehicle. You can define these conditions using an if statement. The events for controlling entering and exiting vehicles are: addEventHandler("onClientVehicleEnter", root, onVehicleEnter) -- Listens for vehicle entry addEventHandler("onClientVehicleExit", root, onVehicleExit) -- Listens for vehicle exit
  7. but remember, if you want to make a sound false you have to add the id of that sound, currently all sounds are false with the loop
  8. hello, I will send you a server and client side code for a solution to your problem, check it and continue with these codes, I have not tested it, it will work but server : addEvent("disableJetSound", true) addEventHandler("disableJetSound", root, function() triggerClientEvent(source, "disableJetSound", resourceRoot) end) client : function disableHydraSound() for i = 10000, 15000 do setWorldSoundEnabled(i, false) outputChatBox("Sound ID: " .. i .. " disabled.") end end addEvent("disableJetSound", true) addEventHandler("disableJetSound", root, disableHydraSound) function checkHydraSound() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and getElementModel(vehicle) == 520 then -- Hydra triggerServerEvent("disableJetSound", resourceRoot) end end addEventHandler("onClientVehicleEnter", root, checkHydraSound)
  9. Yes, that's why I don't continue, because I'm busy preparing 2 new projects and infrastructure in front of us.
  10. I don't know if I should develop this snake game, because I coded it at a very simple level and the UI side is at basic level as you can see, so I hesitate whether I should develop it or not
  11. a small game that I made just for fun, soon I will create a new game mode called freeroam, this will be the first in the MTA and my other project is a MMORPG game mode, I will make an announcement for these two game modes soon
  12. Shady1

    Discord Turkey

    yes, we will no longer be able to use the Discord app in Turkey, the government has banned it and blocked access
  13. Shady1

    Discord Turkey

    Discord has been blocked in Turkey, so Turkish gamers will no longer be able to access Discord. I hope this issue gets resolved soon. Anyone who wants to contact me can reach out here.
  14. I have designed a Snake game in my Multi Theft Auto project using the Lua programming language, implementing all functionalities and dynamics. Additionally, I have designed the controls to be very functional, allowing gameplay with either a keyboard or Xbox/PlayStation controllers. Here’s a link for you to watch.
  15. Your GTA:SA may be modded, for example, you may be experiencing these problems because it consists of modded files such as .asi
  16. Can you install your GTA:SA file on the Local Disc (%C) side, I suggest you to install MTA in this way as well
  17. Fade2Black Survival & DayZ v1.2 We offer you new updates of our server, as Fade2Black Development Team, we continue our developments, we are making an effort to make innovations every month, do not forget them and you should know that this project is a completely volunteer-based project. ** Chat Update** > - the chat delay and message deletion dela has been fixed, if you encounter a problem again, please create a ticket again by suggestions > - chat has a limited message reading history, to overcome this, open chat and you will be able to read some past messages, when chat is closed this limit is limited to only 5 > - Added the ability to scroll chat messages page up and page down. It also resets the scroll when the chat is closed. If you do not scroll back, you will not see new messages > - Added the ability to close the chat with Esc **Scoreboard Update** > - Titles will be given according to ranks, and in the future, in v1.3, you will have titles up to the number of zombies you kill > - flags and flag names will now be visible, pngs of country flags and names will be visible on the scoreboard. **Shader Update** > - the shader vignette issue has been fixed, now you can stick more opacity settings and see the surroundings more transparently. > - shader will look a little more effective on mask and mask type items **Zombies Update** > - the walking and running animations of zombies have been fixed, now you will be able to run away from zombies a little more. **Information UI Update** > - the design of the panel where players can get information has been completely changed, we now have a theme like in DayZ Standalone **The Ghost Valley** > - [Fade2Black Development Team] Discord : https://discord.gg/fade2black Server Address : mtasa://91.134.166.76:22013
  18. I recommend keeping your drivers up to date, many people have experienced this problem, the solution to this is to first delete the script files on the mods/deathmatch/resources side from the MTA file location and then update your video card driver, you may get font errors, I would like you to download and install GTA:SA and MTA:SA without mods.
  19. hello, your feedback for MTA makes me and mta players happy, it is a great source of pride that you learned programming and solved some algorithms thanks to mta, I hope everything goes well in your life and I wish to see better days. As a player and developer of MTA, I would like to thank you and myself for choosing MTA. best regards Shady I spent half of my life with the MTA family, like you, I was a player and software development engineer at first, then I met Lua and made an effort to examine all Lua versions, in the following days I started to provide services to MTA players as a full-stack-developer, this has been both voluntary and paid, I have a mta adventure of more than 10 years and I am happy about it, I can say that some periods are the turning point of my life.
  20. merhaba sorununuz hala varmı, çünkü pastebininizi kontrol ettiğimde çok fazla non-standard sorunu görüyorum, yani bununi çin yapmanız gereken GTA:SA ve MTA:SA temiz ve modsuz bir şekilde tekrar kurmanız gerekmektedir
  21. Fade2Black Survival & DayZ v1.1 We offer you new updates of our server, as Fade2Black Development Team, we continue our developments, we are making an effort to make innovations every month, do not forget them and you should know that this project is a completely volunteer-based project. yes I know that you said that the vehicles and loot still need to be developed continuously, but work is still in progress for this, at the moment this update is only version v1.1, I can say that when the work for vehicles and loot is finished, we will release it in version v1.2 and this will be as soon as possible NPCs > -# NPCs are placed in certain parts of the map, you can chat with these NPCs or find some clues to enter encrypted areas. Scoreboard > -# We have designed a completely recreated scoreboard where you can find a lot of information. **Fade2Black UI Info Panel added to server** > -# Main,Premium,Info,Staff sections, players have a better interface. **Los Santos ammu-nation extrainterior added to server;** > -# so that spoils can now be obtained in it https://www.youtube.com/watch?v=kT-b-rAGOhg New Caves and Passages, Bunkers https://www.youtube.com/watch?v=tpVsE2i8AaE > -# Find NPCs and get some information from them, then they will tell you the location of the cave, after finding the cave, you must do some tasks, after doing these tasks you will find the secret bunkers password, then you will be able to enter, it is very dangerous and deserted inside, it is useful to be careful > -# the encryption system is complete, you have to ask the NPCs for the passwords and combine them, then head to the locked door and enter the password, remember that once inside you will need a password to get back out, this password will be hidden somewhere in the underground bunker GameMode development notes : ### Stamina update ; > -# you can now run more and your stamina energy will be stored faster, a level system will be added in the next update stages and stamina will be regulated according to these levels ### Chat update ; > -# some of the posts on the chat side were not showing up, but we fixed that and now you could only read 5 consecutive message histories of messages on the chat side, now we've increased that to 9 so you can read more message histories. ### Vehicle update ; > -# In total 20 vehicles are placed on the map, if you ask why I placed 20 vehicles, new 15 - 20 vehicles will be added from time to time, so I wanted to make the game more enjoyable and difficult to make it feel more like survival. ### Loots update ; > -# loot has been added to many areas and loot has been added to newly built interiors, caves and bunkers ### Group system update ; > -# the group system has been improved, now you can create groups with your friends, the commands for this are written on the F8 side Fade2Black Development Team Discord : https://discord.gg/fade2black Server Address : mtasa://91.134.166.76:22013
  22. looks great a successful map
  23. https://mirror-cdn.multitheftauto.com/mtasa/main/mtasa-1.6.exe
  24. if you encounter a problem you can contact me here, good day
×
×
  • Create New...