Otto Posted November 8, 2011 Share Posted November 8, 2011 (edited) Hello guys, I made a speedomenter with a "crack" but it isn't running Something went wrong them, but I don't know what it is. speedo.lua g_root = getRootElement() g_rootElement = getResourceRootElement( getThisResource() ) g_Player = getLocalPlayer() c_EnableScaling = true c_XOffset = 10 c_YOffset = 10 c_ImageW = 200 c_ImageH = 200 c_BarW = 50 c_BarH = 10 c_BarYOffset = 70 c_FireTimeMs = 5000 c_BarAlpha = 120 c_BarFlashInterval = 300 g_tFireStart = nil function drawNeedle() if not isPedInVehicle(g_Player) then hideSpeedometer() end local vehSpeed = getVehicleSpeed() local vehHealth = getElementHealth(getPedOccupiedVehicle(g_Player)) if vehHealth and (vehHealth > 0) then local hp = (vehHealth-250)/750 local curBarLen = hp*g_BarW if curBarLen < 1 then curBarLen = 1 end local r = 255*(1 - hp)/0.5 if r > 255 then r = 255 end local g = 255*hp/0.5 if g > 255 then g = 255 end if g < 0 then g = 0 end if hp >= 0 then g_tFireStart = nil dxDrawRectangle(x + g_ImageW/2 - g_BarW/2, y + g_BarYOffset, g_BarW, g_BarH, tocolor(20, 20, 20, c_BarAlpha)) dxDrawRectangle(x + g_ImageW/2 - g_BarW/2, y + g_BarYOffset + (g_BarH - curBarLen), g_BarW, curBarLen, tocolor(r, g, 0, c_BarAlpha)) else if not g_tFireStart then g_tFireStart = getTickCount() end local firePerc = (c_FireTimeMs - (getTickCount() - g_tFireStart)) / c_FireTimeMs if firePerc < 0 then firePerc = 0 end local a = c_BarAlpha if (getTickCount()/c_BarFlashInterval)%2 > 1 then a = 0 end dxDrawRectangle(x + g_ImageW/2 - g_BarW/2, y + g_BarYOffset, g_BarW, g_BarH, tocolor(20, 20, 20, 255)) dxDrawRectangle(x + g_ImageW/2 - g_BarW/2, y + g_BarYOffset, firePerc*g_BarW, g_BarH, tocolor(255, 0, 0, a)) end if curBarLen < 20 then dxDrawImage(crackX, crackY, crackW, crackH, "crack1.png", crackR, 0, 0, white, false) end end dxDrawImage(x, y, g_ImageW, g_ImageH, "needle.png", vehSpeed, 0, 0, white, true) end function showSpeedometer() guiSetVisible(disc, true) addEventHandler("onClientRender", g_root, drawNeedle) end function hideSpeedometer() guiSetVisible( disc, false) removeEventHandler("onClientRender", g_root, drawNeedle) end function getVehicleSpeed() if isPedInVehicle(g_Player) then local vx, vy, vz = getElementVelocity(getPedOccupiedVehicle(g_Player)) return math.sqrt(vx^2 + vy^2 + vz^2) * 161 end return 0 end addEventHandler("onClientVehicleEnter", g_root, function(thePlayer) if thePlayer == g_Player then showSpeedometer() end end ) addEventHandler("onClientVehicleStartExit", g_root, function(thePlayer) if thePlayer == g_Player then hideSpeedometer() end end ) function round(num) return math.floor(num + 0.5) end function initGui() if disc then destroyElement(disc) end g_screenWidth, g_screenHeight = guiGetScreenSize() local scale if c_EnableScaling then scale = (g_screenWidth/1152 + g_screenHeight/864)/2 else scale = 1 end g_XOffset = round(c_XOffset*scale) g_YOffset = round(c_YOffset*scale) g_ImageW = round(c_ImageW*scale) g_ImageH = round(c_ImageH*scale) g_BarW = round(c_BarW*scale) g_BarH = round(c_BarH*scale) g_BarYOffset = round(c_BarYOffset*scale) disc = guiCreateStaticImage(g_screenWidth - g_ImageW - g_XOffset, g_screenHeight - g_ImageH - g_YOffset, g_ImageW, g_ImageH, "disc.png", false) x, y = guiGetPosition(disc, false) end addEventHandler("onClientResourceStart", g_rootElement, function () initGui() guiSetVisible(disc, false) setTimer(function() local w, h = guiGetScreenSize() if (w ~= g_screenWidth) or (h ~= g_screenHeight) then initGui() end end, 500, 0) if isPedInVehicle(g_Player) then showSpeedometer() end end ) meta.xml "Speedometer" author="Otto" version="1.2" type="misc" /> WTF? Then, I want to put it higher on the screen, what have I to edit (Some things were taken from other scripts, crack and images are mine). Edited November 8, 2011 by Guest Link to comment
Castillo Posted November 8, 2011 Share Posted November 8, 2011 First, you didn't script it, you downloaded it from the MTA community, is not cool to steal other's credits. Second, to change the position you must edit these variables: c_XOffset = 10 c_YOffset = 10 Link to comment
Otto Posted November 8, 2011 Author Share Posted November 8, 2011 First, you didn't script it, you downloaded it from the MTA community, is not cool to steal other's credits.Second, to change the position you must edit these variables: c_XOffset = 10 c_YOffset = 10 Third, I didn't. Credits should stay if there are no changes, but I added the Crack and I edited all the images. On a legal way, this began mine. Thanks anyway. Link to comment
CapY Posted November 8, 2011 Share Posted November 8, 2011 First, you didn't script it, you downloaded it from the MTA community, is not cool to steal other's credits.Second, to change the position you must edit these variables: c_XOffset = 10 c_YOffset = 10 On a legal way, this began mine. Thanks anyway. It's not yours. Link to comment
Aibo Posted November 8, 2011 Share Posted November 8, 2011 Third, I didn't. Credits should stay if there are no changes, but I added the Crack and I edited all the images. On a legal way, this began mine. Thanks anyway. what a load of bullshit. Link to comment
Otto Posted November 8, 2011 Author Share Posted November 8, 2011 Probably the things I toked are not cool, but they are legal. Link to comment
Oz. Posted November 8, 2011 Share Posted November 8, 2011 I'm a little concerned about your references to the supposed legality of taking someone's work, changing a bit of it, and then passing it off as your own without due credit to the original creator. It sets a bad example for anyone who is dumb enough to believe that is true. It isn't legal (nor is it right/fair) to take someone's intellectual property, change it, and then redistribute it as your own without permission from and/or credit to the original creator. I don't think you have any idea what you're on about, but I do think you should stop filling people's heads with the idea that it's ok to pinch people's work without permission or credit. Create everything from scratch if you want to credit yourself with it. I wholeheartedly agree with Aibo's comment. Link to comment
Aibo Posted November 8, 2011 Share Posted November 8, 2011 ok let me tell you something. 1. this script is probably the oldest public (if not the first) one used to draw a speedometer with rotating image as a needle. i can't rememebr who's the author. (though it says author="d0c" in my meta.xml, i believe that's the guy). if you change few numbers here and there — it doesn't make you legally the author. 2. "crack" showing on the screen was added by me for the first DDC speedometer (and it was popping up on community with images changed a few times). guess why the image is called crack1.png? because there should be more cracks, but i didn't make them. i didn't release it because it was a minor edit and i'm not the author. but other people (like you) think its fine to take it, change images and/or few lines and put on community as your own. above said, you're not the author of a single thing here. and it doesn't work because your script is missing some globals needed for crack image positioning. you would've noticed that yourself if you'd know how to script/debug. because people don't just put in a line full of variables that are never defined anywhere and then ask about it on forums. that's the main symptom of a copy-paste disorder. Link to comment
Otto Posted November 8, 2011 Author Share Posted November 8, 2011 Then I know that, of the DDC crack, but this one is mine, this crack is mine cause DDC crack is compiled. When I took this script, it said "Base of a speedo", so I thought that if somebody takes it, it will legal, cause it's the base, and you can perform it. crack1.png because I took sizes from another one called crack1.png, and I edited it with Photoshop. Btw, you are not answering my dude. Link to comment
Aibo Posted November 8, 2011 Share Posted November 8, 2011 DDC doesn't even use this speedometer for a long time already. but even when it was there, it was never compiled and the author in meta.xml was left intact. i just don't get it, how can you copy one line of code and lose the others needed for that line to work. Link to comment
Otto Posted November 8, 2011 Author Share Posted November 8, 2011 DDC doesn't even use this speedometer for a long time already. but even when it was there, it was never compiled and the author in meta.xml was left intact. It's compiled guy, and BOS took it anyway. Is BOS the same as DDC? i just don't get it, how can you copy one line of code and lose the others needed for that line to work. This is my second script, Crack script is mine cause the one I founded was from DDC and it was compiled so I had to do it. Life was deleted and I was based on a very simple speedo, like the one on DKR. Link to comment
Otto Posted November 8, 2011 Author Share Posted November 8, 2011 Ok, if it it's yours, I'll add Aibo (You) on the Meta. Sorry anyway. And I solved the problem. Link to comment
CapY Posted November 8, 2011 Share Posted November 8, 2011 It's not your script for fuck sake, can't you get it ? No worries, he will credit the real author.(Otherwise, i will kill him. ) Edit: Didn't noticed last post. Link to comment
Aibo Posted November 8, 2011 Share Posted November 8, 2011 for the last time: this is not your script, not a single line here is yours, not even these: if curBarLen < 20 then dxDrawImage(crackX, crackY, crackW, crackH, "crack1.png", crackR, 0, 0, white, false) end which are all you've "added" to draw crack1.png image. but it doesn't work because you didn't even bother to change/define the variables used. and no. this is not my script. and my "edits" doesn't make me the author. if community was up i'd find the original to show it to you. alas. Link to comment
Aibo Posted November 8, 2011 Share Posted November 8, 2011 goddamit, this is not about who's the author of this particular script. but about the whole situation with people (without even basic scripting knowledge) making "frankenstein" scripts from copy-pasted parts, posting them here and asking "i wrote this script dont works how fix me thx". it's sad. you won't learn by copy-pasting. Link to comment
CapY Posted November 8, 2011 Share Posted November 8, 2011 goddamit, this is not about who's the author of this particular script. but about the whole situation with people (without even basic scripting knowledge) making "frankenstein" scripts from copy-pasted parts, posting them here and asking "i wrote this script dont works how fix me thx". it's sad. Agreed with Aiboforcen. Link to comment
Otto Posted November 8, 2011 Author Share Posted November 8, 2011 goddamit, this is not about who's the author of this particular script. but about the whole situation with people (without even basic scripting knowledge) making "frankenstein" scripts from copy-pasted parts, posting them here and asking "i wrote this script dont works how fix me thx". it's sad. Agreed with Aiboforcen. I think that's a example of a lazy guy.. I'm one. Anyway, this is just my second script, third will be different. AND I AGREE IT'S NOT ALL MINE, but someparts are. Images are. Anyway, you are on the Meta Aibo. PS: I founded myself the mistake, next time I'll try not to be lazy. Link to comment
CapY Posted November 8, 2011 Share Posted November 8, 2011 Aibo is not the original creator of it, and that's not your second script, you are just owner of those images in the script. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now