Jump to content

About skins. [Small. Help]


MajdMTA

Recommended Posts

Hello mates, after CSF scripts shared, I've downloaded there Group skins script, I wanna add for it when player reconnect the skin will be saved, You can help me guys? Client Side:

  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] ) 
        --   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,"Group") 
                local perfectname = grp..""..num 
            if grp and grp ~= "" and shaders[perfectname]  then 
                if applied[perfectname] then 
                triggerServerEvent("SunApplyToAllServer", root, perfectname, theplayer) 
                applied[perfectname] = nil 
                return end 
                theplayer = localPlayer 
                val = groups[1] 
                applied[perfectname] = true 
                triggerServerEvent("SonApplyToAllServer", root, perfectname, theplayer) 
exports.dendxmsg:createNewDxMessage("Group Skin : On ",0,255,0) 
                end 
                end 
    addCommandHandler("customskin", groupskinapply) 
     
     
    addEvent("onApplyToAllServer", true ) 
    function applyitdude(val, player) 
         
                                                        bool1 = engineApplyShaderToWorldTexture ( shaders[val], names[val], player ) 
---                                                     if not bool1 then outputChatBox("CIS <3",255,0,0) end 
    end 
    addEventHandler("onApplyToAllServer", root, applyitdude) 
     
    addEvent("unApplyToAllServer", true ) 
    function unapplyitdude(val, player) 
         
                                                        bool1 = engineRemoveShaderFromWorldTexture ( shaders[val], names[val], player ) 
                                                        if not bool1 then outputChatBox("CIS <3",255,0,0) end 
    end 
    addEventHandler("unApplyToAllServer", root, unapplyitdude) 

Edited by Guest
Link to comment
Can you put the code in the lua-function?
  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] ) 
        --   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,"Group") 
                local perfectname = grp..""..num 
            if grp and grp ~= "" and shaders[perfectname]  then 
                if applied[perfectname] then 
                triggerServerEvent("SunApplyToAllServer", root, perfectname, theplayer) 
                applied[perfectname] = nil 
                return end 
                theplayer = localPlayer 
                val = groups[1] 
                applied[perfectname] = true 
                triggerServerEvent("SonApplyToAllServer", root, perfectname, theplayer) 
exports.dendxmsg:createNewDxMessage("Group Skin : On ",0,255,0) 
                end 
                end 
    addCommandHandler("customskin", groupskinapply) 
    
    
    addEvent("onApplyToAllServer", true ) 
    function applyitdude(val, player) 
        
                                                        bool1 = engineApplyShaderToWorldTexture ( shaders[val], names[val], player ) 
---                                                     if not bool1 then outputChatBox("CIS <3",255,0,0) end 
    end 
    addEventHandler("onApplyToAllServer", root, applyitdude) 
    
    addEvent("unApplyToAllServer", true ) 
    function unapplyitdude(val, player) 
        
                                                        bool1 = engineRemoveShaderFromWorldTexture ( shaders[val], names[val], player ) 
                                                        if not bool1 then outputChatBox("CIS <3",255,0,0) end 
    end 
    addEventHandler("unApplyToAllServer", root, unapplyitdude) 

Just copy paste it but then in LUA tags.

Link to comment
function onLogin(thePreviousAccount, theCurrentAccount, autoLogin) 
    if ~= (isGuestAccount(getPlayerAccount(source))) then 
        local playerskin = getAccountData(theCurrentAccount, "s.skin") 
        setElementModel(source, playerskin) 
    end 
end 
addEventHandler("onPlayerLogin", root, onLogin) 
  
function onQuit(quitType, reason, resposibleElement) 
    if ~=(isGuestAccount(getPlayerAccount(source))) then 
        local account = getPlayerAccount(source) 
        if account then 
          setAccountData(account, "s.skin", tostring(getPedSkin(source))) 
        end 
    end 
end 
addEventHandler("onPlayerQuit", root, onQuit) 

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