Jump to content

وظائف لعملية شراء


Recommended Posts

  • Replies 92
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Marker = createMarker (216.00175,1920.79150,17.64063,"arrow",1,255,255,225) 
GUIEditor = { 
    button = {}, 
    window = {}, 
    staticimage = {}, 
    label = {} 
} 
        window1 = guiCreateWindow(465, 227, 377, 249, "مطعم", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
  
        image1 = guiCreateStaticImage(10, 28, 34, 34, ":guieditor/images/7.png", false, window1) 
        image2 = guiCreateStaticImage(10, 72, 34, 34, ":guieditor/images/6.png", false, window1) 
        image3 = guiCreateStaticImage(10, 116, 34, 34, ":guieditor/images/8.png", false, window1) 
        image4 = guiCreateStaticImage(10, 160, 34, 34, ":guieditor/images/9.png", false, window1) 
        image5 = guiCreateStaticImage(10, 204, 34, 34, ":guieditor/images/3.png", false, window1) 
        label1 = guiCreateLabel(48, 28, 88, 32, "وجبة", false, window1) 
        guiSetFont(GUIEditor.label[1], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[1], 189, 137, 62) 
        label2 = guiCreateLabel(48, 74, 88, 32, "وجبة", false, window1) 
        guiSetFont(GUIEditor.label[2], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[2], 189, 137, 62) 
        label3 = guiCreateLabel(48, 118, 88, 32, "وجبة", false, window1) 
        guiSetFont(GUIEditor.label[3], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[3], 189, 137, 62) 
        label4 = guiCreateLabel(48, 162, 88, 32, "وجبة", false, window1) 
        guiSetFont(GUIEditor.label[4], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[4], 189, 137, 62) 
        label5 = guiCreateLabel(48, 204, 88, 32, "وجبة", false, window1) 
        guiSetFont(GUIEditor.label[5], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[5], 189, 137, 62) 
        label6 = guiCreateLabel(48, 46, 151, 16, "+20 Health", false, window1) 
        guiSetFont(GUIEditor.label[6], "default-small") 
  
        label7 = guiCreateLabel(54, 45, 36, 16, "25$", false, label6) 
        guiSetFont(GUIEditor.label[7], "default-small") 
        guiLabelSetColor(GUIEditor.label[7], 11, 254, 0) 
  
        label8 = guiCreateLabel(48, 92, 151, 16, "+40 Health", false, window1) 
        guiSetFont(GUIEditor.label[8], "default-small") 
        label9 = guiCreateLabel(48, 134, 151, 16, "+60 Health", false, window1) 
        guiSetFont(GUIEditor.label[9], "default-small") 
        label10 = guiCreateLabel(48, 178, 151, 16, "+80 Health", false, window1) 
        guiSetFont(GUIEditor.label[10], "default-small") 
        label11 = guiCreateLabel(48, 220, 151, 16, "+100 Health", false, window1) 
        guiSetFont(GUIEditor.label[11], "default-small") 
        image6 = guiCreateStaticImage(191, 28, 34, 34, ":guieditor/images/11.png", false, window1) 
        label12 = guiCreateLabel(230, 30, 88, 32, "وجبة", false, window1) 
        guiSetFont(GUIEditor.label[12], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[12], 189, 137, 62) 
        label3 = guiCreateLabel(230, 46, 151, 16, "+100 Armour", false, window1) 
        guiSetFont(GUIEditor.label[13], "default-small") 
        buy1 = guiCreateButton(322, 30, 45, 32, "شراء", false, window1) 
        guiSetFont(GUIEditor.button[1], "default-bold-small") 
        buy2 = guiCreateButton(136, 28, 45, 32, "شراء", false, window1) 
        guiSetFont(GUIEditor.button[2], "default-bold-small") 
        buy3 = guiCreateButton(136, 74, 45, 32, "شراء", false, window1) 
        guiSetFont(GUIEditor.button[3], "default-bold-small") 
        buy4 = guiCreateButton(136, 118, 45, 32, "شراء", false, window1) 
        guiSetFont(GUIEditor.button[4], "default-bold-small") 
        buy5 = guiCreateButton(136, 162, 45, 32, "شراء", false, window1) 
        guiSetFont(GUIEditor.button[5], "default-bold-small") 
        buy6 = guiCreateButton(136, 204, 45, 32, "شراء", false, window1) 
        guiSetFont(GUIEditor.button[6], "default-bold-small") 
        buy7 = guiCreateButton(224, 214, 143, 25, "أغلاق", false, window1) 
        buy8 = guiCreateButton(224, 184, 143, 25, "قريبا", false, window1) 
        GUIEditor.label[14] = guiCreateLabel(105, 47, 41, 15, "421$", false, window1) 
        label14, "default-small") 
        guiLabelSetColor(GUIEditor.label[14], 11, 254, 0) 
        label15 = guiCreateLabel(105, 91, 41, 15, "600$", false, window1) 
        guiSetFont(GUIEditor.label[15], "default-small") 
        guiLabelSetColor(GUIEditor.label[15], 11, 254, 0) 
        label16 = guiCreateLabel(105, 134, 41, 15, "736$", false, window1) 
        guiSetFont(GUIEditor.label[16], "default-small") 
        guiLabelSetColor(GUIEditor.label[16], 11, 254, 0) 
        label17 = guiCreateLabel(105, 178, 41, 15, "900$", false, window1) 
        guiSetFont(GUIEditor.label[17], "default-small") 
        guiLabelSetColor(GUIEditor.label[17], 11, 254, 0) 
        label18 = guiCreateLabel(105, 221, 41, 15, "952$", false, window1) 
        guiSetFont(GUIEditor.label[18], "default-small") 
        guiLabelSetColor(GUIEditor.label[18], 11, 254, 0) 
        label19 = guiCreateLabel(291, 47, 41, 15, "1000$", false, window1) 
        guiSetFont(GUIEditor.label[19], "default-small") 
        guiLabelSetColor(GUIEditor.label[19], 11, 254, 0)     
    end 
) 
  
  
addEventHandler("onClientMarkerHit", root, 
    function(hitElement) 
    if ( source == Marker ) and ( hitElement == localPlayer ) then 
    showCursor(true) 
    guiSetVisible(window1,true) 
     
    end 
    end 
    ) 
     
    addEventHandler ("onClientGUIClick", root, 
    function() 
    if ( source == buy1 ) then 
      setElementHealth(localPlayer,20) 
       
    elseif ( source == buy2 ) then 
      setElementHealth(localPlayer,40) 
       
    elseif ( source == buy3 ) then 
      setElementHealth(localPlayer,60) 
       
    elseif ( source == buy4 ) then 
      setElementHealth(localPlayer,80) 
       
    elseif ( source == buy5 ) then 
      setElementHealth(localPlayer,100) 
       
    elseif ( source == buy7 ) then 
       showCursor(false) 
       guiSetVisible(window1,false) 
        
       end  
       end 
       ) 
        

