Jump to content

fileCreate -- fileOpen ( مشكلة )


KillerX

Recommended Posts

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

لما استخدم كود انشاء الملف

fileCreate

في الكلنت سايد مش بيظهرلي في الملف حق الريسورس علي عكس السيرفر سايد بيظهر الملف

+

لما استخدم وظيفة هل الملف موجود ولا لا يطلعلي انوا موجود ولما اكتب فيه شئ واجي استرجعوا منوا ما يرجع شئ

محاولة

addCommandHandler( '1' , 
	function(  )
		if ( fileExists( 'test' ) == false ) then
			file = fileCreate( 'test' )
		else
			file = fileOpen( 'test' )
		end
		fileWrite( file , 'testtesttest' )
		text = fileRead( file , fileGetSize( file ) )
		fileClose( file )
		outputChatBox( text )
	end
)

وشكرا علي وقتك : )

Edited by KillerX
Link to comment

في الكلينت راح يتحمل على جهاز الاعب يعني راح تحصله في المودات المحمله

اما في السيرفر السايد فراح يكون على الخادم وبيظهر في ملف السكربت او اذا كان مضغوط بيسوي مجلد بأسم السكربت وبيحط فيه الملف

Link to comment
Just now, Abdul KariM said:

في الكلينت راح يتحمل على جهاز الاعب يعني راح تحصله في المودات المحمله

اما في السيرفر السايد فراح يكون على الخادم وبيظهر في ملف السكربت او اذا كان مضغوط بيسوي مجلد بأسم السكربت وبيحط فيه الملف

تمام طب ليه لما اكتب شئ واجي استرجعوا ما يطلعلي : (

Link to comment
Just now, #_iMr,[E]coo said:

test.txt

ما تغير شئ

addCommandHandler( '1' , 
	function(  )
		if ( fileExists( 'test.txt' ) ) then
			file = fileOpen( 'test.txt' )
		else
			file = fileCreate( 'test.txt' )
		end
		local read = fileRead( file , fileGetSize( file ) )
		if ( read == '' or read == ' ' ) then
			fileWrite( file , 'a\n' )
			outputChatBox( '1' )
		else
			fileWrite( file , read , 'a\n' )
			outputChatBox( '2' )
		end
		local read = fileRead( file , fileGetSize( file ) )
		fileClose( file )
		outputChatBox( tostring( read ) )
	end
)

 

Just now, Abdul KariM said:

في الكلينت راح يتحمل على جهاز الاعب يعني راح تحصله في المودات المحمله

resource-cache قصدك في ملف 

لو قصدك كدا دورت عليه وما حصلته :\

Link to comment
Just now, #_iMr,[E]coo said:

addCommandHandler( '1' , 
	function(  )
		if ( fileExists( 'test.txt' ) == false ) then
			file = fileCreate( 'test.txt' )
		else
			file = fileOpen( 'test.txt' , true )
		end
		fileWrite( file , 'testtesttest' )
		text = fileRead( file , fileGetSize( file ) )
		fileClose( file )
		outputChatBox( text )
	end
)

 

ثاااانكس صار يجيب اللي في الملف 

بس اخر سؤال

وش فايدة ترو في فتح الملف كل اللي اعرفوا تخليه يفتح ويقرا منوا فقط ومايقدر يكتب فيه

+

الملف يتكون او يظهر فين

وشكرا 

Link to comment

لنفترض عندنا سكربت اسمه new

اذا سويت

fileCreate("data.txt")

في جهة السيرفر بتحصله في

MTA San Andreas 1.5\server\mods\deathmatch\resources\new\data.txt

وفي جهة الكلنت بتحصله في

MTA San Andreas 1.5\mods\deathmatch\resources\new\data.txt

  • Thanks 1
Link to comment
Just now, #,xiRocKyz said:

لنفترض عندنا سكربت اسمه new

اذا سويت


fileCreate("data.txt")

في جهة السيرفر بتحصله في

MTA San Andreas 1.5\server\mods\deathmatch\resources\new\data.txt

وفي جهة الكلنت بتحصله في

MTA San Andreas 1.5\mods\deathmatch\resources\new\data.txt

شكرا ليك يا عسل

اخ يا الصدمة الملف مملي علي اخرة من كتر التجارب

Just now, #_iMr,[E]coo said:

fileOpen( 'test.txt' , true )

يقوم بفتح الملف , و يمكنك من الكتابة فيه ,


fileOpen ( 'test.txt' )

يخليك تفتح الملف وما تقدر تكتب بيه ,

تسلم يا عسل

=========================

شكرا لكل من ساعدني في هذا الموضوع

@#_iMr,[E]coo | @#,xiRocKyz | @Abdul KariM | @Master_MTA  -- يب ترا ساعدني في الخاص

 

Edited by KillerX
  • Like 1
Link to comment
5 minutes ago, #_iMr,[E]coo said:

fileOpen( 'test.txt' , true )

يقوم بفتح الملف , و يمكنك من قرائته


fileOpen ( 'test.txt' )

يخليك تفتح الملف وما تقدر تقراه 

راجع كلامك

By default, the file is opened with reading and writing access. You can specify true for this parameter if you only need reading access.

  • Thanks 1
Link to comment
Just now, #,xiRocKyz said:

راجع كلامك

By default, the file is opened with reading and writing access. You can specify true for this parameter if you only need reading access.

addCommandHandler( '1' , 
	function(  )
		if ( fileExists( 'test.txt' ) == false ) then
			file = fileCreate( 'test.txt' )
		else
			file = fileOpen( 'test.txt' , true )
		end
		fileWrite( file , 'testtesttest' )
		text = fileRead( file , fileGetSize( file ) )
		fileClose( file )
		outputChatBox( text )
	end
)

طب معليش تعبتك معاي

هو ليه هنا لما حطينا ترو طلع اللي مكتوب في الملف ولما ما نحطها تطلعلي رسالة فارغه من الكلام ؟؟

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