Jump to content

فنكشن


Recommended Posts

Posted

ماني فاهم شي

اشرح لي دب عن

for+do

وش الفرق بينهم

وباقي الصوت يتكرر كل ما اكبس الزر

وسلام نوم بكرة اشوف ردك

  • Replies 85
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

loop

خاصية الدوران ولها أنواع في البرمجة

for loop

while loop

repeat until loop

مثال على for

for k=1, 10 do
    print(k)
end
--output : راح يطلع
--1
--2
--3
--4
--5
--6
--7
--8
--9
--10

وهو يختصر عليك الوقت بدال ماتكتب

print(1)
print(2)
print(3)
print(4)
print(5)
print(6)
print(7)
print(8)
print(9)
print(10)

وله فوائد عديدة مثلا خزنت مؤقتاً اسماء الاعبين مع رتبهم

Table = { 
    {"Mr.Tn6eL", "Admin-Ex"}, 
    {"Mr.Shakshokah", "Conosle"}, 
    {"FrogsTeam", "noComment"}, -- Ahli Team 
    {"Hilal", "lucky team"} -- hhhhhhhh 
} 
  
for k,v in ipairs(Table) do 
    print(v[1], v[2]) 
end 
  
-- بيطلع اسمائنا مع الرتب هههههههههههه 

Posted (edited)

createObject ( 2232, 216.10000610352, 1923.5, 19.299999237061 ) 
createObject ( 2232, 207.10000610352, 1923.5, 19.299999237061 ) 
createObject ( 2232, 197.89999389648, 1923.5, 19.299999237061 ) 
createObject ( 2232, 217.80000305176, 1851.1999511719, 14.300000190735 ) 
Marker = createMarker (209.08809,1921.75928,16.64063,"cylinder",1,235,155,26,55) 
  
