-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
You should work with the resolution you have yourself. Since that is the only absolute measure you have when building your interface. If you have your monitor on 1280x720 and you use 1920x1080. You can't calculate width/height exactly with your own pixels. So if you want 100% of the height of your screen and you fill in 720, the output is 720 / 1080 = 0.666666666667 = ~67% height! If you did use 1280x720: 720 / 720 = 1 = 100% height! That is what we want to see.
-
You can place a tables in tables. (Note: Not literally as under the hood only a reference to the sub tables will be saved in the outer table. But that is another story...) local veh = { -- < outer table {411, 2505.1791992188, -1664.51953125, 13.391730308533, 0, 0, 90}, -- < inner tables separated by , {411, 2505.1791992188, -1664.51953125, 13.391730308533, 0, 0, 90} } And using a loop to process them all: function Vehicles() for i=1, #veh do createVehicle(unpack(veh[i])) end end addEventHandler("onResourceStart", root, Vehicles)
-
Do not use "", they are making the inner content a string. A string is a character set, which is not very handy for spawn dimensions. local veh = {411, 2505.1791992188, -1664.51953125, 13.391730308533, 0, 0, 90} Try this: local veh = {411, 2505.1791992188, -1664.51953125, 13.391730308533, 0, 0, 90} function Vehicles() createVehicle(unpack(veh)) end addEventHandler("onResourceStart", root, Vehicles)
-
You could also check if the same issue appears when the resource is zipped. That situation creates issues for the call-trace Lua debug functions. So it might be similar to this as well.
-
It could be from a loadstring environment. 'loadstring' is a function used to load a string in to code. One of the most tricky functions you can run in Lua(MTA). https://www.lua.org/pil/8.html
-
outputChatBox outputs by default to all players. You need to specify the receiver. https://wiki.multitheftauto.com/wiki/OutputChatBox
-
And what doesn't work exactly? I do not see any issues to be honest.
-
Try this: local elementList = {} function rotateobj(obj) elementList[#elementList + 1] = obj end function rotateElementsInList (timeSlice) local normalizedSpeed = timeSlice / 16.66667 -- based on 60 fps (1000 / 60) -- Other method: getTickCount() % 360 = 0 t/m 359 for i=1, #elementList do local element = elementList[i] local rotX, rotY, rotZ = getElementRotation(element) setElementRotation(element, rotX, rotY, rotZ + normalizedSpeed) end end addEventHandler("onClientPreRender", root, rotateElementsInList) local obj = createObject(1947, 193.71983, -105.13480, 1.54872-1) exports["rotobj"]:rotateobj(obj)
-
The server root is at the place where the server launcher is: MTA Server(.exe) You could rename the folder which contains the launcher, to your server name: Program Files (x86)\MTA San Andreas 1.5\server\mods\deathmatch Renaming folders deeper does not make any sense, because that is not the container of your server. > If there is for example a tree in front of you, and a leaf nearly falls off. Would you start calling that leaf also a tree? ?
-
MTA locates it's files based on folder names, if you change the folder name, MTA can't find them. Why do you want to change it?
-
You can also use this selector if you want all columns from a specific table: jobs_sys.* But it could override some of the table values, if the names are the same from the 2+ tables.
-
The alignment of the tables have to be defined. Try this: SELECT jobs_sys.uid, jobs_sys.x, jobs_sys.y, jobs_sys.z, jobs.money FROM jobs_sys LEFT JOIN jobs ON jobs_sys.uid = jobs.uid
-
Do a left (table) join. https://www.w3schools.com/sql/sql_join_left.asp This is the default way data get aligned and merged from different tables.
-
As long as you work with hashed passwords and not just encryption (decryption serverside), it should be fine. Working with real passwords (even when encrypted) is the reason why it shouldn't be done. When the 'remember me' is checked, the password field should be disabled and not be filled in. (or even the form shouldn't be showed)
-
An example: local scale = interpolateBetween(0.7, 0, 0, 0, 0, 0, progress, "OutQuad") local width, height = dxGetTextWidth(getPlayerName(v),scaleF,settings.font,true), 2*scale local imageSize = 40 * scale local offset = 40 * scale local sx, sy = sx - (width / 2 + imageSize + offset), sy-height dxDrawImage(sx, sy, imageSize, imageSize, "files/typing.png",0,0,0,tocolor(255,181,64,255)) -- no imageSize since the image is drawn from left to right local sx, sy = sx + (width / 2 + offset), sy-height dxDrawImage(sx, sy, imageSize, imageSize, "files/typing.png",0,0,0,tocolor(255,181,64,255)) Anyway, I am wondering why you use the value '350'. The image was only 40 pixels and unscaled.
-
Normally you would calculate the position like this: -- The width local textWidth = dxGetTextWidth(getPlayerName(v),scaleF,settings.font,true) local offset = scale * 50 -- Offset from the text -- Note: The text is centered!!! local positionX -- Before positionX = positionX - (textWidth / 2 + offset) -- After positionX = positionX + (textWidth / 2 + offset)
-
What about dxGetTextWidth(getPlayerName(v), 1,settings.font,true) + 270 * scale -- or if the font is scaled: dxGetTextWidth(getPlayerName(v), scale,settings.font,true) + 270 * scale for the width.
-
I am also using triggerClientEvent for the rotations. But not because of this issue, it is more for combining all AI instructions in to 1 packet and therefore reducing data. While rewriting your code, you might take that concept in consideration.
-
Not sure what the best approach is. Kashtesov released a function that allows you to get the ground position serverside of the GTA san world. But it would be probably better for your user case: 1. Send triggerClientEvent 2. Draw lines at the place where you want to place the vehicle and check for any collision. https://wiki.multitheftauto.com/wiki/IsLineOfSightClear 3. Then confirm if there is any space: triggerServerEvent That way you also take custom objects in account. Or you can also combine those methods. Good luck!
-
Creating variable reference to exported function
IIYAMA replied to GenericDeveloper's topic in Scripting
Try this local myFunctions = { ["FUNCTION_1"] = function (...) return exports.myresource:myFunction(...) end } Predefining export functions from another resource is not a good idea. Because when restarting that resource, all export functions will be reset. -
You should first check if the table exist. If not, fill in the blanks. local blankValue = "-" local c1, c2, c3, c4 = blankValue, blankValue, blankValue, blankValue local speedData = vehicleSpeeds[carID] if speedData then c1, c2, c3, c4 = unpack(speedData) end guiSetText(cLbl[1], "Stoke. speed: "..c1.." km/h.") guiSetText(cLbl[2], "Max. speed: "..c2.." km/h.") guiSetText(cLbl[3], "Acceleration 0-100 for "..c3.." s.") guiSetText(cLbl[4], "Drive unit: "..c4..".")
-
nope, didn't think about that. ? But since you can draw on top of the chat, it is still worth a try. Or just draw it double, but bigger.
-
Maybe you can draw something on top of it. *edited* https://wiki.multitheftauto.com/wiki/OnClientPlayerNetworkStatus
-
Server Client The key (server) "Level" is not the same as (client) "player:level". So there is your mismatch.
