Jump to content

help in personal car mod


nasserdfdd

Recommended Posts

hi all so i made personal skin mod so how can i make it for vehs i need some one to give me any example pls

server

    addEvent("skins.SonApplyToAllServer", true ) 
    function applyitdude(val, player) 
        triggerClientEvent(root, "skins.onApplyToAllServer", root, val, player) 
end 
    addEventHandler("skins.SonApplyToAllServer", root, applyitdude) 
        addEvent("skins.SunApplyToAllServer", true ) 
    function unapplyitdude(val, player) 
        triggerClientEvent(root, "skins.unApplyToAllServer", root, val, player) 
end 
    addEventHandler("skins.SunApplyToAllServer", root, unapplyitdude) 
  
  
  

client

shaders = {} 
names = {} 
textures = {} 
applied = {} 
plrs = { 
{ acc = "test", texture= "test.png", shader= "texture.fx", num = 1, worldname = "cwmohb2" }, 
  
  
  
}   
  
  addEventHandler( "onClientResourceStart", resourceRoot, 
        function() 
  
       for i,val in ipairs(plrs) do 
            perfectname = val.acc..""..val.num 
                        textures[perfectname] = dxCreateTexture ( val.texture ) 
            shaders[perfectname] = dxCreateShader( val.shader,999999, 0, false, "ped" ) 
           names[perfectname] = val.worldname 
           dxSetShaderValue ( shaders[perfectname], "Tex0", textures[perfectname] ) 
        --   engineApplyShaderToWorldTexture ( shaders[perfectname], val.worldname ) 
            --bit of sanity checking 
            if not shaders[perfectname] then 
                outputDebugString( "Could not create shader. Please use debugscript 3" ) 
                destroyElement( textures[perfectname] ) 
                return 
            elseif not textures[perfectname] then 
                outputDebugString( "loading texture failed" ) 
                destroyElement ( shaders[perfectname] ) 
                tec = nil 
                return 
            end 
            
        end 
        end 
    ) 
  
                function groupskinapply(cmd,num) 
                 
                local grp = getElementData(localPlayer,"accname") 
                local perfectname = grp..""..num 
                if not shaders[perfectname] then exports.trivia:sMessage("No custom shader found!",255,0,0) end 
                if not grp then outputChatBox("You need to login!",255,0,0) end 
            if grp and grp ~= "" and shaders[perfectname]  then 
                if applied[perfectname] then 
                triggerServerEvent("skins.SunApplyToAllServer", root, perfectname, theplayer) 
                applied[perfectname] = nil 
                return end 
                theplayer = localPlayer 
                val = plrs[1] 
                applied[perfectname] = true 
                triggerServerEvent("skins.SonApplyToAllServer", root, perfectname, theplayer) 
exports.trivia:sMessage("Your custom skin has been applied",0,255,0) 
                end 
                end 
    addCommandHandler("skinshader", groupskinapply) 
     
     
    addEvent("skins.onApplyToAllServer", true ) 
    function applyitdude(val, player) 
         
                                                        bool1 = engineApplyShaderToWorldTexture ( shaders[val], names[val], player ) 
                                                        if not bool1 then outputChatBox("",255,0,0) end 
    end 
    addEventHandler("skins.onApplyToAllServer", root, applyitdude) 
     
    addEvent("skins.unApplyToAllServer", true ) 
    function unapplyitdude(val, player) 
         
                                                        bool1 = engineRemoveShaderFromWorldTexture ( shaders[val], names[val], player ) 
                                                        if not bool1 then outputChatBox("",255,0,0) end 
    end 
    addEventHandler("skins.unApplyToAllServer", root, unapplyitdude) 
  
  
  
  
  
  

Link to comment
pls help guys

So what seems to be the problem ? Remember that your vehicle already has to have paintjob texture. Texture state 0 is usually reserved for dirt texture. So find a proper vehicle first. The simplest effect that replaces the texture0 would be:

texture Tex0; 
  
technique simple 
{ 
    pass P0 
    { 
        Texture[0] = Tex0; 
    } 
} 

I haven't checked if your lua code works properly. I noticed is that you set a high number for effect range. You don't need to set it to 9999 - if you want it unlimited then just set to 0. Also if effect is done for vehicles then change the entity type "ped" to "vehicle". applyShaderToWorldTexture should point "grunSomethingIdontRemember" texture name, and the vehicle element.

I will not give you any ready solutions. You will just need to learn a bit of scripting. The shader stuff here is almost non existing.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...