-
Posts
1,193 -
Joined
-
Last visited
Everything posted by tosfera
-
First of all, you don't need that kind of loop in this case because you can do it easier. Sure, there is a way how to do it that way and it's at the bottom of this post. We'll take a look at the 'in ipairs' loop. I'll also explain what it's actually doing, just in case; for i, account in ipairs ( getAccounts() ) do outputChatBox ( getAccountName ( account ) ) end There are two variables in this one; i and account: I is the index of the loop, this can bse useful for everything but you can also blank it out now because you aren't using it. ( Blank it out with a '_' like: for _, account in ) account is the actual account from the table getAccounts(), you can use this for everything. If you still want to use the for i = 0, #getAccounts do then you should do this; local accounts = getAccounts() for i = 0, #accounts do outputChatBox ( getAccountName ( accounts [ i ] ) ); end 'accounts' is a table holding all the account elements, you have to get them out at the specific location by using the index ( i ).
-
If you really want to do it like this; client locks -> server request to lock and play the sound -> client request for the sound. You should create a createColSphere with the desired size and get all the elements in there with getElementsWithinColShape. Loop over these and make them all do a triggerClientEvent() to the sound function.
-
getVehicleTurretPosition has the following example: local vehicles = getElementsByType ( "vehicle" ) -- Loop through the vehicle list for vehicleKey, vehicleValue in ipairs(vehicles) do -- Get the vehicle's turret position local x, y = getVehicleTurretPosition ( vehicleValue ) -- Convert the positions to degrees, as that's much more useful if you'd want to output it x = math.deg ( x ) y = math.deg ( y ) -- Get the vehicle's name local vehicleName = getVehicleName ( vehicleValue ) -- Tell everyone in the F8 console the turret's position outputConsole ( vehicleName .. "'s turret rotation: " .. x .. ", " .. y .. "." ) end Once the script starts, it'll tell you the rotation of the turret ( the gun on a tank, etc ). However, this will give you errors if the vehicle isn't equipped with a turret.
-
Sounds like you have a dynamic IP address. You'll need to make that a static one or get yourself some weird settings so it opens for all of your ip's. I'd rather get yourself a static ip.
-
Are you sure that 'source' is the current player you want the data of? Because I can't find the output in your script.
-
If your client sided file has a variable storing the export, your problem will be there. Like TAPL said: This is also the case if you restart resource1, but resource2 still has the variable stored. The stored variable will be called to a wrong resource ( these ID's change as far as I know ). A simple way to fix this is to replace all the stored variables and just use; exports["resource-name"]:function()
-
Daar leren ze als goed is geen lua. Dus nee, voornamelijk zelfstudie. Sorry om de droom te verknallen, op een ICT opleiding leer je geen programmeertaal. Je leert documentatie maken ivm nieuwe projecten ( advies rapport, oriëntatie, definitie, plan van aanpak, functioneel ontwerp, technisch ontwerp ). Als je echt wilt leren programmeren / scripten; Ga het zelf leren, blijf van die scheve opleidingen alsjeblieft af. Ik heb de zelfde stomme fout gemaakt en heb 4 jaar van mijn leven weggegooid... Dit is gewoon het beste om mee te beginnen.
-
IIYama is right, if Resource1 shows the cursor you're going to have a hard time hiding the cursor with a script in Resource2. In fact, What IIYama already told you. This is impossible, every resource has their own cursor and is unique. You can't hide it without permission of the other resource. To make this a little simplier. If Kid1 has a piece of pie, Kid2 is not allowed to take that pie. If he does, he's a thief. MTA protected this and won't allow theft.
-
You aren't doing any call to the client side to show the image. After the outputChatBox() add a call to the clientside to show the image.
-
There are a few deathtraps in your code, first off: Always add this under the function() line, so you are avoiding unnecessary steps your server is doing. if source == getLocalPlayer() then Second, if you fail to set the data as a number you'll get a nice little error that you're trying to compare strings to ints, use tonumber ( getElement... if getElementData(getLocalPlayer(), "2Rnd. Slug") > 0 then Third, almost the same as second, it can create a lot of unwanted errors setElementData(getLocalPlayer(), "2Rnd. Slug", getElementData(getLocalPlayer(), "2Rnd. Slug") - 1) Last off, are you calling this function with triggerClientEvent / triggerEvent? If not, check what your source is.
-
A: In my eyes, they are 90% the reason why people are fighting or having wars... :\ Q: Coffee or Tea?
-
Massive Cash Reward (200 gbp) MTA Dev's read please.
tosfera replied to codeluaeveryday's topic in Suggestions
Can you tell me something, why won't this happen? Because you, and maybe other MTA devs don't want to do it or because it's impossible? I think nothing is impossible. If you don't want to do it, say so. Maybe there are some small unknown devs out there that do want to try it? -
You are using this line without defining 'ply' if(getElementType(ply) == "player") then an easy fix is to add 'ply = ply' in your 'loc' function, make sure to reset it too. just like the tox and toy.
-
addEventHandler ( "onVehicleStartExit", getRootElement() function ( thePlayer ) cancelEvent() end )
-
Maybe it's useful to add something about the Cubieboard 3 or a Raspberry-pi, I would go for the Cubieboard 3 because it is twice as powerful as the raspberry-pi and it doesn't use a lot of power. 5v if I'm right, all you need in a lan-cable in his butt and use a terminal to install it. It's a great little snippet but I'm not sure how it will last for bigger servers. The ram is limited...
-
the mysql module returns the value in less than 1s, I haven't had any trouble with retrieving data. but I'm not sure how the built in db functions are handeling complex queries...
-
As far as I know, one of the MTA contributors is already working on the server sided part of GTA V. Everything except the connection to the game itself is done, but he could do this in one week, and I believe him. I've seen him work and I can't wait until he finishes it when GTA gets launched.
-
Hey guys, I've actually been avoiding to use the built in SQL functions because when I didn't use mysql yet ( which is a long time ago! ) that the dbPoll function takes more time and also might freeze your server. Currently I'm using the mysql module which is outdated and very unsafe to use but I think I made my way around to keep it protected and such. To get to the point, I'd like to hear your thoughts about the pros and cons of the mysql module and the built in mysql system ( dbPoll, dbConnect, etc ).
-
I think I would need more of those repairs in this map... nice work!
-
I have to say, you got me curious about the movie. Gotta download it sometime, great work here bud! ^^
-
this part is quite an overkill; function assignVehicleToTimer() for i, v in ipairs(getElementsByType("vehicle")) do vehicleTimers[i] = 0 end end addEventHandler("onResourceStart", resourceRoot, assignVehicleToTimer) just check if there is something filled in for the vehicle as an element. If so, there is an timer ( also check if the timer didn't run out of time etc ). You did so in this part; function startTimerOnVehicleExit(thePlayer, theSeat, theJacker) if theSeat == 0 and not theJacker then if not isTimer(vehicleTimers[source]) then vehicleTimers[source] = setTimer(respawnIdleVehicle, 10*6000, 1, source) end end end
-
Thanks everyone, will be creating another one soon for the Beta launch of AG. ^^
-
Thanks! (:
-
Hey guys, Just wanted to get some feedback on my first project in Adobe After Effects, hope you guys like it! (:
-
People are right, the getPlayerName ( p ) should be getPlayerName ( thePlayer ). Another thing, make sure the player is logged in. Else it'll just not work. Sorry for the typo's with function and the p, lmao.