-
Posts
91 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Jayceon
-
I'm using this one: isLineOfSightClear(playerX, playerY, playerZ, explosionX, explosionY, explosionZ, true, true, false, true, true) Another: local _, _, playerRotZ = getElementRotation(localPlayer) local angle = math.atan2(explosionY - playerY, explosionX - playerX) + math.rad(180 - playerRotZ) if angle < 0 then angle = angle + math.rad(360) end if math.deg(angle) >= 180 then -- facing of explosion -- player flashed end PlayerX/Y/Z works with camera poses.
-
This is font is default-bold? Try to use custom dx font with my opinion. When i use default MTA Fonts my quality looks like yours.
-
For me works very well. I'm using custom dx font with antialiased flag and in the dxDrawText the scale is every time is 1 + added modulate_add blend to renderTarget. The final view: https://i.imgur.com/AYxroK1.png The font size/quality and the scale in render can increase/decrease the quality.
-
string.format("%.0f", 50000000000000000000000) The max returned value is: 49999999999999995805696 Lua numbers have limited precision, but you are trying to store a number that exceeds what can be stored. You'll need to use a different mechanism to store them and operate on these numbers. Search in Google with this keywords: "bignum" and "arbitrary precision numbers"
-
local text = "This is the dxtext" local charactersVisible = 10 text = string.sub(text, 1, charactersVisible) .. "..." iprint(text)
-
Problem solved in the 1.0.6 version.
-
Today i fix it. ?
-
Face toward at dxDrawMaterialLine3D depending on rotations
Jayceon replied to Dzsozi (h03)'s topic in Scripting
function elementOffset(matrix, x, y, z) return x * matrix[1][1] + y * matrix[2][1] + z * matrix[3][1] + matrix[4][1], x * matrix[1][2] + y * matrix[2][2] + z * matrix[3][2] + matrix[4][2], x * matrix[1][3] + y * matrix[2][3] + z * matrix[3][3] + matrix[4][3] end Use the getElementMatrix and the elementOffset function to get the material start/end and facing toward position. Like this: local vehicleMatrix = getElementMatrix(vehicleElement) local x1, y1, z1 = elementOffset(vehicleMatrix, 0, 1, 0) local x2, y2, z2 = elementOffset(vehicleMatrix, 0, -1, 0) local x3, y3, z3 = elementOffset(vehicleMatrix, 0, 1, 0.5) dxDrawMaterialLine3D(x1, y1, z1, x2, y2, z2, data.renderTarget, 2, tocolor(lightColor[1],lightColor[2],lightColor[3],lightColor[4]), x3, y3, z3) Or another way (not tested): local vehiclePosX, vehiclePosY, vehiclePosZ = getElementPosition(vehicleElement) local _, _, vehicleRotation = getElementRotation(vehicleElement) vehicleRotation = math.rad(vehicleRotation) local rotatedX = math.cos(vehicleRotation) * 1.05 local rotatedY = math.sin(vehicleRotation) * 1.05 local hit, hitPosX, hitPosY, hitPosZ = processLineOfSight(vehiclePosX, vehiclePosY, vehiclePosZ + 1, vehiclePosX, vehiclePosY, vehiclePosZ - 1, true, false, false, false, false) hitPosZ = hitPosZ + 0.02 dxDrawMaterialLine3D(hitPosX + rotatedX, hitPosY + rotatedY, hitPosZ, hitPosX - rotatedX, hitPosY - rotatedY, hitPosZ, data.renderTarget, 2, tocolor(lightColor[1],lightColor[2],lightColor[3],lightColor[4]), hitPosX, hitPosY, hitPosZ + 1) Play with the values -
local isNumKey = tonumber(button) if press and (isNumKey and isNumKey >= 0 and isNumKey <= 9) then --trigger or something end
-
E: local groups = { fondatori = { name = "Fondator|Dev |", ids = {1, 3, 54, 85}, RGB = {0, 153, 255} }, fondatori2 = { name = "Fondator|Hosting", ids = {2}, RGB = {0, 153, 255} } } function isPlayerIDInGroup( id, IDsTable ) for i=1, #IDsTable do if IDsTable[i] == tonumber(id) then return true end end return false end local groupFound = false for _,group in pairs(groups) do if isPlayerIDInGroup( playerID, group.ids ) then groupFound = group break end end if groupFound then local r,g,b = unpack(groupFound.RGB) outputChatBox(groupFound.name.." ..:D%G:.. says: Hello World", r, g, b ) else outputChatBox("Civilian | ..:D%G:.. says: Hello World", 255, 255, 0 ) end
-
In the server side code, change the source argument to another. (The source of this event is the colshape that got hit by a player or vehicle.)
-
Not good format. The correct format is: <export function="addLog" type="server" /> <export function="saveLog" type="server" /> <export function="createLog" type="server" />
- 4 replies
-
- 2
-
- call function
- exports.
- (and 4 more)
-
Change this: dxDrawText(selectedItem > 0 and contentList[1][selectedItem] or "Select a skin", boxX+20, boxY, boxX+20, boxY+boxH, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "center") To: dxDrawText(selectedItem > 0 and contentList[selectedItem][1] or "Select a skin", boxX+20, boxY, boxX+20, boxY+boxH, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "center")
-
"Website dont work anymore" - Use the webarchive. (fast link to crystal website: https://web.archive.org/web/20161127055038/http://crystalmv.net84.net:80/)
-
With a little transformation, but work. Thanks
-
It is a GPS Navig system, using nodes. Now. There is a start and an endpoint of these. At every endpoint a new node starts. This is everything i know, i want to know if the endpoint is to the left or the right from the start point. If you don't understand I can visualize it. for i, node in ipairs(gpsRoute) do local nextNode = gpsRoute[i + 1] local previousNode = gpsRoute[i - 1] if i > 1 and i < #gpsRoute then for k, v in pairs(node.neighbours) do if previousNode and nextNode and k ~= previousNode.id and k ~= nextNode.id then local nodeAngle = getAngle(node.x - previousNode.x, node.y - previousNode.y, nextNode.x - node.x, nextNode.y - node.y) if math.deg(nodeAngle) > 10 then print("right") break end if math.deg(nodeAngle) < -10 then print("left") end break end end end end
-
I have 4 positions. One X-Y pair for the start, one XY pair for the end of the line. I want to get the angle between the starting point and the endpoint of these. But. I need it to be negative if left and positive if right.
-
I just need an example please
-
Please show me an example code, i shown you mine, just use it and please do an example getAngle function)
-
Example: local angle = math.deg(getAngle(currentNode.x - previousNode.x, currentNode.y - previousNode.y, nextNode.x - currentNode.x, nextNode.y - currentNode.y)) if angle > 10 then print("right") elseif angle < -10 then print("left") end
-
wtf is rotationOffset ? i have the function, with X Y, X2, Y2 points on the map. I need the angle between them, but it can be negative or positive depending on left or right. n>10 -> right n<-10 -> left so it should work clockwise and counter-clockwise
-
We have some pass marks, so i can not 360-value every single time