Gallagher Posted March 15, 2014 Posted March 15, 2014 hello guys I found this script in the community but it is not working. the debugsdcript says this error on this line 9 Local MimgW, MimgH = dxGetMaterialSize (mapRadar) in MimgW , --// Created by KryPtoHolYx --\\ local s = {guiGetScreenSize()} local icons = {} for k = 1,65 do icons[k] = dxCreateTexture("blips/"..k..".png") end addEventHandler( "onClientResourceStart", getRootElement( ),function (res) if res ~= getThisResource() then return end radarTexture = dxCreateTexture("radar.jpg") currentZoomState = 0.5 local width, height = 1200,1200 radar = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900 ) mapRadar = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900 ) radararea = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900,true ) pathmap = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900,true ) local MimgW,MimgH = dxGetMaterialSize(mapRadar) addEventHandler ("onClientPreRender",root, function () local blips = {} dxSetRenderTarget( mapRadar,true ) dxDrawImage (0,0,MimgW,MimgH, radarTexture) for i, v in ipairs( getElementsByType('blip') ) do local icon = getBlipIcon(v) if icon > 3 then local px,py = getElementPosition(v) local blip_x = (3000+px)/6000*MimgW local blip_y = (3000-py)/6000*MimgH local rot = getPedCameraRotation( localPlayer ) size = 20 dxDrawImage(blip_x-size/2, blip_y-size/2, size, size,icons[icon],rot) end end for i, v in ipairs(getElementsByType('player') ) do if v ~= localPlayer then local r,g,b = 20,200,20 or getPlayerNametagColor(v) local px,py = getElementPosition(v) local p_x = (3000+px)/6000*MimgW local p_y = (3000-py)/6000*MimgH local prot = getPedRotation( v ) local p_blipsize = 20-currentZoomState dxDrawImage (p_x-p_blipsize/2,p_y-p_blipsize/2,p_blipsize,p_blipsize, "blips/3.png",-prot,0,0,tocolor(r,g,b)) end end dxSetRenderTarget( ) dxSetRenderTarget( radararea,true ) for i, v in ipairs( getElementsByType('radararea') ) do local r,g,b,a = getRadarAreaColor(v) local w,h = getRadarAreaSize(v) x,y = getElementPosition(v) x = x / (6000 / MimgW) + MimgW/2 y = y / (-6000/ MimgH) + MimgH/2 dxDrawRectangle(x, (y-h) + 4 + (h/2), (w/2), (h/2), tocolor(r,g,b,a)) end dxSetRenderTarget( ) dxSetRenderTarget( radar,true ) local x,y,z = getElementPosition(localPlayer) local rot = getPedCameraRotation( localPlayer ) local mapx = x / (6000/MimgW) + MimgW/2 - width*currentZoomState/2 local mapy = y / (-6000/MimgH) + MimgH/2 - height*currentZoomState/2 dxDrawImageSection (0,0,width,height,mapx,mapy,width*currentZoomState,height*currentZoomState,mapRadar,-rot) dxDrawImageSection (0,0,width,height,mapx,mapy,width*currentZoomState,height*currentZoomState,radararea,-rot) dxDrawImageSection (0,0,width,height,mapx,mapy,width*currentZoomState,height*currentZoomState,pathmap,-rot) local px,py = getElementPosition(localPlayer) local prot = getPedRotation( localPlayer ) local pblipsize = 20 - currentZoomState dxDrawImage (width/2-pblipsize/2,height/2-pblipsize/2,pblipsize,pblipsize, icons[3],-rot-prot) dxSetRenderTarget() showPlayerHudComponent("radar",false) dxDrawImageSection(s[1]*50/1440, s[2]*650/900, s[1]*300/1440, s[2]*200/900, 450,490, 300, 200,radar, 0, -90, 0, tocolor(255, 255, 255, 255),true) dxDrawRectangle(s[1]*50/1440, s[2]*650/900,s[1]*300/1440,s[2]*2/900,tocolor(0,0,0,255),true) dxDrawRectangle(s[1]*50/1440, s[2]*850/900,s[1]*300/1440,s[2]*2/900,tocolor(0,0,0,255),true) dxDrawRectangle(s[1]*350/1440, s[2]*650/900,s[1]*2/1440,s[2]*202/900,tocolor(0,0,0,255),true) dxDrawRectangle(s[1]*50/1440, s[2]*650/900,s[1]*2/1440,s[2]*200/900,tocolor(0,0,0,255),true) local x,y,z = getElementPosition(localPlayer) local zone = getZoneName(x,y,z) local textwidth = dxGetTextWidth(zone, 1.02,"default-bold") dxDrawRectangle(s[1]*50/1440, s[2]*820/900,s[1]*(textwidth+25)/1440,s[2]*30/900,tocolor(0,0,0,120),true) dxDrawText ( zone, s[1]*63/1440, s[2]*828/900,s[1]*(textwidth+25)/1440,s[2]*30/900, tocolor ( 255, 255, 255, 255 ), 1.02, "default-bold", "left", "top",false,false,true,false,true, 0,0,0) if getKeyState("num_add") then if currentZoomState - 0.01 < 0.5 then return else currentZoomState = currentZoomState - 0.03 end elseif getKeyState("num_sub") then if currentZoomState + 0.01 > 1.5 then return else currentZoomState = currentZoomState + 0.03 end end end ) end)
Tete omar Posted March 17, 2014 Posted March 17, 2014 I'd say try contacting the resource author, or just wait for the other users to help you out, sorry, i couldn't help you as I'm not ready for reading the whole code
Anubhav Posted March 17, 2014 Posted March 17, 2014 Post the whole error . He did. Error is: the debugsdcript says this error on this line 9 Local MimgW, MimgH = dxGetMaterialSize (mapRadar) in MimgW Ready the whole message then reply.
iPrestege Posted March 17, 2014 Posted March 17, 2014 Post the whole error . He did. Error is: the debugsdcript says this error on this line 9 Local MimgW, MimgH = dxGetMaterialSize (mapRadar) in MimgW Ready the whole message then reply. Huh? Where's the whole error such : ERROR: call: failed to call 'ID_System:getPlayerFromPartialName' [string "?"] And please if you want to ask me about something leave the topic in a corner and tell me what you want via 'PM' !
Gallagher Posted March 17, 2014 Author Posted March 17, 2014 error --// Created by KryPtoHolYx --\\ local s = {guiGetScreenSize()} local icons = {} for k = 1,65 do icons[k] = dxCreateTexture("blips/"..k..".png") end local blips = {} addEventHandler( "onClientResourceStart", getRootElement( ),function (res) if res ~= getThisResource() then return end radarTexture = dxCreateTexture("radar.jpg") currentZoomState = 0.5 local width, height = 1200,1200 radar = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900 ) mapRadar = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900,true ) radararea = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900,true ) pathmap = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900,true ) local MimgW,MimgH = dxGetMaterialSize(mapRadar) setTimer(function () blips = {} for i, v in ipairs( getElementsByType('blip') ) do local icon = getBlipIcon(v) if icon > 3 then local px,py = getElementPosition(v) local blip_x = (3000+px)/6000*MimgW local blip_y = (3000-py)/6000*MimgH local rot = getPedCameraRotation( localPlayer ) table.insert(blips,{x = blip_x, y = blip_y,icon = icon}) end end end,10000,0) addEventHandler ("onClientPreRender",root, function () dxSetRenderTarget( mapRadar,true ) dxDrawImage (0,0,MimgW,MimgH, radarTexture) for i, v in ipairs( blips ) do local rot = getPedCameraRotation( localPlayer ) dxDrawImage(v.x-20/2, v.y-20/2, 20, 20,icons[v.icon],rot) end for i, v in ipairs(getElementsByType('player') ) do if v ~= localPlayer then local r,g,b = 20,200,20 or getPlayerNametagColor(v) local px,py = getElementPosition(v) local p_x = (3000+px)/6000*MimgW local p_y = (3000-py)/6000*MimgH local prot = getPedRotation( v ) local p_blipsize = 20-currentZoomState dxDrawImage (p_x-p_blipsize/2,p_y-p_blipsize/2,p_blipsize,p_blipsize, icons[3],-prot,0,0,tocolor(r,g,b)) end end dxSetRenderTarget( ) dxSetRenderTarget( radararea,true ) for i, v in ipairs( getElementsByType('radararea') ) do local r,g,b,a = getRadarAreaColor(v) local w,h = getRadarAreaSize(v) x,y = getElementPosition(v) x = x / (6000 / MimgW) + MimgW/2 y = y / (-6000/ MimgH) + MimgH/2 dxDrawRectangle(x, (y-h) + 4 + (h/2), (w/2), (h/2), tocolor(r,g,b,a)) end dxSetRenderTarget( ) dxSetRenderTarget( radar,true ) local x,y,z = getElementPosition(localPlayer) local rot = getPedCameraRotation( localPlayer ) local mapx = x / (6000/MimgW) + MimgW/2 - width*currentZoomState/2 local mapy = y / (-6000/MimgH) + MimgH/2 - height*currentZoomState/2 dxDrawImageSection (0,0,width,height,mapx,mapy,width*currentZoomState,height*currentZoomState,mapRadar,-rot) dxDrawImageSection (0,0,width,height,mapx,mapy,width*currentZoomState,height*currentZoomState,radararea,-rot) dxDrawImageSection (0,0,width,height,mapx,mapy,width*currentZoomState,height*currentZoomState,pathmap,-rot) local px,py = getElementPosition(localPlayer) local prot = getPedRotation( localPlayer ) local pblipsize = 20 - currentZoomState dxDrawImage (width/2-pblipsize/2,height/2-pblipsize/2,pblipsize,pblipsize, icons[3],-rot-prot) dxSetRenderTarget() showPlayerHudComponent("radar",false) dxDrawImageSection(s[1]*50/1440, s[2]*650/900, s[1]*300/1440, s[2]*200/900, 450,490, 300, 200,radar, 0, -90, 0, tocolor(255, 255, 255, 255),true) dxDrawRectangle(s[1]*50/1440, s[2]*650/900,s[1]*300/1440,s[2]*2/900,tocolor(0,0,0,255),true) dxDrawRectangle(s[1]*50/1440, s[2]*850/900,s[1]*300/1440,s[2]*2/900,tocolor(0,0,0,255),true) dxDrawRectangle(s[1]*350/1440, s[2]*650/900,s[1]*2/1440,s[2]*202/900,tocolor(0,0,0,255),true) dxDrawRectangle(s[1]*50/1440, s[2]*650/900,s[1]*2/1440,s[2]*200/900,tocolor(0,0,0,255),true) local x,y,z = getElementPosition(localPlayer) local zone = getZoneName(x,y,z) local textwidth = dxGetTextWidth(zone, 1.02,"default-bold") dxDrawRectangle(s[1]*50/1440, s[2]*820/900,s[1]*(textwidth+25)/1440,s[2]*30/900,tocolor(0,0,0,120),true) dxDrawText ( zone, s[1]*63/1440, s[2]*828/900,s[1]*(textwidth+25)/1440,s[2]*30/900, tocolor ( 255, 255, 255, 255 ), 1.02, "default-bold", "left", "top",false,false,true,false,true, 0,0,0) if getKeyState("num_add") then if currentZoomState - 0.01 < 0.5 then return else currentZoomState = currentZoomState - 0.03 end elseif getKeyState("num_sub") then if currentZoomState + 0.01 > 1.5 then return else currentZoomState = currentZoomState + 0.03 end end end ) end)
Castillo Posted March 17, 2014 Posted March 17, 2014 local MimgW,MimgH = dxGetMaterialSize(mapRadar) Remove the "local" infront of it.
Gallagher Posted March 17, 2014 Author Posted March 17, 2014 local MimgW,MimgH = dxGetMaterialSize(mapRadar) Remove the "local" infront of it. error http://prntscr.com/31olj8
Gallagher Posted March 17, 2014 Author Posted March 17, 2014 Post the new code. --// Created by KryPtoHolYx --\\ local s = {guiGetScreenSize()} local icons = {} for k = 1,65 do icons[k] = dxCreateTexture("blips/"..k..".png") end local blips = {} addEventHandler( "onClientResourceStart", getRootElement( ),function (res) if res ~= getThisResource() then return end radarTexture = dxCreateTexture("radar.jpg") currentZoomState = 0.5 local width, height = 1200,1200 radar = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900 ) mapRadar = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900,true ) radararea = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900,true ) pathmap = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900,true ) --local MimgW,MimgH = dxGetMaterialSize(radarTexture) MimgW, MimgH = dxGetMaterialSize(mapRadar) setTimer(function () blips = {} for i, v in ipairs( getElementsByType('blip') ) do local icon = getBlipIcon(v) if icon > 3 then local px,py = getElementPosition(v) local blip_x = (3000+px)/6000*MimgW local blip_y = (3000-py)/6000*MimgH local rot = getPedCameraRotation( localPlayer ) table.insert(blips,{x = blip_x, y = blip_y,icon = icon}) end end end,10000,0) addEventHandler ("onClientPreRender",root, function () dxSetRenderTarget( mapRadar,true ) dxDrawImage (0,0,MimgW,MimgH, radarTexture) for i, v in ipairs( blips ) do local rot = getPedCameraRotation( localPlayer ) dxDrawImage(v.x-20/2, v.y-20/2, 20, 20,icons[v.icon],rot) end for i, v in ipairs(getElementsByType('player') ) do if v ~= localPlayer then local r,g,b = 20,200,20 or getPlayerNametagColor(v) local px,py = getElementPosition(v) local p_x = (3000+px)/6000*MimgW local p_y = (3000-py)/6000*MimgH local prot = getPedRotation( v ) local p_blipsize = 20-currentZoomState dxDrawImage (p_x-p_blipsize/2,p_y-p_blipsize/2,p_blipsize,p_blipsize, icons[3],-prot,0,0,tocolor(r,g,b)) end end dxSetRenderTarget( ) dxSetRenderTarget( radararea,true ) for i, v in ipairs( getElementsByType('radararea') ) do local r,g,b,a = getRadarAreaColor(v) local w,h = getRadarAreaSize(v) x,y = getElementPosition(v) x = x / (6000 / MimgW) + MimgW/2 y = y / (-6000/ MimgH) + MimgH/2 dxDrawRectangle(x, (y-h) + 4 + (h/2), (w/2), (h/2), tocolor(r,g,b,a)) end dxSetRenderTarget( ) dxSetRenderTarget( radar,true ) local x,y,z = getElementPosition(localPlayer) local rot = getPedCameraRotation( localPlayer ) local mapx = x / (6000/MimgW) + MimgW/2 - width*currentZoomState/2 local mapy = y / (-6000/MimgH) + MimgH/2 - height*currentZoomState/2 dxDrawImageSection (0,0,width,height,mapx,mapy,width*currentZoomState,height*currentZoomState,mapRadar,-rot) dxDrawImageSection (0,0,width,height,mapx,mapy,width*currentZoomState,height*currentZoomState,radararea,-rot) dxDrawImageSection (0,0,width,height,mapx,mapy,width*currentZoomState,height*currentZoomState,pathmap,-rot) local px,py = getElementPosition(localPlayer) local prot = getPedRotation( localPlayer ) local pblipsize = 20 - currentZoomState dxDrawImage (width/2-pblipsize/2,height/2-pblipsize/2,pblipsize,pblipsize, icons[3],-rot-prot) dxSetRenderTarget() showPlayerHudComponent("radar",false) dxDrawImageSection(s[1]*50/1440, s[2]*650/900, s[1]*300/1440, s[2]*200/900, 450,490, 300, 200,radar, 0, -90, 0, tocolor(255, 255, 255, 255),true) dxDrawRectangle(s[1]*50/1440, s[2]*650/900,s[1]*300/1440,s[2]*2/900,tocolor(0,0,0,255),true) dxDrawRectangle(s[1]*50/1440, s[2]*850/900,s[1]*300/1440,s[2]*2/900,tocolor(0,0,0,255),true) dxDrawRectangle(s[1]*350/1440, s[2]*650/900,s[1]*2/1440,s[2]*202/900,tocolor(0,0,0,255),true) dxDrawRectangle(s[1]*50/1440, s[2]*650/900,s[1]*2/1440,s[2]*200/900,tocolor(0,0,0,255),true) local x,y,z = getElementPosition(localPlayer) local zone = getZoneName(x,y,z) local textwidth = dxGetTextWidth(zone, 1.02,"default-bold") dxDrawRectangle(s[1]*50/1440, s[2]*820/900,s[1]*(textwidth+25)/1440,s[2]*30/900,tocolor(0,0,0,120),true) dxDrawText ( zone, s[1]*63/1440, s[2]*828/900,s[1]*(textwidth+25)/1440,s[2]*30/900, tocolor ( 255, 255, 255, 255 ), 1.02, "default-bold", "left", "top",false,false,true,false,true, 0,0,0) if getKeyState("num_add") then if currentZoomState - 0.01 < 0.5 then return else currentZoomState = currentZoomState - 0.03 end elseif getKeyState("num_sub") then if currentZoomState + 0.01 > 1.5 then return else currentZoomState = currentZoomState + 0.03 end end end ) end)
Castillo Posted March 17, 2014 Posted March 17, 2014 It doesn't show any error here, it works perfectly fine.
Gallagher Posted March 17, 2014 Author Posted March 17, 2014 It doesn't show any error here, it works perfectly fine. should look like
Gallagher Posted March 17, 2014 Author Posted March 17, 2014 I guess the blip is too big, that's why. https://community.multitheftauto.com/index.php?p= ... ls&id=8883 you downloaded the resource?
Castillo Posted March 17, 2014 Posted March 17, 2014 I'm confused, what is the problem now? because you earlier posted some script errors, but they didn't appear when I tested it.
Gallagher Posted March 17, 2014 Author Posted March 17, 2014 I'm confused, what is the problem now? because you earlier posted some script errors, but they didn't appear when I tested it. the script worked for you? did not work for me
Gallagher Posted March 17, 2014 Author Posted March 17, 2014 Yes, it works fine. original or changed you? can send me your pm or by at 4shared?
Gallagher Posted March 17, 2014 Author Posted March 17, 2014 (edited) https://www.mediafire.com/?9he895y5f5ivdbt for some reason your script also giving this error. Is it a problem to resolution? what is your resolution? Edited March 17, 2014 by Guest
Castillo Posted March 17, 2014 Posted March 17, 2014 Add this after dxGetMaterialSize: outputChatBox ( tostring ( dxGetStatus ( ).VideoMemoryFreeForMTA ) ) ) And post the result.
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