Szerző Téma: KM Óra  (Megtekintve 1430 alkalommal)

KM Óra
« Dátum: 2014. Április 04. - 15:44:11 »
0 Show voters
Sziasztok!
Van egy letöltött szkriptem, ennek módosítását szeretném elérni.Probléma az, hogy módosítás után mûködés képtelenné válik.
(Km óra jelzõt szeretném kicserélni képre.Hozzá teszem nem értek a luahoz.)
Eredeti :



function drawSpeedo()
if active and not isPlayerMapVisible() then
   local vehicle = getPedOccupiedVehicle(getLocalPlayer())
   if (vehicle) then
      speed = exports.global:getVehicleVelocity(vehicle)
      local width, height = guiGetScreenSize()
      local x = width
      local y = height
      -- street names
      local streetname = getElementData(getLocalPlayer(), \"speedo:street\" )
      if streetname then
         local width = dxGetTextWidth( streetname )
         local x = width < 200 and ( x - 110 - width / 2 ) or ( x - 10 - width )
         dxDrawRectangle( x - 8, y - 296, width + 17, 24, tocolor( 5, 5, 5, 220 ) )
         dxDrawText( streetname, x, y - 292 )
      end
      dxDrawImage(x-210, y-275, 200, 200, \"disc.png\", 0, 0, 0, tocolor(255, 255, 255, 200), false)
      local speedlimit = getElementData(getLocalPlayer(), \"speedo:limit\")
      if speedlimit and getElementType(vehicle) ~= \"Boat\" and getElementType(vehicle) ~= \"Helicopter\" and getElementType(vehicle) ~= \"Plane\" then
         local ax, ay = x - 243, y - 202
         dxDrawImage(ax,ay,32,37,\"images/speed\" .. speedlimit .. \".png\")
         ay = ay - 32
         if speedlimit >= 120 then
            dxDrawImage(ax,ay,32,37,\"images/highway.png\")
            ay = ay - 32
         end
         if speed > speedlimit then
            dxDrawImage(ax,ay,32,37,\"images/accident.png\")
         end
      end
      speed = speed - 100
      nx = x + math.sin(math.rad(-(speed)-150)) * 90
      ny = y + math.cos(math.rad(-(speed)-150)) * 90
            dxDrawLine(x-110, y-175, nx-110, ny-175, tocolor(255, 0, 0, 255), 2, true)           
   end
end
 
Általam módosított.



speed = speed - 100
      nx = x + math.sin(math.rad(-(speed)-150)) * 90
      ny = y + math.cos(math.rad(-(speed)-150)) * 90
            dxDrawImage(x-110, y-175, nx-110, ny-175, \"kép.png\" , true  )   
 
Válaszokat elõre is köszönöm!  :)

Nem elérhető Erik3333

  • 945
  • SMF | phpBB | TS3 | PHP | HTML | CSS | JS | PAWN | JAVA
    • Profil megtekintése
KM Óra
« Válasz #1 Dátum: 2014. Április 05. - 10:58:32 »
0 Show voters
Ha megnézed Wiki-n az argumentumokat, akkor észreveszed, hogy nem jól van kitöltve.
Vagy így csinálod:
 
dxDrawImage(x-110, y-175, nx-110, ny-175, \"kép.png\", 0, 0, 0, tocolor(255, 255, 255, 200), false)

 
Vagy így:
 
dxDrawImage(x-110, y-175, nx-110, ny-175, \"kép.png\")

 
Ha így sem jó, akkor pedig nem tetszik neki az ékezetes fájlnév.

Nem elérhető Live

  • 507
    • Profil megtekintése
KM Óra
« Válasz #2 Dátum: 2014. Április 27. - 16:10:27 »
0 Show voters
Vagy pedig csak ellett írva valami  >:D
 

function drawSpeedo()
   if active and not isPlayerMapVisible() then
      local vehicle = getPedOccupiedVehicle(getLocalPlayer())
      if (vehicle) then
         speed = exports.global:getVehicleVelocity(vehicle)
         local width, height = guiGetScreenSize()
         local x = width
         local y = height
         
         -- street names
         local streetname = getElementData(getLocalPlayer(), \"speedo:street\" )
         if streetname then
            local width = dxGetTextWidth( streetname )
            local x = width < 200 and ( x - 110 - width / 2 ) or ( x - 10 - width )
            dxDrawRectangle( x - 8, y - 296, width + 17, 24, tocolor( 5, 5, 5, 220 ) )
            dxDrawText( streetname, x, y - 292 )
         end
         
         dxDrawImage(x-210, y-275, 200, 200, \"disc.png\", 0, 0, 0, tocolor(255, 255, 255, 200), false)
         
         local speedlimit = getElementData(getLocalPlayer(), \"speedo:limit\")
         if speedlimit and getElementType(vehicle) ~= \"Boat\" and getElementType(vehicle) ~= \"Helicopter\" and getElementType(vehicle) ~= \"Plane\" then
            local ax, ay = x - 243, y - 202
           
            dxDrawImage(ax,ay,32,37,\"images/speed\" .. speedlimit .. \".png\")
            ay = ay - 32
           
            if speedlimit >= 120 then
               dxDrawImage(ax,ay,32,37,\"images/highway.png\")
               ay = ay - 32
            end
           
            if speed > speedlimit then
               dxDrawImage(ax,ay,32,37,\"images/accident.png\")
            end
         end
         
         if speed = speed - 100 then
         nx = x + math.sin(math.rad(-(speed)-150)) * 90
         ny = y + math.cos(math.rad(-(speed)-150)) * 90
            dxDrawImage(x-110, y-175, nx-110, ny-175, \"kép.png\" , true  )       
      end
   end
end
« Utoljára szerkesztve: 2014. Április 27. - 16:12:28 írta BnK' »

KM Óra
« Válasz #3 Dátum: 2014. Április 04. - 15:44:11 »
0 Show voters
Sziasztok!
Van egy letöltött szkriptem, ennek módosítását szeretném elérni.Probléma az, hogy módosítás után mûködés képtelenné válik.
(Km óra jelzõt szeretném kicserélni képre.Hozzá teszem nem értek a luahoz.)
Eredeti :



function drawSpeedo()
if active and not isPlayerMapVisible() then
   local vehicle = getPedOccupiedVehicle(getLocalPlayer())
   if (vehicle) then
      speed = exports.global:getVehicleVelocity(vehicle)
      local width, height = guiGetScreenSize()
      local x = width
      local y = height
      -- street names
      local streetname = getElementData(getLocalPlayer(), \"speedo:street\" )
      if streetname then
         local width = dxGetTextWidth( streetname )
         local x = width < 200 and ( x - 110 - width / 2 ) or ( x - 10 - width )
         dxDrawRectangle( x - 8, y - 296, width + 17, 24, tocolor( 5, 5, 5, 220 ) )
         dxDrawText( streetname, x, y - 292 )
      end
      dxDrawImage(x-210, y-275, 200, 200, \"disc.png\", 0, 0, 0, tocolor(255, 255, 255, 200), false)
      local speedlimit = getElementData(getLocalPlayer(), \"speedo:limit\")
      if speedlimit and getElementType(vehicle) ~= \"Boat\" and getElementType(vehicle) ~= \"Helicopter\" and getElementType(vehicle) ~= \"Plane\" then
         local ax, ay = x - 243, y - 202
         dxDrawImage(ax,ay,32,37,\"images/speed\" .. speedlimit .. \".png\")
         ay = ay - 32
         if speedlimit >= 120 then
            dxDrawImage(ax,ay,32,37,\"images/highway.png\")
            ay = ay - 32
         end
         if speed > speedlimit then
            dxDrawImage(ax,ay,32,37,\"images/accident.png\")
         end
      end
      speed = speed - 100
      nx = x + math.sin(math.rad(-(speed)-150)) * 90
      ny = y + math.cos(math.rad(-(speed)-150)) * 90
            dxDrawLine(x-110, y-175, nx-110, ny-175, tocolor(255, 0, 0, 255), 2, true)           
   end
end
 
Általam módosított.



speed = speed - 100
      nx = x + math.sin(math.rad(-(speed)-150)) * 90
      ny = y + math.cos(math.rad(-(speed)-150)) * 90
            dxDrawImage(x-110, y-175, nx-110, ny-175, \"kép.png\" , true  )   
 
Válaszokat elõre is köszönöm!  :)

Nem elérhető Erik3333

  • 945
  • SMF | phpBB | TS3 | PHP | HTML | CSS | JS | PAWN | JAVA
    • Profil megtekintése
KM Óra
« Válasz #4 Dátum: 2014. Április 05. - 10:58:32 »
0 Show voters
Ha megnézed Wiki-n az argumentumokat, akkor észreveszed, hogy nem jól van kitöltve.
Vagy így csinálod:
 
dxDrawImage(x-110, y-175, nx-110, ny-175, \"kép.png\", 0, 0, 0, tocolor(255, 255, 255, 200), false)

 
Vagy így:
 
dxDrawImage(x-110, y-175, nx-110, ny-175, \"kép.png\")

 
Ha így sem jó, akkor pedig nem tetszik neki az ékezetes fájlnév.

Nem elérhető Live

  • 507
    • Profil megtekintése
KM Óra
« Válasz #5 Dátum: 2014. Április 27. - 16:10:27 »
0 Show voters
Vagy pedig csak ellett írva valami  >:D
 

function drawSpeedo()
   if active and not isPlayerMapVisible() then
      local vehicle = getPedOccupiedVehicle(getLocalPlayer())
      if (vehicle) then
         speed = exports.global:getVehicleVelocity(vehicle)
         local width, height = guiGetScreenSize()
         local x = width
         local y = height
         
         -- street names
         local streetname = getElementData(getLocalPlayer(), \"speedo:street\" )
         if streetname then
            local width = dxGetTextWidth( streetname )
            local x = width < 200 and ( x - 110 - width / 2 ) or ( x - 10 - width )
            dxDrawRectangle( x - 8, y - 296, width + 17, 24, tocolor( 5, 5, 5, 220 ) )
            dxDrawText( streetname, x, y - 292 )
         end
         
         dxDrawImage(x-210, y-275, 200, 200, \"disc.png\", 0, 0, 0, tocolor(255, 255, 255, 200), false)
         
         local speedlimit = getElementData(getLocalPlayer(), \"speedo:limit\")
         if speedlimit and getElementType(vehicle) ~= \"Boat\" and getElementType(vehicle) ~= \"Helicopter\" and getElementType(vehicle) ~= \"Plane\" then
            local ax, ay = x - 243, y - 202
           
            dxDrawImage(ax,ay,32,37,\"images/speed\" .. speedlimit .. \".png\")
            ay = ay - 32
           
            if speedlimit >= 120 then
               dxDrawImage(ax,ay,32,37,\"images/highway.png\")
               ay = ay - 32
            end
           
            if speed > speedlimit then
               dxDrawImage(ax,ay,32,37,\"images/accident.png\")
            end
         end
         
         if speed = speed - 100 then
         nx = x + math.sin(math.rad(-(speed)-150)) * 90
         ny = y + math.cos(math.rad(-(speed)-150)) * 90
            dxDrawImage(x-110, y-175, nx-110, ny-175, \"kép.png\" , true  )       
      end
   end
end
« Utoljára szerkesztve: 2014. Április 27. - 16:12:28 írta BnK' »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal