-
Posts
6,058 -
Joined
-
Last visited
-
Days Won
208
Everything posted by IIYAMA
-
@Looky Either: You have an error in your client code. (which stops the code from starting) Check the debug console. The clientside script isn't set in the meta.xml as clientside. (but as "server" - side or without type which is also serverside) You hit the marker before your client script has been loaded. (happens when your download transfer bar is visible) If serverside is in another resource as clientside. Both resources have to be running. Info: This line decides if the event is added or not. addEvent("startMaking", true)
-
The map editor already has this feature. https://wiki.multitheftauto.com/wiki/ProcessLineOfSight Getting the ground/floor position. https://wiki.multitheftauto.com/wiki/GetElementBoundingBox Getting the object size. The map editor already has this feature. https://wiki.multitheftauto.com/wiki/ProcessLineOfSight Getting the ground/floor position. https://wiki.multitheftauto.com/wiki/GetElementBoundingBox Getting the object size.
-
Including offset, unless you have a custom X axis position in mind which is located at for example 1/4 of the screen.
-
These are absolute values. Shouldn't you scale some of them as well?
-
Yes those are correct. If you have trouble with them. Then you could think of building utility stuff. local devScreenX = 1920 local devScreenY = 1080 local screenX, screenY = guiGetScreenSize() local scaleValue = screenY / devScreenY scaleValue = math.max(scaleValue, 0.65) function getScreenStartPositionFromBox (width, height, offsetX, offsetY, startIndicationX, startIndicationY) local startX = offsetX local startY = offsetY if startIndicationX == "right" then startX = screenX - (width + offsetX) elseif startIndicationX == "center" then startX = screenX / 2 - width / 2 + offsetX end if startIndicationY == "bottom" then startY = screenY - (height + offsetY) elseif startIndicationY == "center" then startY = screenY / 2 - height / 2 + offsetY end return startX, startY end just for the `could` float width, float height, float offsetX, float offsetY [, string startIndicationX, string startIndicationY ] print(getScreenStartPositionFromBox(400, 400, 100, 0, "right", "center")) print(getScreenStartPositionFromBox(400, 400, 0, 0, "center", "center")) print(getScreenStartPositionFromBox(400, 400, 0, 100, "center", "top")) print(getScreenStartPositionFromBox(400, 400, 100, 100, "left", "top")) print(getScreenStartPositionFromBox(400, 400, 100, 100, "right", "top"))
-
By getting your previous values:https://wiki.multitheftauto.com/wiki/GetElementAttachedOffsets With bindkey: https://wiki.multitheftauto.com/wiki/BindKey
-
https://wiki.multitheftauto.com/wiki/SetElementAttachedOffsets
-
setElementData(source, "fullName", result[1]) local name = tostring(getElementData(player, "fullName") or "")
-
Can't, as you didn't post your other function... I can't read your mind after all.
-
@slapz0r The simplest way would be using serverside element data. You can only use triggerEvents for that, if you can synchronize the fullName data from all players yourself. Server setElementData(source, "fullName", result) Client local players = getElementsByType("player", root, true) for i=1, #players do local player = players[i] local fullName = tostring(getElementData(player, "fullName") or "") end You are sending the message from the server to the OWNER of the nick name. So nobody else has this data. This requires much more code to achieve this functionality. *
-
guiSetText ( myLabel, tostring(Table[1]["fname"] or "") .. " " .. tostring(Table[1]["sname"] or "") )
-
local playerList = getElementsByType("player") https://wiki.multitheftauto.com/wiki/GetElementsByType Player names are irrelevant, the thing that matters are elements. Players are also elements. In Lua those are accessed with userdata values. Userdata's are unique values that are used as element identifiers. Take a closer look. Clientside: outputChatBox(tostring(localPlayer))
-
To define the player element, which receives the message. command: /hey So yes you don't need the addCommandHandler, if you have an alternative to define the player.
-
oh really, that is so amazing! addCommandHandler("hey", function (player) triggerClientEvent(player, "error", root) end) addEvent("error", true) function showError() addEventHandler("onClientRender", root, redline) end addEventHandler("error", root, showError)
-
triggerClientEvent(player, "error", root)
-
Yes. To be honest I do not understand why you would re-local a local variable. Neither I do agree doing that with MTA functions specific. I tested those a while ago and they were just as fast as local functions. >> For some unknown reason. (With the exception of methods: table.remove) It will always be send in order unless the connection timed out. Need a status? Latent events. https://wiki.multitheftauto.com/wiki/GetLatentEventStatus Or send another trigger event back. Yes. The handler will not accept anything else, except for itself or it's children: addEventHandler("updateTable", resourceRoot, updateTable, false) But I like to cut off those brats (children) as well and only accept the angry parent (resourceRoot). getPropagated = false Doing the same thing, else I run out of variable names... Never had any issues with it, so I am not going to change that habit.
-
"SELECT `name` FROM `123` WHERE " .. accountName .. " = `login` LIMIT 1"; You want a @slapz0r, a query perhaps?
-
local playersInJobs = { ["job-name"] = {} } table.insert(playersInJobs["job-name"], player) if #playersInJobs["job-name"] == 10 then end
-
It looks like a client/player triggered (indirect) an event which included a different player his userdata. Either a script/resource seems to fail the security rules or you actually got a hacker in your server. And yes, it is related to elementdata. Unfortunately you cut off the full reason, so...
-
It is fine, as it's fire rate is slow, just keep in mind that: - It might can create a tiny bit more lag for a player with bad internet connection. - The network message order is dominating over the others. (Faster)
-
Open the meta.xml Change the script order. 1. <script type="server" (or no type) 2. <script type="client"
-
Try to change the script order. Serverside first, then clientside. If that doesn't work then serverside has an syntax error or the script is not serverside.
-
It should be applied on the render function. The removeRenderEvent is fine as it was. The problem: <New frame> Queue start < fix should be applied here Func 1 removeRenderEvent (in func 1) Func 2 (error) Queue end
- 21 replies
-
- onclienthudrender
- onclientprerender
-
(and 1 more)
Tagged with:
-
@JeViCo There is nothing written on that file yet, not until the ? is finished. That poor creature needs a toilet and fast. https://wiki.multitheftauto.com/wiki/FileFlush
-
Agree, didn't thought about that one, but the counting up loop would still have the issue of skipping one(or more > context) of the items for that frame. The loop doesn't take into account that the index should stop increasing when an item is removed, as the array is collapsing. Would this not cover all the issues? local i = 1 repeat if a[ i ] == func then table.remove( a, i ) else i = i + 1 end until not a[ i ]
- 21 replies
-
- onclienthudrender
- onclientprerender
-
(and 1 more)
Tagged with: