-
Posts
1,105 -
Joined
-
Last visited
Everything posted by Aibo
-
onClientPlayerQuit (как и onClientPlayerJoin) не срабатывают для источника события, то есть для того игрока, который выходит (заходит). и об этом в их описании написано.
-
that is some really weird system, what are your trying to achieve with it anyway? can't see what actually wrong. except the idea itself, why set all vehicles' element data to player name on join. what if another player joins? is "CharacterName" is even set? how do you know first part is working? and what line throws the error exactly? ps: since "CharacterName" doesnt change in ipairs(vehicle) loop, you better move it outside of the loop.
-
if your variable contains a string — why not.
-
safest meaning? people don't come and break your legs if your script is full of bugs or what? ps: anything you're going to sell people probably going to steal/crack if there's any protection.
-
local x,y,z = getElementPosition(getLocalPlayer()) local wx,wy,wz = getElementPosition(safeObject) local dis = getDistanceBetweenPoints3D(x,y,z,wx,wy,wz) if dis >5 then outputChatBox("your not near a safe") else outputChatBox ("you ARE near a safe") end
-
it's wrong in so many ways.
-
why are you converting numbers to strings when comparing them?
-
have you added your image to meta.xml?
-
even more compact function getPlayerSpeed(player,mph) local velX,velY,velZ=getElementVelocity(getPedOccuipiedVehicle(player) or player) return (velx^2+velY^2+velZ^2)^0.5*(mph and 100 or 161) end
-
first, you dont need to get screen size and scaling multipliers every frame. its is unlikely that they will change. get them at script start and leave them. second: local screenWidth, screenHeight = guiGetScreenSize() local scaleX = screenWidth/1280 local scaleY = screenHeight/1024 function renderLoginWindow() dxDrawRectangle(340*scaleX, 255*scaleY, 630*scaleX, 347*scaleY, tocolor(0,0,0,100), false) dxDrawText("Password:", 439*scaleX, 434*scaleY, 626*scaleX, 472*scaleY, tocolor(255,255,255,255), scaleX, "bankgothic") dxDrawText("Username:", 441*scaleX, 363*scaleY, 628*scaleX, 401*scaleY, tocolor(255,255,255,255), scaleX, "bankgothic") dxDrawText("MTA Party Server", 483*scaleX, 282*scaleY, 915*scaleX, 349*scaleY, tocolor(51,204,255,255), 1.7*scaleX, "pricedown") end addEventHandler("onClientRender", root, renderLoginWindow) -- then, after clicking the button, remove the event handler removeEventHandler("onClientRender", root, renderLoginWindow)
-
gui iblabla image is created by using guiCreateStaticImage or dxDrawImage. and other gui functions: https://wiki.multitheftauto.com/wiki/Cli ... _functions speed is calculated from vehicle element velocity (see example): https://wiki.multitheftauto.com/wiki/GetElementVelocity then resulting speed is passed to dxDrawImage of a needle as rotation parameter (adjusted to some degree range if needed)
-
looks like you're using relative positions/sizes for gui and absolute for dxdraw. you need to scale it, something like this: -- calculate scaling for current screen size, by dividing it by your original size (1280x1024) screenWidth, screenHeight = guiGetScreenSize() scaleX = screenWidth/1280 scaleY = screenHeight/1024 -- and then multiply your positions/sizes: dxDrawRectangle(340*scaleX, 255*scaleY, 630*scaleX, *scaleY, tocolor(0,0,0,100), false) dxDrawText("Password:", 439*scaleX, 434*scaleY, 626*scaleX, 472*scaleY, tocolor(255,255,255,255), scaleX, "bankgothic") dxDrawText("Username:", 441*scaleX, 363*scaleY, 628*scaleX, 401*scaleY, tocolor(255,255,255,255), scaleX, "bankgothic") dxDrawText("MTA Party Server", 483*scaleX, 282*scaleY, 915*scaleX, 349*scaleY, tocolor(51,204,255,255), 1.7*scaleX, "pricedown")
-
so this resource is basically draws a straight line from one point to another? :3
-
ipairs will iterate the table by numeric index order starting from 1 and until next numeric key is not found, like: table = { "one", "two", "three", four = "four", five = "five", [5] = "five", six = "six" } ipairs(test) will stop after table[3] because table[4] is nil. and it will not find test[5], because [4] is missing. and pairs will output everything with any kind of index, be it number, string or MTA element.
-
basically, if you're image is with correct sizes (2^x) and is not scaled — it will look best in dxDrawImage. sometime even scaling doesnt hurt. so PNGs with 8-bit alpha work fine if treated with care as i recall DDS uses DXT compression (optional though). imo it'll make no difference in the end for dxDrawImage/Section ps: correct me if im wrong:
-
can you tell more about how they should look? or maybe show currrent images.
-
it's a fact that images with sizes that are power of 2 (2^x, like 16x16, 32x32, 64x64, etc) work best with dx functions. as for air im not aware of any way
-
i can help with that. i also was making a round hud (but i went the other way with circular bars, half is just hidden so it just rotates pretty smooth and accurate), but got bored on making new weapon icons btw what image sizes (in pixels) you're using?
-
do you understand the difference between 2D and 3D? on your screens image size doesnt change at all. you dont want it to scale down to distance, you dont want it to be fixed size, what is it you want?
-
it simply cant expand size, because it has constant size of 32 pixels. you're confused because ped is getting closer while image stays the same size.
-
change local sizeImg = 20/distance to size in pixels you want: local sizeImg = 32 how hard can that be
-
judging by the screens it works as intended (images shown and scaled according to distance), better explain what you want maybe.
-
addEventHandler( "onClientRender", root, function() for _, plr in ipairs(getElementsByType("ped", root, true)) do -- first, it's better to loop only through streamed-in elements, not all of them. -- because you can't see other elements anyway. so: getElementsByType("ped", root, true) if (getElementData (plr, "zombie") and getElementData(plr, "status" ) ~= "dead") then -- local Px,Py,Pz = getElementPosition( getLocalPlayer() ) -- i dont think you need this -- it more logical to use camera position, not player's local cx, cy, cz = getCameraMatrix() local Zx, Zy, Zz = getElementPosition( plr ) local distance = getDistanceBetweenPoints3D (cx, cy, cz, Zx, Zy, Zz) if (distance < 45) and (distance > 2) then local x, y, z = getPedBonePosition( plr, 8 ) local sX, sY = getScreenFromWorldPosition(x, y, z+0.7, 100) -- better add some edge tolerance -- also getScreenFromWorldPosition() returns 2 values, X an Y, no Z if sX then -- check if element is on screen BEFORE checking the line of sight -- and i dont think you need processLineOfSight, since you're not using -- any of the data it returns, except to check if something was hit. -- and there's a lighter function just for that: isLineOfSightClear if isLineOfSightClear(cx, cy, cz, x, y, z, true, false, false) then -- also it's better to ignore peds/vehicles, imo local sizeImg = 20/distance -- let's say distance is 44, 20/44 is 0.45 which is half a pixel -- so at that distance your image wont be visible already -- of course maybe that is what you want local zClass = getElementData( plr ,"zClass") -- instead of calling the same function with same parameters 6 times -- it's better to call it once and store the result, imo local image = false -- also if you're only changing the image, i'd put in a variable -- and use only 1 dxDrawImage (will be easier to edit later) -- actually, i'd make some table like {[1]="wg.png", [2]="g.png", etc} if zClass == 6 then image = "w.png" elseif zClass == 1 then image = "wg.png" elseif zClass == 2 then image = "g.png" elseif zClass == 3 then image = "y.png" elseif zClass == 4 then image = "r.png" elseif zClass == 5 then image = "b.png" end if image then dxDrawImage(sX-sizeImg/2,sY-sizeImg/2,sizeImg,sizeImg, image) end -- subtract half of the image size from its position to center it at its point end end end end end end )
-
rankingboard_client использует функции из util_client, например: function createShadowedLabel(x, y, width, height, text, align) local shadow = guiCreateLabel(x + 1, y + 1, width, height, text, false) guiLabelSetColor(shadow, 0, 0, 0) local label = guiCreateLabel(x, y, width, height, text, false) guiLabelSetColor(label, 255, 255, 255) if align then guiLabelSetHorizontalAlign(shadow, align) guiLabelSetHorizontalAlign(label, align) end return label, shadow end
