Jump to content

Platin

Members
  • Posts

    385
  • Joined

  • Last visited

Posts posted by Platin

  1. I was playing MTA back in 2010-2011. I wasn't even in middle school yet. I remember uploading some videos on my YouTube channel while playing DKR, good times. Sadly I can't log into that account to retrieve the videos anymore.

    Now more than a decade later, I might not play as I did, but MTA introduced me to scripting, which basically defined the path I would take in life.

    Regarding MTA, I'm still coding and giving my input, and I feel it's appreciated.

    Happy birthday MTA and now let's aim to get to 2033 together. 

    • Like 1
  2. Hi, let's start by defining where you should do this. I see that you have added an `onClientRender` on a server-side script file. You can't do this, because `onClientRender` will only work client-side, and will trigger every frame. You should also try to avoid using `onClientRender` to calculate this type of thing, that event is useful for rendering stuff or trying to simulate things, but because it triggers every frame it can be bad for performance.

    What you want to do is actually pretty simple:

    local listTeams = {} -- This will have all the teams, key = teamName and value = team, this will be in place in order to avoid calling 'getTeamFromName' and also will be useful to keep track of which teams there are
    local inPlayerTeam = {}
    
    addEventHandler("onPlayerLogin", root,
    	function(_, account)
    		local login = getAccountName(account)
    		setElementData(source, "tab_team:login", login)
    		local res = executeSQLQuery("SELECT name FROM tab_team WHERE login = ?;", login)
    		if #res > 0 then
    			-- This will create the teams on demand
    			if not listTeams[res[1].name] then
    				listTeams[res[1].name] = createTeam(res[1].name, res[1].r, res[1].g, res[1].b)
    			end
    			
    			setPlayerTeam(source, listTeams[res[1].name])
    			inPlayerTeam[source] = listTeams[res[1].name]
    		end
    	end
    )
    
    addEventHandler("onPlayerQuit", root,
    	function()
    		if inPlayerTeam[source] then
    			-- This will make the function stop executing if there is another player other than the one that just quitted
    			for k,player in ipairs(getPlayersInTeam(inPlayerTeam[source])) do
    				if player ~= source then
    					return
    				end
    			end
    			
    			-- If there isn't, then we will destroy the team and we will free the memory in the table
    			listTeams[getTeamName(inPlayerTeam[source])] = nil
    			destroyElement(inPlayerTeam[source])
    			inPlayerTeam[source] = nil
    		end
    	end
    )


    The teams will remove themselfs on their own if the resource stops. This should create the teams when the player logs in and they should be destroyed when the player quits. If you want a simpler version you can make this script with absolutely NO tables (except `getPlayersInTeam` and your query result) using `getPlayerTeam` and `getTeamFromName`.

    Didn't test it, but it should work just fine.

  3. 2 hours ago, Sowban said:

    Is this number available by default ? or you have to use a special method to reach it ?

    And if we have a powerful server, it is possible to support more people?

    https://github.com/multitheftauto/mtasa-blue/blob/c58c3678f263d810f61eb5aecba48e6c4b4dce0c/Client/mods/deathmatch/logic/Config.h

    Each new player that joins the server will increase the CPU usage of the server since every player needs to be synced. If you have an slow machine, bad done (or demanding) resources you could be having problems to even reach 50 players.

    Avoid element datas and calling triggerEvents with the source being root. For maximum potency you should have 4 threads of your CPU only being used for your MTA Server (since MTA has different threads for different things, one for RakNet, one for Sync, one for Logic and one for the databases).

    I don't think I have ever seen a server with more than 1500 players, and I don't think it would be a good idea either. Having three servers with 500 players each works best in my opinion.

    • Like 1
  4. 2 hours ago, Reyomin said:

    In addition, by making the resource I wanted to demonstrate that ped scripting is not really that hard, and encourage more people to try it, hoping that after a while we would have more ped/traffic resources. That didn't come true to the extent that I was hoping xD

    Well, there is a freeroam that made their own version of the traffic system + police and gangs. And I think there is other server that also has an NPC system but I am not so sure about it. Because of the developer of Prime Freeroam things like doing enter_exit on peds is now trivial, when before it needed to be scripted.

    Maybe the reason for these systems not being more popular is because they are not open source and are very hard to create (or time consuming) / are great performance destroyers for some users.

    Anyway, if you are motivated then go for it, a lot of people would probably appreciate it and maybe even use it on a moderate scale. Who knows.

    • Like 2
  5. 8 hours ago, Reyomin said:

    yet the fact that everyone's focused on my work that still wasn't satisfying enough to myself, gives me this unpleasant feeling that I gotta clean up this mess, gotta finish the work I once started

    Everyone thinks about their past work like this sometimes. It just means that you got better over time and that you are more experienced. There is nothing wrong about it. Of course it would be nice to see you working again on great MTA:SA Resources, but please don't feel pressured to do so.

    • Like 1
  6. Hi everyone!

    I am Platin, the owner and creator of Proyecto Mila, a gaming community with over 90.000 members on our forums, 10.000 members on Discord and one of the most actives player-bases in Latino America. Our flagship server is our Roleplay on MTA:SA. I am the only developer for that server, but we have another developer that helps us with our Website and with our widgets.

    I have been trying to contact an experienced modeller since the beggining of this year to work on some projects. We do want to mantain the GTA SA experience, so all work needs to be Low-Poly. We have a lot of things that we would love to work on. You don't need any scripting experience for this work, since we will manage that ourselves.

    These are a few things we want to work on:

    • We want to "open" some buildings, specially a Bank. Mapping the interior is optional, we can manage that on our end.
    • We want to create some special peds that will work with shaders to make a "custom clothes" system.
    • We want to add new islands outside the mainland.
    • We want to add new furniture and objects.
    • We want to add some custom interiors (in the interior world).

    We will pay you for each model you give us, and you don't need to make any compromise with us. Before you start, we would like to see some of your previous work. The models created NEED to be GTA:SA styled and they NEED to be optimized. Also we won't accept any model that has Vertex Colour problems (bright models that burn retinas).

    You won't need to crunch in order to meet a deadline, as I said you won't need to make any compromises. If you decide to work with us, and then you just don't want to do it anymore, we will understand.

    Our unique payment method is Paypal, sadly we won't do any bank transfers. You can discuss with us which amount you ask for your model, and we will tell you if we are interested or not. The model bougth should also come with at least an .obj file and some textures. We would like to test the model first and see if it works and if it's what we are looking for. I can assure you that we won't use any model that you don't want us to use.

    Once the model is bougth it will be ours and you won't be able to share it. We will credit your work on our patchnotes and on our credits, and if our project becomes Open-Source we will also add your credits there. We won't take credit for creating the model, but you need to understand that we won't pay for it only to become free afterwards.

    If you are interested contact me via Discord Platin#8049. I would really appreciate if you could contact me before hand, specially if you can comment on this thread. I have a lot of friend requests so I can't really known who wants to work with us and who just wants to insult me on DM. I am on the MTA Discord Server if you want to ping me before sending a request.

    We can discuss about the models and everything else on the DMs.

     

    Thanks for reading and if you are interested don't be shy and talk to us.

    Platin,
    Proyecto Mila.

    PS: I do speak spanish, so we can use that languague if you struggle with english.

    • Like 1
  7. Good job Patrick, this resource will hopefully help a lot of new scripters.

    I had found a problem tho, this resource won't note changes between interiores (i suppose thats because there isnt and event called "onClientElementInteriorChange") and the object will be left behind in the other interior, even when the dimensions change. It would be nice if you could address this issue.

    Thank you!

  8. On 01/01/2021 at 13:05, Tut said:

    In the past I haven't had luck with vehicle upgrades, and I believe @Platin - xNikoXD had problems with vehicle upgrade shaders too.

    Perhaps if he sees this he may be able to weigh in

    Wow, such great memory Tut.

    The problem with my shader wasn't that I was unabled to get the texture of the spoiler or something like that, my problem was that creating a model that is used by the game as an spoiler or any other upgrade part, and then trying to add a shader that changed their texture would result in the upgrade just looking black. The shader was working because I could change any other object, but not any upgrade. The upgrades where created by createObject() and attached, but even without being attached the shader did not work.

    I don't recall exactly what was the issue tho (ig because i couldnt fix it). These are the discord messages I sent a while back: 
    https://discord.com/channels/278474088903606273/278520948347502592/627289056317014046
    https://discord.com/channels/278474088903606273/592477067766136833/725228749997473842

    TL;DR: Sadly I don't think this is related to my problem, it's probably an error with trying to get textures as Dutchman commented.

  9. Tbh is a big let down for a lot of RP users that are coming to MTA. Most of them are familiar with .asi and mods and have a lot of them in their game. The most popular it seems is modloader so they don't have to edit their gta3.img and replace the original files. It would be nice if on 1.6 it could be possible to let the servers decide fully if they will allow asi modifications or not. I know this isn't feasible or even necesary, specially bcuz the anticheat could be compromised with this, but it would be a nice thing to think about. Even better it would be to just accept certain .asi modifications based on their hash, but yeah.

    Maybe we could get a modloader type thing on native MTA? who knows

  10. Never, really never never never element datas if you will edit them every frame, you will just lag the client (and if synced) the entire server.

    The above code is ok, but I would personally make this changes:

    addEventHandler("onClientRender", root, function()
    	-- Using getElementsByType("player", root, true) instead of getElementsByType("player") will give us only the users that the client is streaming in
    	local rTable = difference(getElementsByType("player", root, true), my_player_list)
    	
    	-- This would be the same for the entirety of the frame, you don't need to update it for every player, so just let it seat outside
    	local px, py, pz = getCameraMatrix( )
    	
    	-- We should use ipairs, because our table is indexed properly, this should decrease usage of... cpu? ig
    	for i, v in ipairs(rTable) do
    		-- i don't know why you have this check here, but if you want to check if V is an element, use this:
    		if isElement(v) then
    			local tx, ty, tz = getElementPosition( v )
    			local dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 )
    			if dist < 60.0 then
    				if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false, localPlayer) then
    					local sx, sy, sz = getPedBonePosition( v, 6 )
    					local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.2 )
    					-- You shouldn't store variables if they won't vary, if possible ofc
    					if x then
    						dxDrawBorderedText( string.gsub ( getPlayerName ( v ), "#%x%x%x%x%x%x", "" ).."", x, y, x, y, tocolor(getPlayerNametagColor(v)), 1.1, "default-bold", "center", "center" )
    					end
    				-- If you return here, you won't be drawing anyone else if the check fails
    				end
    			end
    		end
    	end
    end
    )

     

  11. I don't quite get why your ranking system does not work, maybe you forgot to set anything to the element data "level" and its giving you an error because you are trying to compare a boolean with a number?

    Anyway, i made this mess, have fun trying to understand it, I hope you can

    exports.scoreboard:addScoreboardColumn('Rank')
    
    local ranking_table = {
    	-- You would need at least level 1 to unlock this rank
    	-- This table stores itself like this: {minimum level to obtain the rank, the name of the rank}
    	{1, "Noobie"},
    	{5, "idk"},
    	{10, "just put your ranks in here"},
    }
    
    function onSpawn()
    	-- When you spawn, your current lvl would be stored in this variable, so we can check it later
    	local lvl = getElementData(source, "level") or 1
    	
    	-- Then we will "travel" arround the table until from the last index to the first (in this case from 3 to 1)
    	-- until we find that a rank requieres the same or lower level to adquire, so we set that to the player and we
    	-- stop checking the table using break (some programmers/scripters would say that using break is a bad practice
    	-- but w/e)
    	for i=#ranking_table,1,-1 do
    		if raking_table[i][1] <= lvl then
    			setElementData(source, "Rank", ranking_table[i][2])
    			break;
    		end
    	end
    	
    	-- This should work just fine, but i didn't test it so, idk
    end
    addEventHandler("onPlayerSpawn", root, onSpawn)

     

×
×
  • Create New...