Jump to content

xX][ مشكلة صغيرة في لوحة حفظ الملابس][Xx


mr.sony

Recommended Posts

السلام عليكم ورحمة الله

:عندي مشكلة صغيرة في لوحة حفظ الملابس

المود شغال كويس بس لما يدخل اللاعب السيرفر يضع له شخصية سي جي  

بطرح لكم ملف سيرفر وكلنت

: ملف سيرفر 

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("", source, 0, 255, 0)
		textures = {}
		models = {}
	end
end
addEventHandler("onPlayerLogin", getRootElement(), setClothes)

function loadClothes()
	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("* تم إستعادة ملابسك المحفوظة *", source, 0, 255, 0)
		textures = {}
		models = {}
	else
		outputChatBox("* يرجى تسجيل الدخول أولا *", source, 255, 0, 0)
	end
end
addEvent( "backcj", true )
addEventHandler( "backcj", root, loadClothes )

function saveClothes()
	local account = getPlayerAccount(source)
	if ( not isGuestAccount(account) ) then
		if ( 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 = {}
		else
			outputChatBox("* يرجى وضع شخصية رقم 0 لحفظ الملابس *", source, 255, 0, 0)
		end
	else
		outputChatBox("* يرجى تسجيل الدخول أولا *", source, 255, 0, 0)
	end
end
addEvent( "savecj", true )
addEventHandler( "savecj", root, saveClothes )

: ملف كلنتت


GUIEditor = {
    button = {},
    window = {},
    staticimage = {},
    label = {}
}
cj = guiCreateWindow(481, 289, 404, 191, "❖ 『لوحـة حفـظ المـلابـس』❖", false)
guiWindowSetSizable(cj, false)
guiSetAlpha(cj, 1.00)
guiSetProperty(cj, "CaptionColour", "FF00FFDE")

savecj = guiCreateButton(76, 32, 250, 53, "❍【 حفـظ ملابسـي 】❍", false, cj)
guiSetProperty(savecj, "NormalTextColour", "FF23FF00")
backcj = guiCreateButton(76, 95, 250, 53, "❍【 إستعـادة مـلابسـي المحفوظـة 】❍", false, cj)
guiSetProperty(backcj, "NormalTextColour", "FFFEDD00")
Close_cj = guiCreateButton(363, 158, 28, 21, "✘", false, cj)
guiSetProperty(Close_cj, "NormalTextColour", "FFFF0000")
cjlabel = guiCreateLabel(16, 163, 92, 18, "By: MƬA ƑἷLMЄَƳ", false, cj)
guiSetAlpha(cj, 1.00)
guiSetAlpha(savecj, 1.00)
guiSetAlpha(backcj, 1.00)
guiSetVisible(cj, false)




addCommandHandler("حفظ الملابس",function ( )
    guiSetVisible(cj,not guiGetVisible(cj))
    showCursor(guiGetVisible(cj))
     guiMoveRightToCenter(cj)
end)
addEventHandler("onClientGUIClick",root,function() --عند الضغط على زر باللوحة
	if (source ==Close_cj) then --يتحقق من اسم الزر
	guiSetVisible(cj,false) -- اغلاق اللوحة
		showCursor(false) --اخفاء الماوس
		guiSetInputEnabled(false)
	end
end)



addEventHandler ( "onClientGUIClick", root,
    function ( )
        if ( source == savecj ) then
                triggerServerEvent ( "savecj", localPlayer )
            end
end)

      addEventHandler ( "onClientGUIClick", root,
    function ( )
        if ( source == backcj ) then
                triggerServerEvent ( "backcj", localPlayer )
            end
end)

 
    TimeGuiSetRightC = { }
 
    function guiMoveRightToCenter(gui)
    if getElementData(gui,"HelhGui") == false then
        setElementData(gui,"HelhGui",true)
        local s1,s2=guiGetScreenSize()
        local w1,w2=guiGetSize(gui,false)
        local x,y = (s1-w1)/2,(s2-w2)/2
        guiSetPosition(gui,-x,y,false)
    TimeGuiSetRightC[gui] = setTimer(guiMoveRightToCenter,50,0,gui)
    end
        local a,b=guiGetScreenSize()
        local w1,w2=guiGetSize(gui,false)
        local x,y = (a-w1)/2,(b-w2)/2
        local x1,y1 = guiGetPosition ( gui, false)
    if (x1 >= x) then
        killTimer(TimeGuiSetRightC[gui])
        setElementData(gui,"HelhGui",false)
        else
        guiSetPosition(gui,x1+20,y,false)
    end
    end
	

 

Link to comment
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)
		for i=0, 17, 1 do
			if ( textures[i+1] ~= " " ) then
				addPedClothes(source, textures[i+1], models[i+1], i)
			end
		end
		outputChatBox("", source, 0, 255, 0)
		textures = {}
		models = {}
	end
end
addEventHandler("onPlayerLogin", getRootElement(), setClothes)

function loadClothes()
	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)
		for i=0, 17, 1 do
			if ( textures[i+1] ~= " " ) then
				addPedClothes(source, textures[i+1], models[i+1], i)
			end
		end
		outputChatBox("* تم إستعادة ملابسك المحفوظة *", source, 0, 255, 0)
		textures = {}
		models = {}
	else
		outputChatBox("* يرجى تسجيل الدخول أولا *", source, 255, 0, 0)
	end
end
addEvent( "backcj", true )
addEventHandler( "backcj", root, loadClothes )

