MajdMTA Posted February 7, 2016 Posted February 7, 2016 (edited) 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 February 8, 2016 by Guest
MajdMTA Posted February 7, 2016 Author Posted February 7, 2016 If server side is needed tell me guys. also, I tried alot of times, It's didn't work in both client and server
ViRuZGamiing Posted February 7, 2016 Posted February 7, 2016 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.
Dimos7 Posted February 10, 2016 Posted February 10, 2016 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)
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