![](https://forum.multitheftauto.com/uploads/set_resources_22/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
pa3ck
Members-
Posts
1,141 -
Joined
-
Last visited
-
Days Won
7
Everything posted by pa3ck
-
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.
-
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.
-
Unfortunately MTA doesn't offer that by default, you will have to use timers here like: setPedAnimation(..., 10000) setTimer(function() setPedAnimation(..., 10000) end, 10000, 1)
-
No, you did not waste my time at all, you're welcome.
-
Well, that will only run once, you will need to call it inside a setTimer or attach it to an event, eg. when the round ends etc, but yes, whenever it triggers, it will update the table automatically.
-
That should work as long as "T" is an actual team element (you're also missing the "do" after (teamMembers))
-
Tudom, hogy ez mar jo regi topic, de ez a kod hihetetlenul csunyan let ossze rakva. Ezt 2-3 loopal is meglehetett volna oldani... probalj mindig arra torekedni, hogy a kodban ne legyen ismetles, foleg annyiszor ahanyszor ebben van..
-
No worries, it's always better if you spot small mistakes like that yourself using the built-in debug tools, but if you really can't, you can always come to the forums.
-
The best way to debug your code is to make yourself admin on your server and use "/debugscript 3", that most of the times tell you what's wrong. Try it yourself and see if that helps you. If you don't know how to make yourself admin, just search for an "acl admin" tutorial.
-
You don't need a timer for every player to check if they're alive. What I would do is create a table server side and have an "onPlayerWasted" (not sure about the correct event name now) and put the players in the "deadPlayers = {}" table and remove them at the "onPlayerSpawn" event. If you need it client-side as well, using element data would be better.
-
resourceRoot is a predefined variable, meaning resourceRoot = getResourceRootElement(getThisResource()) localPlayer = getLocalPlayer() root = getRootElement() etc... You can find the list of predefined variables here: As for the meaning, it returns all the elements associated with the current resource, not just players, but the everything as opposed to getRootElement() which returns all the elements associated with every resource.
-
That's wrong, you can trigger to multiple clients that are inside a table without using a loop. Wiki says: If you specify a single player it will just be sent to that player. This argument can also be a table of player elements. Pseudo code to achieve what you want without triggering multiple times: local teamMembers = getAllMembers() -- get list of team members local triggerTo = {} -- init an empty table for k, v in ipairs(teamMembers) -- loop through the possible team members if(isAlive(v) and whateverYouWant(v)) then -- conditions to meet table.insert(triggerTo) -- they met the conditions, put them in the table we created end end triggerClientEvent(triggerTo, "myEvent", resourceRoot ) -- use the triggerTo table as the sendTo argument Keep in mind, that's a non-working code, you can't just copy-paste it, fill in the blanks, this way you will not trigger inside the loop
-
You can see that the example above is also for cj_ped_torso, all you have to do is change the texture name to yours and that should be it.
-
If they all have the same index, there's no way you will find the exact one you are looking for. That's the whole purpose of giving the objects a unique identifier.
-
Actually interpolateBetween has 2 recursive easing types, "SineCurve" and "CosineCurve", no need for a loop or timers.
-
Just draw an image with dxDrawImage instead of dxDrawRectangle
-
Did you add the source before math.random? setElementModel( source, math.random(1,2) == 1 and getElementModel(source) or 28 )
-
setElementModel( math.random(1,2) == 1 and getElementModel(source) or 28 )
-
You're triggering for source, change it to localPlayer
-
It's not like he is developing something for NASA, but still, he might as well choose the best option available. It's a known fact that MD5 is insecure because of the collisions. "A collision is when two different inputs create the same output. As a result, maybe both "hunter2" and "password" will work on my account. That's not normally a problem, as the chance of a collision is extremely rare, but when brute forcing is applied, collisions make it much easier to crack a valid password (it might not be the same password you used, but it'll work the same).". MD5 is much faster than sha256, making it even easier to hack by brute forcing. Source: https://www.reddit.com/r/explainlikeimfive/comments/1f869t/eli5_why_is_md5_considered_the_most_secure/
-
Check how many vehicle the player has in the base HELP URGENT
pa3ck replied to Gabriel1375's topic in Scripting
At least try to comment your code next time. Dont tell me your maths teacher solved all the equations for you without explaining. -
If #result is greater than 1 it means the username and password is correct, there is data in the table. Can you show me the full code where you say login is confirmed?
-
Result is never going to be 1, it's either nil, false or a table. Try local sorgu = dbQuery( userdata_db, "SELECT * FROM `database` WHERE `USERNAME`=? AND `PASSWORD`=? LIMIT 1",username,password ) local result = dbPoll ( sorgu, -1 ) if result and #result >= 1 then