function saveClothes()
	local account = getPlayerAccount(source)
	if ( not isGuestAccount(account) ) then
		if ( 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 = {}
		else
			outputChatBox("* يرجى وضع شخصية رقم 0 لحفظ الملابس *", source, 255, 0, 0)
		end
	else
		outputChatBox("* يرجى تسجيل الدخول أولا *", source, 255, 0, 0)
	end
end
addEvent( "savecj", true )
addEventHandler( "savecj", root, saveClothes )

- سيرفر
جرب وعطني خبر

Edited by #Himoo
Link to comment
On ١٢‏/١٠‏/٢٠١٧ at 03:10, #Himoo 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 = {}	endendaddEventHandler("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)		for i=0, 17, 1 do			if ( textures[i+1] ~= " " ) then				addPedClothes(source, textures[i+1], models[i+1], i)			end		end		outputChatBox("", source, 0, 255, 0)		textures = {}		models = {}	endendaddEventHandler("onPlayerLogin", getRootElement(), setClothes)function loadClothes()	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)		for i=0, 17, 1 do			if ( textures[i+1] ~= " " ) then				addPedClothes(source, textures[i+1], models[i+1], i)			end		end		outputChatBox("* تم إستعادة ملابسك المحفوظة *", source, 0, 255, 0)		textures = {}		models = {}	else		outputChatBox("* يرجى تسجيل الدخول أولا *", source, 255, 0, 0)	endendaddEvent( "backcj", true )addEventHandler( "backcj", root, loadClothes )function saveClothes()	local account = getPlayerAccount(source)	if ( not isGuestAccount(account) ) then		if ( 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 = {}		else			outputChatBox("* يرجى وضع شخصية رقم 0 لحفظ الملابس *", source, 255, 0, 0)		end	else		outputChatBox("* يرجى تسجيل الدخول أولا *", source, 255, 0, 0)	endendaddEvent( "savecj", true )addEventHandler( "savecj", root, saveClothes )

- سيرفر
جرب وعطني خبر

حطيت الكود في ملف سيرفر بس صار ما يستعيد الملابس ولا يحفظ لما اضغط مايصير شي

هذي صورة للدي بق  

p_650v0f5u1.png

 

Link to comment
Just now, mr.sony said:

حطيت الكود في ملف سيرفر بس صار ما يستعيد الملابس ولا يحفظ لما اضغط مايصير شي

هذي صورة للدي بق  

p_650v0f5u1.png

 

ع ضمن المشكله في ارسال الـ trigger

triggerاطرح اكواد الـ 

حق الكلنت ..

Link to comment
23 hours ago, iMr ~ MnHmAr said:

ع ضمن المشكله في ارسال الـ trigger

triggerاطرح اكواد الـ 

حق الكلنت ..

addEventHandler ( "onClientGUIClick", root,
    function ( )
        if ( source == savecj ) then
                triggerServerEvent ( "savecj", localPlayer )
            end
end)

      addEventHandler ( "onClientGUIClick", root,
    function ( )
        if ( source == backcj ) then
                triggerServerEvent ( "backcj", localPlayer )
            end
end)

 

Link to comment
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)
		for i=0, 17, 1 do
			if ( textures[i+1] ~= " " ) then
				addPedClothes(source, textures[i+1], models[i+1], i)
			end
		end
		outputChatBox("", source, 0, 255, 0)
		textures = {}
		models = {}
	end
end
addEventHandler("onPlayerLogin", getRootElement(), setClothes)

function loadClothes()
	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("* تم إستعادة ملابسك المحفوظة *", source, 0, 255, 0)
		textures = {}
		models = {}
	else
		outputChatBox("* يرجى تسجيل الدخول أولا *", source, 255, 0, 0)
	end
end
addEvent( "backcj", true )
addEventHandler( "backcj", root, loadClothes )

function saveClothes()
	local account = getPlayerAccount(source)
	if ( not isGuestAccount(account) ) then
		if ( 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 = {}
		else
			outputChatBox("* يرجى وضع شخصية رقم 0 لحفظ الملابس *", source, 255, 0, 0)
		end
	else
		outputChatBox("* يرجى تسجيل الدخول أولا *", source, 255, 0, 0)
	end
end
addEvent( "savecj", true )
addEventHandler( "savecj", root, saveClothes )

جررب ذا

Link to comment
On ١٢‏/١٠‏/٢٠١٧ at 10:50, iMr ~ MnHmAr 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 = {}	endendaddEventHandler("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)		for i=0, 17, 1 do			if ( textures[i+1] ~= " " ) then				addPedClothes(source, textures[i+1], models[i+1], i)			end		end		outputChatBox("", source, 0, 255, 0)		textures = {}		models = {}	endendaddEventHandler("onPlayerLogin", getRootElement(), setClothes)function loadClothes()	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("* تم إستعادة ملابسك المحفوظة *", source, 0, 255, 0)		textures = {}		models = {}	else		outputChatBox("* يرجى تسجيل الدخول أولا *", source, 255, 0, 0)	endendaddEvent( "backcj", true )addEventHandler( "backcj", root, loadClothes )function saveClothes()	local account = getPlayerAccount(source)	if ( not isGuestAccount(account) ) then		if ( 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 = {}		else			outputChatBox("* يرجى وضع شخصية رقم 0 لحفظ الملابس *", source, 255, 0, 0)		end	else		outputChatBox("* يرجى تسجيل الدخول أولا *", source, 255, 0, 0)	endendaddEvent( "savecj", true )addEventHandler( "savecj", root, saveClothes )

جررب ذا

%يسلمووووووووو شغال 100

:x

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