Jump to content

طلب اكواد


mouamle

Recommended Posts

addEventHandler('onPlayerChat',root, 
        function(msg) 
                if string.find(msg,'حرب') then 
                    setElementPosition(localPlayer,x,y,z) 
        end 
    end 
) 

localPlayer --> source

Link to comment

تقدر تسويها بطريقه بسيطه ...

if string.find(msg,'حرب') then 
    .... 
elseif string.find(msg,'المعرض') then 
    .... 
end 

لأنه راح يبحث في الكلام الي كتبه اللاعب string.find انا من رأيي لا تستخدم

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

Link to comment

هذا طلبكـ ...

addEventHandler("onPlayerChat", root, function(  msg  ) -- حدث عند الكتابه في الشات + وظيفة باسم 
        if string.find( msg,"حرب" ) then -- تحقق انه كتب في الشات حرب 
            setElementPosition( source, x, y, z ) -- x,y,z حط الاحداثيات الي ينتقل لها بدال 
        end -- اند الفنكشن 
    end -- اند الاف 
) -- قوس اغلاق الحدث 

واذا بتسوي اكثر من كلمه اذا كتبها ينتقل لـ مكان معين

انصحكـ تستخدم طريقة مختصرهـ وهي

elseif <-- @The Best مثل ماقال

مثال ...

if string.find( msg,"حرب" ) then -- تحقق انه كتب في الشات حرب 
  
elseif string.find( msg,"البدايه" ) then -- تحقق انه كتب في الشات البدايه 
  
end -- اند الاف 

elseif استخدم

كـ طريقه مختصرهـ

if <-- عشان اذا بتحط على كل مكان

end <-- بتزيد معها الاند

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

اتمنى اني افدتك وافدت كل القارئين

سلام : )

Link to comment

تقدر تسويها بطريقه بسيطه ...

if string.find(msg,'حرب') then 
    .... 
elseif string.find(msg,'المعرض') then 
    .... 
end 

لأنه راح يبحث في الكلام الي كتبه اللاعب string.find انا من رأيي لا تستخدم

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

find يقدر يستخدم ذآ بدآل

addEventHandler("onPlayerChat" , root,  
function(  msg  ) -- وظيفة وداخل آلقوسين آرقمنت آلرسآلة 
  if tostring(msg) == "حرب" then -- بدآل آلبحث نحط آذآ كآنت آلرسآلة حرب ينفله مثل مآ قآل ذآ بست 
            setElementPosition( source, x, y, z ) -- x,y,z حط الاحداثيات الي ينتقل لها بدال 
  end -- نهآية آلتحقق 
end -- نهآية آلوظيفة 
) -- قوس إغلآق آلحدث 

Link to comment

find يقدر يستخدم ذآ بدآل

addEventHandler("onPlayerChat" , root,  
function(  msg  ) -- وظيفة وداخل آلقوسين آرقمنت آلرسآلة 
  if tostring(msg) == "حرب" then -- بدآل آلبحث نحط آذآ كآنت آلرسآلة حرب ينفله مثل مآ قآل ذآ بست 
            setElementPosition( source, x, y, z ) -- x,y,z حط الاحداثيات الي ينتقل لها بدال 
  end -- نهآية آلتحقق 
end -- نهآية آلوظيفة 
) -- قوس إغلآق آلحدث 

مالها اي فايده tostring الداله...

message: A string representing the message typed into the chat.

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