Mr3b Posted August 1, 2023 Share Posted August 1, 2023 So i am trying to edit a custom plate script to new style but when i use dxSetShaderValue(tex_plates[vehicle], "platetex", rt) The plate show small like this and when i add engineApplyShaderToWorldTexture(tex_plates[vehicle], "plateback*") It show 2 plates the small one and correct one like this Full Code: local color = 0xff111111 local font = dxCreateFont("files/font.ttf", 20, true) local size = 1.5 local tex_plates = {} local raw_shader = [[ texture platetex; technique TECHNIQUE_REPLACE { pass P0 { Texture[0] = platetex; } } ]] -- Load the custom image for the license plate local customPlateTexture = dxCreateTexture("files/plate.png", "dxt5") local function getPlateShader(vehicle) if tex_plates[vehicle] then if isElement(tex_plates[vehicle]) then destroyElement(tex_plates[vehicle]) end tex_plates[vehicle] = nil end local rtWidth, rtHeight = 226, 123 local rt = dxCreateRenderTarget(rtWidth, rtHeight) dxSetRenderTarget(rt) dxDrawImage(0, 0, rtWidth, rtHeight, customPlateTexture) -- Add the custom plate background image dxDrawText("111", 2, 2, 112 + 2, 59 + 2, color, size, font, "center", "center") dxDrawText("R3B", 117, 3, 78 + 117, 58 + 3, color, size, font, "center", "center") dxDrawText("111", 2, 64, 112 + 2, 59 + 64, color, size, font, "center", "center") dxDrawText("R3B", 117, 64, 78 + 117, 58 + 64, color, size, font, "center", "center") dxSetRenderTarget() tex_plates[vehicle] = dxCreateShader(raw_shader) dxSetShaderValue(tex_plates[vehicle], "platetex", rt) -- engineApplyShaderToWorldTexture(tex_plates[vehicle], "plateback*") return tex_plates[vehicle] end local function onStreamIn(vehicle) local shader = getPlateShader(vehicle) engineApplyShaderToWorldTexture(shader, "custom_car_plate", vehicle) end local function onStreamOut(vehicle) if tex_plates[vehicle] then engineRemoveShaderFromWorldTexture(tex_plates[vehicle], "custom_car_plate", vehicle) if isElement(tex_plates[vehicle]) then destroyElement(tex_plates[vehicle]) end tex_plates[vehicle] = nil end end addEventHandler("onClientElementStreamIn", root, function() if getElementType(source) == "vehicle" then onStreamIn(source) end end) addEventHandler("onClientElementStreamOut", root, function() if getElementType(source) == "vehicle" then onStreamOut(source) end end) addEventHandler("onClientResourceStart", resourceRoot, function() local vehicles = getElementsByType("vehicle", root, true) for i = 1, #vehicles do onStreamIn(vehicles[i]) end end) addEventHandler("onClientRestore", root, function(cleared) if cleared then for vehicle in pairs(tex_plates) do onStreamOut(vehicle) onStreamIn(vehicle) end end end) Link to comment
TMTMTL Posted August 1, 2023 Share Posted August 1, 2023 Hi. Try applying a full alpha(0% opacity) texture to the "small" part of the plate to hide it, leaving the large main part of the plate. - TM Link to comment
Mr3b Posted August 2, 2023 Author Share Posted August 2, 2023 Can you provied the code? Link to comment
#!_A7M8D Posted August 2, 2023 Share Posted August 2, 2023 Hello i think that GTA SA Plates consits of two part ( inner , outer ) You can use dxDrawText and create your custom plate Cheers 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