
myonlake
Members-
Posts
2,312 -
Joined
-
Days Won
41
Everything posted by myonlake
-
You don't need it if you always re-create the window.
-
You can use onClientMarkerHit to detect that. -- Get the screen size (width and height) screenW, screenH = guiGetScreenSize( ) InfoCar = createMarker(-2052.3999023438, 170.5, 27.799999237061, "cylinder", 4, 255, 0, 0, 0) -- This is triggered when the InfoCar marker is hit addEventHandler( 'onClientMarkerHit', InfoCar, function( hitPlayer, matchingDimension ) -- If it was hit in the wrong dimension, or panel is already open, or the hitPlayer is not the localPlayer, we stop here if ( not matchingDimension ) or ( isElement( carsPanel ) ) or ( hitPlayer ~= localPlayer ) then return end carsPanel = guiCreateWindow(10, (screenH - 372) / 2, 836, 372, "Car", false) gridList = guiCreateGridList(10, 29, 669, 287, false, carsPanel) column1 = guiGridListAddColumn(gridList, "Model", 0.3) -- Create a new row into the grid list row = guiGridListAddRow(gridList) -- Get the current vehicle local vehicle = getPedOccupiedVehicle( localPlayer ) -- Get the name of the vehicle, and use "-" by default local vehicleName = vehicle and getVehicleName( vehicle ) or "-" -- Set the text for the created row guiGridListSetItemText(gridList, row, 1, vehicleName, false, false) end ) -- This is triggered when the InfoCar marker is left addEventHandler( 'onClientMarkerLeave', InfoCar, function( leftPlayer, matchingDimension ) -- If the leftPlayer matches our localPlayer, and dimension matches, and we have a panel open, we destroy the panel if ( leftPlayer == localPlayer ) and ( matchingDimension ) and ( isElement( carsPanel ) ) then destroyElement( carsPanel ) end end ) Tested and works fine.
-
Search script developer(scripter) for dm server (free/pay)
myonlake replied to RussianLord's topic in Scripting
People who don't know how to script and don't want to / have no time to will pay for it. That's how any entity in this world makes money anyway, by providing their expertise... Nothing wrong with buying scripts in MTA. -
Exactly. There is a meta.xml file you can edit as well... Not a big surprise people come on this forum saying half of the functions don't work when people tell them to simply delete them...
-
Does this occur only one server, or on all servers?
-
If you've updated scripts, there may be a new bug that was introduced in that commit. Make sure to double-check any recent changes to your code and revert back to a later commit if possible. It could also (very unlikely, but possible) be because of an update to the MTA server. Have you updated your MTA server recently? It is possible it broke after that. Try installing the latest update just to make sure you're running the latest version. How are your server stats looking? High CPU usage? High RAM usage? High disk usage? High network usage? Is it possible you may have been hacked and someone may have been able to crash the server by damaging the core or MTA or your scripts, or something else? Have you done changes to the firewall that would block incoming or outgoing packets? Is there any kind of throttling enabled? Are you running a reverse proxy for the MTA server – maybe there is a front-end server problem? Always try to go back in time and see what may have caused the issue. We can't really help much if you just say nothing suddenly works...
-
-- Let's define some respect levels local colors = { [ -3 ] = 420, -- Purple [ -2 ] = 435, -- Blue [ -1 ] = 480, -- Teal [ 0 ] = 510, -- Green [ 1 ] = 580, -- Yellow [ 2 ] = 605, -- Orange [ 3 ] = 670 -- Red } -- Let's make a function that returns us the color local function getRespectColor( respect ) local function wavelengthToRGBA( length, alpha ) local r, g, b, factor if ( length >= 380 ) and ( length < 440 ) then r, g, b = -( length - 440 ) / ( 440 - 380 ), 0, 1 elseif ( length < 489 ) then r, g, b = 0, ( length - 440 ) / ( 490 - 440 ), 1 elseif ( length < 510 ) then r, g, b = 0, 1, -( length - 510 ) / ( 510 - 490 ) elseif ( length < 580 ) then r, g, b = ( length - 510 ) / ( 580 - 510 ), 1, 0 elseif ( length < 645 ) then r, g, b = 1, -( length - 645 ) / ( 645 - 580 ), 0 elseif ( length < 780 ) then r, g, b = 1, 0, 0 else r, g, b = 0, 0, 0 end if ( alpha ) then if ( length >= 380 ) and ( length < 420 ) then factor = 0.3 + 0.7 * ( length - 380 ) / ( 420 - 380 ) elseif ( length < 701 ) then factor = 1 elseif ( length < 780 ) then factor = 0.3 + 0.7 * ( 780 - length ) / ( 780 - 700 ) else factor = 0 end else factor = 1 end return r * 255, g * 255, b * 255, factor * 255 end return tocolor( wavelengthToRGBA( colors[ math.floor( respect ) ] or 510 ) ) end -- Our current respect level local respect = -3 -- Let's render to see the demo addEventHandler( 'onClientRender', root, function( ) -- Rectangle with fill color dxDrawRectangle( 500, 500, 100, 100, getRespectColor( respect ) ) -- We draw the respect level dxDrawText( math.floor( respect ), 550, 550, 570, 570, tocolor( 0, 0, 0, 255 ) ) -- Increase it over time respect = respect + 0.025 -- If we're done, let's return to level -3 if ( respect >= 4 ) then respect = -3 end end ) Well, here you go, perhaps this does something of that sort.
-
There are many things you can do. Do you want him to teleport back to where he was, or be "kicked" back to where he was (flying back), or stop at the edge? Or what is it?
-
You cannot do that in MTA itself, but you can always make your own API server behind TLS 1.2 and then make that do an internal call to the server so no one has direct access to the MTA server. This way it's also easier to set up custom authentication.
-
You're welcome.
-
Nice. You're welcome.
-
You can simply do a check if the check is set. function prerenderfix( ) if ( check ) and ( check ~= 6 ) then return end -- rest of the code... end Seems to work for me, anyway. No need for the timer, by the way.
-
I am not able to reproduce this bug with the code you provided. So you're saying, it keeps on rolling even if you don't press the F5? Or what is it?
-
That won't work. Use this. function saveAdminLevel( account ) local account = eventName == 'onPlayerLogout' and account or getPlayerAccount( source ) if ( account ) and ( not isGuestAccount( account ) ) then setElementHealth( source, 100 ) setAccountData( account, 'admin.level', getElementData( source, 'admin.level' ) or 0 ) removeElementData( source, 'admin.level' ) outputChatBox( "You logged out", source ) end end addEventHandler( 'onPlayerLogout', root, saveAdminLevel ) addEventHandler( 'onPlayerQuit', root, saveAdminLevel ) Reason why, is because onPlayerQuit doesn't return an account as the first argument.
-
Well, I am unable to reproduce the error. Please see the line 936 of the codeServer_commands.lua file and figure it out.
-
Unable to reproduce either of those errors. That's some different script. There is no such thing as getAccountPlayer in that code anyway, lol. I've now tested the script twice with and without a proper account and I haven't received any errors whatsoever. Which server and client version do you have?
-
Please read the following topic so we can help you better.
-
moveObject has an easing parameter, use that to get a bouncing effect. If you want to make it completely custom (which is unnecessary), you can use onClientPreRender in conjunction with interpolateBetween and setElementPosition.