سويتة لكن ما يشتغل وما يظهر الماركر ممكن تقولوا لي وش الخطأ حاولت اصلحها بنفسي بس مو ضابطه قولوا لي وين الخطأ حتى اصلحه

Link to comment

عشان تعرف الاخطاء وين وتصلحها اكتب ب اف 8

debugscript 3

وراح يظهر لك الاخطاء والسطور وكل شئ

بالنسبه لكودك الخطاء بسطر 67

+ فى اند وقوس زياده بسطر 84

Edited by Guest
Link to comment
ادري 67 بس مو عارف وش اسوي عدلته حاول اعدل اسم الليبل مو ضابط

+الماركر ما يظهر

جربت كودك ناقصه تحققات مثلا

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

+ بدل سطر 67

بذا

guiSetFont(label14, "default-small")

وشيل الاند والقوس الزياده

Link to comment

جرب

Marker = createMarker (216.00175,1920.79150,17.64063,"cylinder",1,0,255,255,225) 
GUIEditor = { 
    button = {}, 
    window = {}, 
    staticimage = {}, 
    label = {} 
} 
        window1 = guiCreateWindow(465, 227, 377, 249, "مطعم", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
  
        image1 = guiCreateStaticImage(10, 28, 34, 34, ":guieditor/images/7.png", false, window1) 
        image2 = guiCreateStaticImage(10, 72, 34, 34, ":guieditor/images/6.png", false, window1) 
        image3 = guiCreateStaticImage(10, 116, 34, 34, ":guieditor/images/8.png", false, window1) 
        image4 = guiCreateStaticImage(10, 160, 34, 34, ":guieditor/images/9.png", false, window1) 
        image5 = guiCreateStaticImage(10, 204, 34, 34, ":guieditor/images/3.png", false, window1) 
        label1 = guiCreateLabel(48, 28, 88, 32, "وجبة", false, window1) 
        guiSetFont(GUIEditor.label[1], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[1], 189, 137, 62) 
        label2 = guiCreateLabel(48, 74, 88, 32, "وجبة", false, window1) 
        guiSetFont(GUIEditor.label[2], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[2], 189, 137, 62) 
        label3 = guiCreateLabel(48, 118, 88, 32, "وجبة", false, window1) 
        guiSetFont(GUIEditor.label[3], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[3], 189, 137, 62) 
        label4 = guiCreateLabel(48, 162, 88, 32, "وجبة", false, window1) 
        guiSetFont(GUIEditor.label[4], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[4], 189, 137, 62) 
        label5 = guiCreateLabel(48, 204, 88, 32, "وجبة", false, window1) 
        guiSetFont(GUIEditor.label[5], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[5], 189, 137, 62) 
        label6 = guiCreateLabel(48, 46, 151, 16, "+20 Health", false, window1) 
        guiSetFont(GUIEditor.label[6], "default-small") 
  
        label7 = guiCreateLabel(54, 45, 36, 16, "25$", false, label6) 
        guiSetFont(GUIEditor.label[7], "default-small") 
        guiLabelSetColor(GUIEditor.label[7], 11, 254, 0) 
  
        label8 = guiCreateLabel(48, 92, 151, 16, "+40 Health", false, window1) 
        guiSetFont(GUIEditor.label[8], "default-small") 
        label9 = guiCreateLabel(48, 134, 151, 16, "+60 Health", false, window1) 
        guiSetFont(GUIEditor.label[9], "default-small") 
        label10 = guiCreateLabel(48, 178, 151, 16, "+80 Health", false, window1) 
        guiSetFont(GUIEditor.label[10], "default-small") 
        label11 = guiCreateLabel(48, 220, 151, 16, "+100 Health", false, window1) 
        guiSetFont(GUIEditor.label[11], "default-small") 
        image6 = guiCreateStaticImage(191, 28, 34, 34, ":guieditor/images/11.png", false, window1) 
        label12 = guiCreateLabel(230, 30, 88, 32, "وجبة", false, window1) 
        guiSetFont(GUIEditor.label[12], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[12], 189, 137, 62) 
        label3 = guiCreateLabel(230, 46, 151, 16, "+100 Armour", false, window1) 
        guiSetFont(GUIEditor.label[13], "default-small") 
        buy1 = guiCreateButton(322, 30, 45, 32, "شراء", false, window1) 
        guiSetFont(GUIEditor.button[1], "default-bold-small") 
        buy2 = guiCreateButton(136, 28, 45, 32, "شراء", false, window1) 
        guiSetFont(GUIEditor.button[2], "default-bold-small") 
        buy3 = guiCreateButton(136, 74, 45, 32, "شراء", false, window1) 
        guiSetFont(GUIEditor.button[3], "default-bold-small") 
        buy4 = guiCreateButton(136, 118, 45, 32, "شراء", false, window1) 
        guiSetFont(GUIEditor.button[4], "default-bold-small") 
        buy5 = guiCreateButton(136, 162, 45, 32, "شراء", false, window1) 
        guiSetFont(GUIEditor.button[5], "default-bold-small") 
        buy6 = guiCreateButton(136, 204, 45, 32, "شراء", false, window1) 
        guiSetFont(GUIEditor.button[6], "default-bold-small") 
        buy7 = guiCreateButton(224, 214, 143, 25, "أغلاق", false, window1) 
        buy8 = guiCreateButton(224, 184, 143, 25, "قريبا", false, window1) 
        GUIEditor.label[14] = guiCreateLabel(105, 47, 41, 15, "421$", false, window1) 
        guiLabelSetColor(GUIEditor.label[14], 11, 254, 0) 
        label15 = guiCreateLabel(105, 91, 41, 15, "600$", false, window1) 
        guiSetFont(GUIEditor.label[15], "default-small") 
        guiLabelSetColor(GUIEditor.label[15], 11, 254, 0) 
        label16 = guiCreateLabel(105, 134, 41, 15, "736$", false, window1) 
        guiSetFont(GUIEditor.label[16], "default-small") 
        guiLabelSetColor(GUIEditor.label[16], 11, 254, 0) 
        label17 = guiCreateLabel(105, 178, 41, 15, "900$", false, window1) 
        guiSetFont(GUIEditor.label[17], "default-small") 
        guiLabelSetColor(GUIEditor.label[17], 11, 254, 0) 
        label18 = guiCreateLabel(105, 221, 41, 15, "952$", false, window1) 
        guiSetFont(GUIEditor.label[18], "default-small") 
        guiLabelSetColor(GUIEditor.label[18], 11, 254, 0) 
        label19 = guiCreateLabel(291, 47, 41, 15, "1000$", false, window1) 
        guiSetFont(GUIEditor.label[19], "default-small") 
        guiLabelSetColor(GUIEditor.label[19], 11, 254, 0)     
  
               guiSetVisible(window1,false) 
  
  
  
addEventHandler("onClientMarkerHit", root, 
    function(hitElement) 
    if ( source == Marker ) and ( hitElement == localPlayer ) then 
    showCursor(true) 
    guiSetVisible(window1,true) 
    
    end 
    end 
    ) 
     
    
    addEventHandler ("onClientGUIClick", root, 
    function() 
    if ( source == buy1 ) then 
      setElementHealth(localPlayer,20) 
      
    elseif ( source == buy2 ) then 
      setElementHealth(localPlayer,40) 
      
    elseif ( source == buy3 ) then 
      setElementHealth(localPlayer,60) 
      
    elseif ( source == buy4 ) then 
      setElementHealth(localPlayer,80) 
      
    elseif ( source == buy5 ) then 
      setElementHealth(localPlayer,100) 
      
    elseif ( source == buy7 ) then 
       showCursor(false) 
       guiSetVisible(window1,false) 
        
       end 
       end 
       ) 

:D:D:D

Edited by Guest
Link to comment
اخوي اشتغل ذا

guiSetFont(label14, "default-small")

بس ممكن اعرف وش ذا مشان اتعلم واستفيد

label14, "default-small انت كنت مسويه كذا واكيد راح يخرب المود

فلازم تخليه كذا عشان مايخرب شئ عندك

guiSetFont(label14, "default-small")

وكمان عند اختيارك الفونت من الجيو اديتور راح ينزل تلقائي مع اكواد اللوحه يعني لاتحذف منه شئ او تعدل عليه

Link to comment
طيب ابي اذا كان دمه 20 واشترا حق 20 بالمئه تصير 40 وهكذا وش استخدم الجمع ولا الطرح؟

شوف انا عارف ومتأكد انك مراح تعرفه عشان كذا راح اعطيك الكود عشان تعرفه بس

وكيف يكون التحقق

if (getElementHealth ( localPlayer ) <= 50 ) then -- يتحقق لو دمه اقل من 50 يعطيه لو اكثر من 50 مايعطيه

Link to comment
الكود صار هريسه في كم شي مو فاهمه من الاساس

onClientMarkerHit

onClientGUIClick

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

onClientMarkerHit

لما اللاعب يلمس ماركر

onClientGUIClick

لما اللاعب يضغط زر

Link to comment
Marker = createMarker (216.00175,1920.79150,17.64063,"arrow",1,255,255,225,alpha ?) 

216.00175,1920.79150,17.64063 = x , y , z

"arrow" = theType

1 = size

255,255,225 = r , g , b

alpha = ??

الشفافية مش متعرفة في كود صنع الماركر بتاعك

عشان كدة الماركر مش ظاهر

الساينتاكس الطبيعي كلينت

marker createMarker ( float x, float y, float z [, string theType = "checkpoint", float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255 ] ) 

--

و بالنسبة لمشكلة الدم عندك

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

addEventHandler ("onClientGUIClick", root, 
    function() 
    if ( source == buy1 ) then 
      triggerServerEvent ("Health20",localPlayer) 
    
    elseif ( source == buy2 ) then 
      triggerServerEvent ("Health40",localPlayer) 
      
    elseif ( source == buy3 ) then 
      triggerServerEvent ("Health60",localPlayer) 
       
      elseif (source == buy4) then 
      triggerServerEvent .. -- كمل طريقك 
    elseif ( source == buy7 ) then 
       showCursor(false) 
       guiSetVisible(window1,false)  
       end 
       end 
       ) 

و في جزء السيرفر استخدم اليوسفل فنكشن

function getPedMaxHealth(ped) 
    assert(isElement(ped) and (getElementType(ped) == "ped" or getElementType(ped) == "player"), "Bad argument @ 'getPedMaxHealth' [Expected ped/player at argument 1, got " .. tostring(ped) .. "]") 
    local stat = getPedStat(ped, 24) 
    local maxhealth = 100 + (stat - 569) / 4.31 
    return math.max(1, maxhealth) 
end 

عشان يرجع لك دم الاعب الكامل

--

addEvent ("Health20",true) 
       addEventHandler ("Health20",root, -- تريجر السيرفر اللي مربوط بحدث الضغط علي الزر مش محتاج شرح 
       function () 
  
-- بما انك مبتدأ و عايز تتعلم و تطبق 
  
if getPlayerMoney (source) >= 200 then -- هنا يتحقق بأن فلوسه اكبر من او تساوي 200 
if getElementHealth (source) < getPedMaxHealth(source) then -- هنا يتحقق بأن دم الاعب اصغر من دمه الكامل 
-- يعني لو دمه 20 *مثلا* و دمه الكامل من 100 
takePlayerMoney (source,200) -- ناخد منه التمن 
       setElementHealth (source, getElementHealth (source) + 20) -- نديله 20 دم علي دمه 
        
-- و كدة بقينا اديناله دم 20 و اخدنا منه الفلوس 
       
-- و لو حصل حاجة تانية (أُخري)     
       else -- لو مثلاً دمه العادي 100 *كامل* و دمه الكامل من 100 
outputChatBox ("Your health is full.",source,255,5,5) -- نطلعله رسالة في الشات 
       end 
       else -- لو فلوسه اصغر من او لاتساوي 200 
outputChatBox ("You don't have enough money.",source,255,5,5) -- نطلعله رسالة في الشات 
       end 
       end 
       ) -- و طبعاً كمل طريقك علي الباقي 
Link to comment
GUIEditor = { 
    button = {}, 
    window = {}, 
    staticimage = {}, 
    label = {} 
} 
        GUIEditor.window[1] = guiCreateWindow(613, 300, 258, 307, "متجر", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetVisible ( GUIEditor.window[1], false) 
  
        GUIEditor.staticimage[1] = guiCreateStaticImage(10, 70, 34, 34, ":guieditor/images/11.png", false, GUIEditor.window[1]) 
        GUIEditor.staticimage[2] = guiCreateStaticImage(10, 167, 34, 34, ":guieditor/images/7.png", false, GUIEditor.window[1]) 
        GUIEditor.label[1] = guiCreateLabel(46, 70, 78, 23, "درع", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[1], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[1], 207, 209, 45) 
        GUIEditor.label[2] = guiCreateLabel(46, 168, 78, 23, "طعام", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[2], "default-bold-small") 
        guiLabelSetColor(GUIEditor.label[2], 207, 209, 45) 
        GUIEditor.label[3] = guiCreateLabel(44, 87, 90, 17, "+20Armour", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[3], "default-small") 
        GUIEditor.label[4] = guiCreateLabel(44, 184, 90, 17, "+20Health", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[4], "default-small") 
        GUIEditor.button[1] = guiCreateButton(114, 77, 58, 28, "شراء", false, GUIEditor.window[1]) 
        mezo = guiCreateStaticImage(9, 86, 34, 34, "images/11.png", false, WindowAr) 
        GUIEditor.button[2] = guiCreateButton(114, 174, 58, 28, "شراء", false, GUIEditor.window[1]) 
        mezo = guiCreateStaticImage(9, 86, 34, 34, "images/7.png", false, WindowAr) 
        GUIEditor.button[3] = guiCreateButton(9, 274, 239, 23, "أغلاق", false, GUIEditor.window[1]) 
        GUIEditor.button[4] = guiCreateButton(9, 241, 239, 23, "قريبا", false, GUIEditor.window[1])     
  
Marker = createMarker (215.71916,1911.35266,18.64063,"arrow",1,255,255,225) 
addEventHandler("onClientMarkerHit", root, 
function (Marker) 
if ( source == Marker ) and ( Marker == localPlayer ) then 
showCursor(true) 
guiSetVisible(GUIEditor.window[1],true) 
end 
end 
) 
  
addEventHandler ("onClientGUIClick", root, 
function() 
if ( source == GUIEditor.button[1] ) then 
   setElementHealth(localPlayer,20) 
   elseif ( source == GUIEditor.button[3] ) then   
   showCursor(false) 
   guiSetVisible(GUIEditor.window[1],false) 
   end 
   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...