Jump to content

CJ Clothes


murilo2929

Recommended Posts

4 hours ago, Kenix said:
function saveClothes()
	local account = getPlayerAccount(source)
	if ( not isGuestAccount(account) ) and ( getElementModel(source) == 0 ) then
		local texture = {}
		local model = {}
		for i=0, 17, 1 do
			local clothesTexture, clothesModel = getPedClothes(source, i)
			if ( clothesTexture ~= false ) then
				table.insert(texture, clothesTexture)
				table.insert(model, clothesModel)
			else
				table.insert(texture, " ")
				table.insert(model, " ")
			end	
		end
		local allTextures = table.concat(texture, ",")
		local allModels = table.concat(model, ",")
		outputDebugString("Clothessaver: Saved clothes")
		setAccountData(account, "Clothessaver:Texture", allTextures)
		setAccountData(account, "Clothessaver:Model", allModels)
		texture = {}
		model = {}
	end
end
addEventHandler("onPlayerQuit", getRootElement(), saveClothes)

function setClothes()
	local account = getPlayerAccount(source)
	if ( not isGuestAccount(account) ) then
		local textureString = getAccountData(account, "Clothessaver:Texture")
		local modelString = getAccountData(account, "Clothessaver:Model")
		local textures = split(textureString, 44)
		local models = split(modelString, 44)
		setElementModel(source,0)
		for i=0, 17, 1 do
			if ( textures[i+1] ~= " " ) then
				addPedClothes(source, textures[i+1], models[i+1], i)
			end
		end
		outputChatBox("Clothes were added by clothessaver", source, 0, 255, 0)
		textures = {}
		models = {}
	end
end
addEventHandler("onPlayerLogin", getRootElement(), setClothes)

i try like this and don't work

Link to comment
function saveNewClothing(player)
	for type=0,17 do
		local texture, model = getPedClothes(player, type)
		setAccountData(getPlayerAccount(player),"clothes_".. type,tostring(texture) ..",".. tostring(model))
	end
end

---- LOGIN

	function loadClothes(player)
skin = getElementModel(player)

			if tonumber(skin) == 0 then
	setTimer(function (source)
		for type=0, 17 do
			local info = getAccountData(account,"clothes_".. type)
			if info then
			local info = split(info, ",")
				if (info[1] and info[2]) then
					addPedClothes(source, tostring(info[1]), tostring(info[2]), type)
				end
			end
		end
	end, 2000, 1, source)
end

 

Link to comment
8 hours ago, Network said:

function saveNewClothing(player)
	for type=0,17 do
		local texture, model = getPedClothes(player, type)
		setAccountData(getPlayerAccount(player),"clothes_".. type,tostring(texture) ..",".. tostring(model))
	end
end

---- LOGIN


	function loadClothes(player)
skin = getElementModel(player)

			if tonumber(skin) == 0 then
	setTimer(function (source)
		for type=0, 17 do
			local info = getAccountData(account,"clothes_".. type)
			if info then
			local info = split(info, ",")
				if (info[1] and info[2]) then
					addPedClothes(source, tostring(info[1]), tostring(info[2]), type)
				end
			end
		end
	end, 2000, 1, source)
end

 

2019-10-23 09:01:08] QUIT: ADMIN_STAR left the game [Quit]
[2019-10-23 09:01:09] WARNING: account\login_s.Lua:140: Bad argument @ 'getPedClothes' [Expected ped at argument 1, got string 'Quit']
[2019-10-23 09:01:09] WARNING: account\login_s.Lua:141: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got string 'Quit']
[2019-10-23 09:01:09] WARNING: account\login_s.Lua:141: Bad argument @ 'setAccountData' [Expected account at argument 1, got boolean]
[2019-10-23 09:01:15] WARNING: account\login_s.Lua:140: Bad argument @ 'getPedClothes' [Expected ped at argument 1, got string 'Quit']  [DUP x17]
[2019-10-23 09:01:15] WARNING: account\login_s.Lua:141: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got string 'Quit']  [DUP x17]
[2019-10-23 09:01:15] WARNING: account\login_s.Lua:141: Bad argument @ 'setAccountData' [Expected account at argument 1, got boolean]  [DUP x17]

that error  appear when i exit

Link to comment
addEventHandler("onPlayerQuit",root,function()
saveNewClothing(source)
end)

 

5 hours ago, murilo2929 said:

2019-10-23 09:01:08] QUIT: ADMIN_STAR left the game [Quit]
[2019-10-23 09:01:09] WARNING: account\login_s.Lua:140: Bad argument @ 'getPedClothes' [Expected ped at argument 1, got string 'Quit']
[2019-10-23 09:01:09] WARNING: account\login_s.Lua:141: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got string 'Quit']
[2019-10-23 09:01:09] WARNING: account\login_s.Lua:141: Bad argument @ 'setAccountData' [Expected account at argument 1, got boolean]
[2019-10-23 09:01:15] WARNING: account\login_s.Lua:140: Bad argument @ 'getPedClothes' [Expected ped at argument 1, got string 'Quit']  [DUP x17]
[2019-10-23 09:01:15] WARNING: account\login_s.Lua:141: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got string 'Quit']  [DUP x17]
[2019-10-23 09:01:15] WARNING: account\login_s.Lua:141: Bad argument @ 'setAccountData' [Expected account at argument 1, got boolean]  [DUP x17]

that error  appear when i exit

 

Link to comment
3 hours ago, Network said:

addEventHandler("onPlayerQuit",root,function()saveNewClothing(source)end)

 

 

[2019-10-23 18:43:17] QUIT: ADMIN_STAR left the game [Quit]
[2019-10-23 18:43:17] WARNING: account\s_login.Lua:107: Bad argument @ 'getPedClothes' [Expected ped at argument 1, got nil]
[2019-10-23 18:43:17] WARNING: account\s_login.Lua:108: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil]
[2019-10-23 18:43:17] WARNING: account\s_login.Lua:108: Bad argument @ 'setAccountData' [Expected account at argument 1, got boolean]
[2019-10-23 18:43:17] WARNING: account\s_login.Lua:107: Bad argument @ 'getPedClothes' [Expected ped at argument 1, got nil]  [DUP x17]
[2019-10-23 18:43:17] WARNING: account\s_login.Lua:108: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil]  [DUP x17]
[2019-10-23 18:43:17] WARNING: account\s_login.Lua:108: Bad argument @ 'setAccountData' [Expected account at argument 1, got boolean]  [DUP x17]
[2019-10-23 18:43:17] ERROR: account\s_login.Lua:139: attempt to call global 'saveNewClothing' (a nil value)

 

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