Jump to content

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


Recommended Posts

  • Replies 92
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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 

ليه ضفت ذول؟؟

دة يوسفل فنكشن لازم تضيفه

مش موجود في الويكي و مش اساسي

Link to comment
شوف السيرفر
addEvent ("dd",true) 
 addEventHandler ("dd",root, 
 function () 
 if getElementHealth (source) < getPedMaxHealth(source) then 
    setElementHealth (source, getElementHealth (source) + 20) 
    else 
 outputChatBox ("لا يمكنك اخذ المزيد من الصحة",source,255,5,5) 
end 
end 
) 

والكلنت

Marker = createMarker (-2396.31543,-594.40619,133.64844,"cylinder",1,255,255,225,49) 
GUIEditor = { 
    button = {}, 
    window = {}, 
    staticimage = {}, 
    label = {} 
} 
  
        window1 = guiCreateWindow(551, 271, 197, 312, "مطعم", false) 
        guiWindowSetSizable(window1, false) 
        guiSetVisible ( window1, false) 
        GUIEditor.label[1] = guiCreateLabel(48, 57, 102, 25, "وجبة", false, window1) 
        guiSetFont(GUIEditor.label[1], "default-bold-small") 
        images = guiCreateStaticImage(10, 58, 34, 34, "images/8.png", false, window1) 
        guiLabelSetColor(GUIEditor.label[1], 100, 53, 35) 
        GUIEditor.label[2] = guiCreateLabel(46, 77, 104, 15, "+20Health", false, window1) 
        guiSetFont(GUIEditor.label[2], "default-small") 
        GUIEditor.button[1] = guiCreateButton(131, 58, 56, 34, "شراء", false, window1) 
        GUIEditor.button[2] = guiCreateButton(9, 279, 178, 23, "أغلاق", false, window1)     
  
  
  
    addEventHandler('onClientMarkerHit',root, 
    function (ss) 
    if ( source == Marker ) and ( ss == localPlayer ) then 
    guiSetInputEnabled(true) 
    guiSetVisible(window1,true) 
    showCursor(true) 
    end 
    end 
    ) 
  
         
    addEventHandler("onClientGUIClick", root, 
    function () 
     if ( source == GUIEditor.button[1] ) then 
     triggerServerEvent ("dd",localPlayer) 
      
     elseif ( source == GUIEditor.button[2] ) then   
     guiSetVisible(window1,false) 
     showCursor(false) 
     guiSetInputEnabled(false) 
    end 
    end 
    ) 
     
     

مو ضابط يخي ليه ما يجي رساله

addEvent ("dd",true) 
  
 addEventHandler ("dd",root, 
  
 function () 
  
 local ph = getElementHealth ( source ) 
  
  
 if  ph  < 100 then 
  
  outputChatBox("تم اعطاك الدم",source,0,255,0) 
  
 setElementHealth(source,ph + 10) 
  
else 
  
 outputChatBox("لا يمكنك اخذ المزيد من الصحة",source,0,255,0) 
  
  
 end 
  
end 
  
) 

Link to comment

else

يعني ايش ؟؟

مثلا ابي ادوس زر يعطني فلوس

بس بشرط لازم تكون فلوسه اقل من 500

addEventHandler("onClientGUIClick",root, 
function() 
if source == buttonName then -- نتتحق من الزر الي يضغطه 
if getPlayerMoney(localPlayer) < 500 -- هنا اتحقق لو فلوسه اصغر من ال500 
givePlayerMoney(localPlayer,200) -- لو نجح الشرط ووجد ان فلوس اللاعب اصغر من ال500 يعطيه 200 $ 
else -- لو ما تحقق الشرط 
outputChatBox("ليست فلوسك اصغر من ال500") -- يقول بالشات لست معك فلوس اصغر من 500 
end 
end 
end) 

:fadein:

Edited by Guest
Link to comment

else يعني آخر

او حاجة أُخري

ifيعني لو حاجة مخالفة ال

if او بأختصار هي تستخدم في حالة نفي الـ

عشان من غيرها ماتعتبرش حاجة if لازم تكون مع

addEvent ("dd",true) 
 addEventHandler ("dd",root, 
 function () 
 if getElementHealth (source) < getPedMaxHealth(source) then -- لو دم الاعب اصغر من دمه الكامل 
    setElementHealth (source, getElementHealth (source) + 20) -- نعمله حاجة 
    else -- لو دم الاعب مش اصغر من دمه الكامل 
--يعني 
-- if getElementHealth (source) > getPedMaxHealth(source) then 
-- او 
-- if getElementHealth (source) >= getPedMaxHealth(source) then 
 outputChatBox ("لا يمكنك اخذ المزيد من الصحة",source,255,5,5) 
end 
end 
) 
Link to comment
else يعني آخر

او حاجة أُخري

ifيعني لو حاجة مخالفة ال

if او بأختصار هي تستخدم في حالة نفي الـ

عشان من غيرها ماتعتبرش حاجة if لازم تكون مع

addEvent ("dd",true) 
 addEventHandler ("dd",root, 
 function () 
 if getElementHealth (source) < getPedMaxHealth(source) then -- لو دم الاعب اصغر من دمه الكامل 
    setElementHealth (source, getElementHealth (source) + 20) 
    else -- لو دم الاعب مش اصغر من دمه الكامل 
--يعني 
-- if getElementHealth (source) > getPedMaxHealth(source) then 
-- او 
-- if getElementHealth (source) >= getPedMaxHealth(source) then 
 outputChatBox ("لا يمكنك اخذ المزيد من الصحة",source,255,5,5) 
end 
end 
) 

لا تخله يستخدم يوسفل فنكشن الحين

انا لما كنت مثله م كنت احط كود اليوسفل

واخربط يخرب الكود

لهيك خليه يتعلم الاكواد الرئيسية الي بالويكي اول بعدين اليوسفل يفهم معناها

Link to comment
else

يعني ايش ؟؟

مثلا ابي ادوس زر يعطني فلوس

بس بشرط لازم تكون فلوسه اقل من 500

addEventHandler("onClientGUIClick",root, 
function() 
if source == buttonName then 
if getPlayerMoney(localPlayer) < 500 -- هنا اتحقق لو فلوسه اصغر من ال500 
givePlayerMoney(localPlayer,200) -- لو نجح الشرط ووجد ان فلوس اللاعب اصغر من ال500 يعطيه 200 $ 
else -- لو ما تحقق الشرط 
outputChatBoxx("ليست فلوسك اصغر من ال500") 
end 
end 
end) 

:fadein:

انتبه لكلمة outputChatBox

خطأ

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