Jump to content

fileCreate -- fileOpen ( مشكلة )


KillerX

Recommended Posts

Posted (edited)

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

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

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

                                                         هل ساعدتك في شئ ؟؟؟؟

                                                Mmpe7Jm.gif

                                                   latest?cb=20170707023932                 

                                            KillerX#9078

Posted

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

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

[ Skype : kreee89 - Discord : Abdul_KariM#1326 / طلبات البرمجة

https://www.paypal.me/AbdulKariMx / اذا حاب تدعمني

Posted
Just now, Abdul KariM said:

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

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

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

                                                         هل ساعدتك في شئ ؟؟؟؟

                                                Mmpe7Jm.gif

                                                   latest?cb=20170707023932                 

                                            KillerX#9078

Posted
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 قصدك في ملف 

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

                                                         هل ساعدتك في شئ ؟؟؟؟

                                                Mmpe7Jm.gif

                                                   latest?cb=20170707023932                 

                                            KillerX#9078

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

حط تحت سطر ٤ كذا


outputChatBox ( tostring ( file ) )

 

Result : userdata: 00020182

                                                         هل ساعدتك في شئ ؟؟؟؟

                                                Mmpe7Jm.gif

                                                   latest?cb=20170707023932                 

                                            KillerX#9078

Posted
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
)

 

- Hashemite Kingdom Of Jordan -

Posted
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
)

 

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

بس اخر سؤال

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

+

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

وشكرا 

                                                         هل ساعدتك في شئ ؟؟؟؟

                                                Mmpe7Jm.gif

                                                   latest?cb=20170707023932                 

                                            KillerX#9078

Posted

لنفترض عندنا سكربت اسمه 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
Posted (edited)
fileOpen( 'test.txt' , true )

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

fileOpen ( 'test.txt' )

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

Edited by #_iMr,[E]coo
  • Thanks 1

- Hashemite Kingdom Of Jordan -

Posted (edited)
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

                                                         هل ساعدتك في شئ ؟؟؟؟

                                                Mmpe7Jm.gif

                                                   latest?cb=20170707023932                 

                                            KillerX#9078

Posted
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
Posted
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
)

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

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

                                                         هل ساعدتك في شئ ؟؟؟؟

                                                Mmpe7Jm.gif

                                                   latest?cb=20170707023932                 

                                            KillerX#9078

Posted
Just now, Abdul KariM said:

شوف المثال الثاني

https://wiki.multitheftauto.com/wiki/FileOpen

 

Just now, #,xiRocKyz said:

استخدم fileFlush

الف مليون شكرا

                                                         هل ساعدتك في شئ ؟؟؟؟

                                                Mmpe7Jm.gif

                                                   latest?cb=20170707023932                 

                                            KillerX#9078

Posted
40 minutes ago, KillerX said:

 

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

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

 

ساعدتك - 
كنت اشجعك من بعيد ?

Posted
Just now, [T]|O|[P]George said:

ساعدتك - 
كنت اشجعك من بعيد ?

::lol:::lol:::lol:::lol:::lol:

                                                         هل ساعدتك في شئ ؟؟؟؟

                                                Mmpe7Jm.gif

                                                   latest?cb=20170707023932                 

                                            KillerX#9078

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