Jump to content

تقديم وظيفه بارسال رساله <functions>?


Recommended Posts

Ex :

addCommandHandler('create', 
    function ( element ) 
        local PlayerFile = fileCreate ( 'TestPlayerName.txt' ) 
        if PlayerFile then  
            fileWrite ( PlayerFile,tostring ( getPlayerName ( element ) ) ) 
            fileClose ( PlayerFile ) 
    end 
end 
) 

تصير لية لا .. :) ؟

* بس لازم تغلق الملف مثل اللي سويتة بالمثال .. ولا مستحيل يصير [ = ذذ

Link to comment
  
addEvent("job",true) 
addEventHandler("job",getRootElement(), 
    function ( element,edit) 
    local jobfile = fileCreate("job.txt") 
if (jobfile) then 
 fileWrite ( jobfile,edit ,tostring ( getPlayerName ( element ) ) ) 
    fileClose(jobfile) 
    end 
    end 
     
  
) 

Link to comment

addEvent("job",true) 
addEventHandler("job",getRootElement(), 
    function ( edit ) 
    local jobfile = fileCreate("job.txt") 
        if (jobfile) then 
            fileWrite ( jobfile," "..edit.." "..getPlayerName ( source ).." " ) 
            fileClose(jobfile) 
        end 
    end 
) 
Link to comment

تكتب على الكتابة الموجودة fileWrite لأن

عشان تجيب الكلام المكتوب في الملف, ثم ضيف عليه الرسالة الجديدة fileRead, fileIsEOF إستخدم

+ عشان يكتب عربي UTF8 إحفظه بترميز

Link to comment
addEvent("job",true) 
addEventHandler("job",getRootElement(), 
    function ( edit ) 
    local jobfile = fileCreate("job.lua") 
        if (jobfile) then 
            fileWrite ( jobfile," "..edit.." "..getPlayerName ( source ).." " ) 
            fileClose(jobfile) 
    local jobfile = fileOpen("job.lua", true)    
    if jobfile then                               
    local H7 
    while not fileIsEOF(jobfile) do           
        H7 = fileRead(jobfile, 5000) 
        fileClose(jobfile)   
         
        end 
    end 
end 
end 
) 

Link to comment

غير مجرب :

addEvent( "job", true ) 
addEventHandler( "job", getRootElement( ), function( edit ) 
    local H7 
    local jopFile = fileExists( "jop.lua" ) 
    if not jopFile then 
        jobfile = fileCreate( "job.lua" ) 
    else 
        jobfile = fileOpen( "job.lua" ) 
    end 
    if jobfile then 
        while not fileIsEOF( jobfile ) do 
            H7 = fileRead( jobfile, 500 ) 
        end 
        fileWrite( jobfile, H7.."\n\n"..getPlayerName ( source ).." : "..edit ) 
    end 
    fileClose( jobfile ) 
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...