-
Posts
1,060 -
Joined
-
Last visited
-
Days Won
9
Everything posted by Addlibs
-
The easiest solution would be to inverse the order which you are collecting from the database by appending ORDER BY x DESC/ASC (replace x with the column name for whatever it is you want to sort by, whether that is ID column or date-added column or whatever.
-
width = endX - posX height = endY - posY endX = posX + width endY = posY + height -- where -- posX and posY refer to the top-left coordinates, and -- endX and endY refer to the bottom-right coordinates -- as passed into dxDrawText.
-
addEventHandler("onVehicleEnter", root, -- when entering any vehicle function (player, seat) if (seat == 0) then -- as the driver, if (getVehicleEngineState(source)==false) then -- check if the engine is off setVehicleEngineState(source, false) -- and keep it off end end end ) This should work so long as the getVehicleEngineState returns the state right before the game starts the engine automatically... If this is not the case, your only recourse is to try a table or element data to store the engine states of every car, and force that engine state when a player enters it (changing the data or table value when engine is manually toggled).
-
Try the same code but with exitVehicle instead of enterVehicle on the event handler on 13th line.
-
You should try (not sure if it'll work for remote events) addDebugHook - hook it up on onLoadedAtClient for pre-event and output the resource, file and line number where it occurs.
-
If you send the data before the server turns off (onResourceStop - unless it crashes, in which case I don't know if it will work) - assuming the MySQL server doesn't get turned off or crashes before, I think it should all safely save.
-
I'm pretty sure if you use LIMIT 1, it won't have a very significant impact on the server (since it will stop looking through the database as soon as it meets first match).
-
He just wants to remove the gates, not the whole fence. The gates are part of the fence, so "hiding" anything would mean hiding the gates as well as the whole fence, which is not what he wants. @Gabriele01 You can only accomplish this goal by removing the fence from the actual model using a 3D model editor like 3Ds Max, importing from and exporting to DFF/TXD with Kam's script or something like that.
-
For the first error, is killmessages/utils/textlib.lua in the meta.xml? That file contains the dxText library which it appears you do not have. (if you don't have that file, you can get it from here: https://github.com/multitheftauto/mtasa-resources/blob/master/[gameplay]/killmessages/utils/textlib.lua) The second error is a result of a table not existing (contentMessages[line], where line is the ID of the line to remove, I believe). This could just mean you passed a wrong ID, and the data for that ID does not exist.
- 1 reply
-
- killmessages
- error
- (and 4 more)
-
-- client addCommandHandler("fly", function() triggerServerEvent("access", localPlayer) --ask server for access end ) addEventHandler("onFlyGranted", localPlayer, function() flyEnabled = not flyEnabled --invert flyEnabled setWorldSpecialPropertyEnabled("aircars", flyEnabled) --set aircars to the new, inverted flyEnabled end ) -- server function flyAbility() if client then else return false end --make sure that the event was properly called (see https://wiki.multitheftauto.com/wiki/Script_security#Validating_client_triggerServerEvent) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(client)), aclGetGroup("Admin")) then -- if authorised triggerClientEvent(client, "onFlyGranted", client) --tell client to change flyEnabled and aircars property end end addEvent("access", true) addEventHandler("access", root, flyAbility) --catch client's requests for authorisation
-
Line 6 should be getPlayerName(targetPlayer) while all the other targetPlayer can remain as they are.
-
By running the code with runcode, I meant use the console command /run (or /srun), followed by that code. /run ACLGroup.get("ACL GROUP NAME HERE"):addObject("user.ACCOUNT NAME HERE") Make sure runcode is running (if it isn't, or you're unsure, just /start runcode)
-
This would mean that in the command, you've entered a value that couldn't get converted into a number (tonumber) and thus was converted to a nil value, which failed at math.abs.
-
Maybe getElementParent, not sure.
-
You can use runcode from the server console, and run the following code (however, both resource.runcode and user.Console must be in a privileged group like Admin for this to work) ACLGroup.get("ACL GROUP NAME HERE"):addObject("user.ACCOUNT NAME HERE") (this should work if runcode has OOP enabled.)
-
I suppose a successful way to detect misuse (or unauthorised use) is to regularly (but not too often to avoid overloading the server, especially at high player counts) monitor the element data superman:flying of all players server-side, and if someone appears to have this data set to true without meeting the criteria (i.e. wrong team), issue a ban or inform an admin to investigate the situation.
-
@koragg's code omits a necessary 'end' between the lines 19 and 20. The correct version, plus additional functionality to bind the key to people already connected (not those who join after the resource is running) -- Bind the key here for every player as soon as he joins your server. function bindKeys() bindKey(source, "j", "down", "jp") -- bind key to command 'jp' so that the bind can be changed in MTA settings > binds end addEventHandler("onPlayerJoin", root, bindKeys) -- Bind the key here for every player already connected to your server. for k, v in ipairs(getElementsByType("player")) do -- loop through already connected players bindKey(v, "j", "down", "jp") -- bind key to command 'jp' end
-
local random = math.random(1, 3) --change as appropriate if random == 1 then --random action, e.g. give weapon elseif random == 2 then --random aciton, e.g. give health elseif random == 3 then --random action, e.g. give armor --add more as appropriate end
- 2 replies
-
- 1
-
- math.random
- random
- (and 7 more)
-
The line that this error message is not included in your script snippet. Please share the part with dbPoll if you want our help.
-
There are keyboards which may not have the backquote (`) key, such as the Italian QWERTY keyboard (according to Wikipedia), which is why the console key is also bound to F8, and as far as I know, you can't change it... However, you could try to cancelEvent() onClientKey, but I doubt if that'll work.
-
You can do the same calculations in the onClientClick event as you used in render, to find where the positionX and positionY are. --onClientClick local positionX,positionY = getScreenFromWorldPosition(x,y,z)
-
Use event onClientClick, and check whether absoluteX, absoluteY are in DX rectangle's region. if ( absoluteX >= positionX and absoluteX <= positionX + width ) and ( absoluteY >= positionY and absoluteY <= positionY + height ) then -- clicked on the rectangle. -- don't forget to check whether its a LMB click or RMB, and whether it was pressed or released. end