GUIEditor = { 
button = {}, 
window = {}} 
GUIEditor.window[1] = guiCreateWindow(496, 263, 236, 216, "الراديو", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
guiSetVisible ( GUIEditor.window[1], false) 
  
GUIEditor.button[1] = guiCreateButton(11, 37, 215, 45, "تشغيل الراديو", false, GUIEditor.window[1]) 
GUIEditor.button[2] = guiCreateButton(10, 92, 215, 45, "ايقاف الراديو", false, GUIEditor.window[1]) 
GUIEditor.button[3] = guiCreateButton(183, 175, 43, 31, "X", false, GUIEditor.window[1])     
  
addEventHandler("onClientMarkerHit", root, 
function (ss) 
if ( source == Marker ) and ( ss == localPlayer ) then 
guiSetVisible(GUIEditor.window[1],true) 
showCursor(true) 
end 
end) 
  
Sound3d = { 
{216.10000610352, 1923.5, 19.299999237061}, 
{207.10000610352, 1923.5, 19.299999237061}, 
{197.89999389648, 1923.5, 19.299999237061} 
} 
addEventHandler("onClientGUIClick",root, function() 
if (source == GUIEditor.button[1] )then 
for _,Pos in ipairs(Sound3d) do 
if isElement(sound) then stopSound (sound) end 
sound = playSound3D ( "music/1.mp3",Pos[1],Pos[2],Pos[3],true) 
setSoundMaxDistance(sound, 150) 
end 
elseif (source == GUIEditor.button[2] and isElement(sound) )then 
stopSound ( sound ) 
elseif (source == GUIEditor.button[3] )then 
guiSetVisible(GUIEditor.window[1],false) 
showCursor(false) 
end 
end) 
Edited by Guest
Posted

سويته لك بطريقة مختصرة ومفهومة

Table = { 
{216.10000610352, 1923.5, 19.299999237061}, 
{207.10000610352, 1923.5, 19.299999237061}, 
{197.89999389648, 1923.5, 19.299999237061}, 
{217.80000305176, 1851.1999511719, 14.300000190735}, 
} 
  
addEventHandler("onClientGUIClick", root, 
  
    function (  ) 
  
    if ( source == GUIEditor.button[1] ) then 
  
    if isElement ( sound ) then destroyElement ( sound ) end 
  
    for i , Pos in ipairs ( Table ) do  
  
    sound = playSound3D ( "music/1.mp3", Pos[1], Pos[2], Pos[3] ) 
     
    setSoundMaxDistance ( sound, 150 ) 
  
    end 
     
    elseif ( source == GUIEditor.button[2] ) then 
         
    if isElement ( sound ) then destroyElement ( sound ) end 
  
    elseif ( source == GUIEditor.button[3] ) then 
  
    showCursor( false ) 
     
    guiSetVisible( GUIEditor.window[1] , false ) 
  
        end 
    end 
    ) ; 
     

لا احلل من يستخدمه في اغاني

بالتوفيق

Posted
createObject ( 2232, 216.10000610352, 1923.5, 19.299999237061 ) 
createObject ( 2232, 207.10000610352, 1923.5, 19.299999237061 ) 
createObject ( 2232, 197.89999389648, 1923.5, 19.299999237061 ) 
createObject ( 2232, 217.80000305176, 1851.1999511719, 14.300000190735 ) 
Marker = createMarker (209.08809,1921.75928,16.64063,"cylinder",1,235,155,26,55) 
  
GUIEditor = { 
button = {}, 
window = {}} 
GUIEditor.window[1] = guiCreateWindow(496, 263, 236, 216, "الراديو", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
guiSetVisible ( GUIEditor.window[1], false) 
  
GUIEditor.button[1] = guiCreateButton(11, 37, 215, 45, "تشغيل الراديو", false, GUIEditor.window[1]) 
GUIEditor.button[2] = guiCreateButton(10, 92, 215, 45, "ايقاف الراديو", false, GUIEditor.window[1]) 
GUIEditor.button[3] = guiCreateButton(183, 175, 43, 31, "X", false, GUIEditor.window[1])     
  
addEventHandler("onClientMarkerHit", root, 
function (ss) 
if ( source == Marker ) and ( ss == localPlayer ) then 
guiSetVisible(GUIEditor.window[1],true) 
showCursor(true) 
end 
end) 
  
Sound3d = { 
{216.10000610352, 1923.5, 19.299999237061}, 
{207.10000610352, 1923.5, 19.299999237061}, 
{197.89999389648, 1923.5, 19.299999237061} 
} 
addEventHandler("onClientGUIClick",root, function() 
if (source == GUIEditor.button[1] )then 
for _,Pos in ipairs(Sound3d) do 
if isElement(sound) then stopSound (sound) end 
sound = playSound3D ( "music/1.mp3",Pos[1],Pos[2],Pos[3],true) 
setSoundMaxDistance(sound, 150) 
end 
elseif (source == GUIEditor.button[2] )then 
stopSound ( sound ) 
elseif (source == GUIEditor.button[3] )then 
guiSetVisible(GUIEditor.window[1],false) 
showCursor(false) 
end 
end) 

كودك صحيح لاكن لو ضغطت على زر ايقاف والصوت موب موجود راح يجي بق , عشان كذا لازم تتحقق انه موجود وبعدها نحذفه

Posted

كودك صحيح لاكن لو ضغطت على زر ايقاف والصوت موب موجود راح يجي بق , عشان كذا لازم تتحقق انه موجود وبعدها نحذفه

عدلته شكرا لك ع التنبيه :fadein:

Posted

كودك صحيح لاكن لو ضغطت على زر ايقاف والصوت موب موجود راح يجي بق , عشان كذا لازم تتحقق انه موجود وبعدها نحذفه

عدلته شكرا لك ع التنبيه :fadein:

العفو :roll:

Posted
Sound3d = { 
{216.10000610352, 1923.5, 19.299999237061}, 
{207.10000610352, 1923.5, 19.299999237061}, 
{197.89999389648, 1923.5, 19.299999237061} 
} 

for _,Pos in ipairs(Sound3d) do 
if isElement(sound) then stopSound (sound) end 
sound = playSound3D ( "music/1.mp3",Pos[1],Pos[2],Pos[3],true) 

elseif (source == GUIEditor.button[2] and isElement(sound) )then 
stopSound ( sound ) 

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

Posted
Sound3d = { 
{216.10000610352, 1923.5, 19.299999237061}, 
{207.10000610352, 1923.5, 19.299999237061}, 
{197.89999389648, 1923.5, 19.299999237061} 
} 

for _,Pos in ipairs(Sound3d) do 
if isElement(sound) then stopSound (sound) end 
sound = playSound3D ( "music/1.mp3",Pos[1],Pos[2],Pos[3],true) 

elseif (source == GUIEditor.button[2] and isElement(sound) )then 
stopSound ( sound ) 

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

الاكواد

  
Loob -- سوي لوب للراديو  
isElement -- سوي تحقق 
playSound3D -- ستارت ل صوت او بدء صوت  
stopSound -- ايقاف الصوت 
"onClientGUIClick" 
  

الاكواد ..

وانت سويه

الاكواد الجاهزة لا تستعمله بس تعلم من الاكواد الجاهزةة

Posted
isElement

destroyElement

وش الفرق بينهم

+يا ريت توضحون اكثر عن

for+do

1. مشكلتك ماتشوف الويكي ياخي خش الويكي وشوف فائدة الوظيفة ووش ترجعلك

2. شوف شرحي وراح تعرف وش فائدتهم ولمن تعرف فائدتهم تعرف الفرق بينهم

https://forum.multitheftauto.com/viewtopic.php?f=164&t=97473

bool isElement ( var theValue ) 

bool = boolean = يعني منطق 
= يعني صح او خطا  
= true أو false 

يعني فائدته الوظيفة ترجع صح او خطا

theValue = الالمنت الي تبي تتحقق منه

فائدة الوظيفة : تشوف الالمنت موجود او لا

زي ماشروحلك فوق الاخوان يتحقق ان الصوت شغال

اذا كان شغال ترجعلك الوظيفة

true 

إذا مب شغال ترجعلك

false 

تستعمل اكثر شيء في التحقق

--

destroyElement 

من إسمها سحب الالمنت

يعني مثلا تبي تسحب سيارة

تستعمل هذه الوظيفة

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

معلومة : تسحب = تخفيهها

--

+ راجع درسي عشان تفهم وش ترجعلك الوظائف

+ خش الويكي وسوي ترجمة كم كلمة تشرحلك الوظيفة

اسف لو طولت عشان تفهم

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