Jump to content

Apply a multi skin shader using one command


WiBox

Recommended Posts

groups = {
   { name = "ABC", texture= "skins/ABC.jpg", shader= "groupskinshader.fx", num = "ABC", worldname = "cwmohb2" },
   { name = "ABC", texture= "skins/ABC1.jpg", shader= "groupskinshader.fx", num = "ABC", worldname = "swmotr5" },
} 

addEventHandler( "onClientResourceStart", resourceRoot,
function()
    for i,val in ipairs(groups) do
        perfectname = val.name..""..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] )
        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,val2,num)
    local grp = getElementData(localPlayer,"g")
    local perfectname = grp..""..num
    if grp and grp ~= "" and shaders[perfectname]  then
        if  val2 == "off" then
            if ( applied[perfectname] == nil ) then
		        return
		    end
            triggerServerEvent("SunApplyToAllServer", root, perfectname, theplayer)
            applied[perfectname] = nil
            return 
	    end
		if ( val2 == "on" ) then
	        if ( applied[perfectname] == true ) then
				return
			end
            theplayer = localPlayer
            val = groups[1]
            applied[perfectname] = true
            triggerServerEvent("SonApplyToAllServer", root, perfectname, theplayer)
		end
    end
end
addCommandHandler("customskin", groupskinapply)

That's the part of my script which I need to edit, I could make example, "/customskin on ABC" but it worked for only one skin, I can make it as change the 3 variable, "/customskin on ABC1"  but the thing is I need to apply all the skin using the command once.. Does anyone have a idea?

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...