Jump to content

question


Recommended Posts

22 minutes ago, DNL291 said:

Will not that method in pratice trigger for each player? Since client unlike server side executes for a specific player.

If using a table of player elements it works, can you explain me how the MTA internally will execute this function using a table on 'sendTo' argument?

Of course MTA has to do some sort of looping, but I'm pretty sure he wasn't asking about that, he was asking about the LUA part, where no loop is needed. 

Link to comment

Sometimes people asking for help with scripts don't have much knowledge about Lua, so it's natural for them to use wrong methods. If you're helping them, and you know the right way to do, then why are you going to do what they want? That will make it harder for yourself to help people.

Ontopic: Why he will want it without loop if it will be the same thing as with loop - will only change in code, but will do the same thing when Lua executes it. So obviously the question is about performance as well.

Link to comment

He came here asking if he can trigger to multiple players without loop, you said no, I said yes, he can. That's my perspective, but you're right, it's just a performance question, if looping through a table of players and triggering in LUA is the same as looping through the table in MTA's environment would be the same, they wouldn't have implemented the option to trigger with a table in the first place, in my honest opinion, but anyway, I think his problem has been solved.

  • Like 1
Link to comment

just a question pa3ck

doesn't this code do as your code? if not what is the problem?

cttime1 = setTimer(
function()
 local players = getPlayersInTeam ( CT )
   for playerKey, playerValue in ipairs ( players ) do
        if getElementDimension ( playerValue ) == 0 then    
		    if getElementData ( playerValue , "alive" ) == true then
            triggerClientEvent ("TimeEndRestartCT1",playerValue)
           end
         end
	end
end, 129000, 0)

its not that your code is not working... it works perfectly, but i want to know what is wrong with this one

Edited by Avagard
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...