Jump to content

سؤال بخصوص ايديت بوكس


Mars2

Recommended Posts

--[[------------------------------------------------- 
Notes: 
  
> This code is using a relative image filepath. This will only work as long as the location it is from always exists, and the resource it is part of is running. 
    To ensure it does not break, it is highly encouraged to move images into your local resource and reference them there. 
--]]------------------------------------------------- 
  
  
GUIEditor = { 
    button = {}, 
    window = {}, 
    staticimage = {}, 
    edit = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(399, 280, 338, 303, "شراء الاسلحة", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
  
        GUIEditor.edit[1] = guiCreateEdit(10, 93, 101, 32, "0", false, GUIEditor.window[1]) 
        GUIEditor.staticimage[1] = guiCreateStaticImage(12, 32, 95, 56, ":guieditor/images/pp.png", false, GUIEditor.window[1]) 
        GUIEditor.button[1] = guiCreateButton(14, 251, 87, 42, "شراء", false, GUIEditor.window[1]) 
        GUIEditor.button[2] = guiCreateButton(111, 251, 87, 42, "اغلاق", false, GUIEditor.window[1])     
    end 
) 
  

اول شي ذا كود اللوحة

ركبوها وشوفوها مشان تفهموا علي

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

كيف ابي افهم

Link to comment

giveWeapon تحتاج تستخدم الفنكشن

و بما ان ذا الفنكشن موجود جانب سيرفر فقط و اللوحة موجوده بالكلينت

راح تحتاج تسوي تريقر من اللكلينت إلى السيرفر

onClientGUIClick اول شي تستخدم الأفنت لما الزر ينضغط

guiGetText ثم تجيب الرقم الي داخل الأيدت بوكس عن طريق الفنكشن ذا

triggerServerEvent ترسل الرقم الي جبته من الأيدت بوكس إلى السيرفر عن طريق التريقر

addEvent و addEventHandler تستقبل التريقر في جانب السيرفر عن طريق الفنكشين

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

Link to comment

كلنت

    --[[------------------------------------------------- 
    Notes: 
      
    > This code is using a relative image filepath. This will only work as long as the location it is from always exists, and the resource it is part of is running. 
        To ensure it does not break, it is highly encouraged to move images into your local resource and reference them there. 
    --]]------------------------------------------------- 
      
      
    GUIEditor = { 
        button = {}, 
        window = {}, 
        staticimage = {}, 
        edit = {} 
    } 
    addEventHandler("onClientResourceStart", resourceRoot, 
        function() 
            GUIEditor.window[1] = guiCreateWindow(399, 280, 338, 303, "شراء الاسلحة", false) 
            guiWindowSetSizable(GUIEditor.window[1], false) 
      
            GUIEditor.edit[1] = guiCreateEdit(10, 93, 101, 32, "0", false, GUIEditor.window[1]) 
            GUIEditor.staticimage[1] = guiCreateStaticImage(12, 32, 95, 56, ":guieditor/images/pp.png", false, GUIEditor.window[1]) 
            GUIEditor.button[1] = guiCreateButton(14, 251, 87, 42, "شراء", false, GUIEditor.window[1]) 
            GUIEditor.button[2] = guiCreateButton(111, 251, 87, 42, "اغلاق", false, GUIEditor.window[1])     
        end 
    ) 
      
  
  
function weapon (root) 
guiGetText ( root ) 
triggerServerEvent('ss', localPlayer) 
end 
addEventHandler ( "onClientGUIClick",weapon, ) 
  

سيرفر

addEvent('ss', true)   
    addEventHandler('ss', root, 
    function ( ) 
    takePlayerMoney ( source , 3000 ) 
    giveWeapon( source, 31, 1000 ) 
        outputChatBox(' تم اعطاءك سلاح', source, 255, 0 ,0 ) 
    end 
    ) 

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

Link to comment

-- # Client Side 
  
    GUIEditor = { 
        button = {}, 
        window = {}, 
        staticimage = {}, 
        edit = {} 
    } 
    addEventHandler("onClientResourceStart", resourceRoot, function (   ) 
            GUIEditor.window[1] = guiCreateWindow(399, 280, 338, 303, "شراء الاسلحة", false) 
            guiWindowSetSizable(GUIEditor.window[1], false) 
            guiSetVisible ( GUIEditor.window[1], false ) 
            GUIEditor.edit[1] = guiCreateEdit(10, 93, 101, 32, "0", false, GUIEditor.window[1]) 
            GUIEditor.staticimage[1] = guiCreateStaticImage(12, 32, 95, 56, ":guieditor/images/pp.png", false, GUIEditor.window[1]) 
            GUIEditor.button[1] = guiCreateButton(14, 251, 87, 42, "شراء", false, GUIEditor.window[1]) 
            GUIEditor.button[2] = guiCreateButton(111, 251, 87, 42, "اغلاق", false, GUIEditor.window[1])     
        end ) 
      
  
  
addEventHandler ( "onClientGUIClick", guiRoot, function (   ) 
local GetThata = guiGetText ( GUIEditor.edit[1] ) 
if ( source == GUIEditor.button[1] ) then 
triggerServerEvent ("BuyWep", localPlayer, GetThata) 
elseif ( source == GUIEditor.button[2] ) then 
guiSetVisible ( GUIEditor.window[1], false ) 
showCursor ( false ) 
end 
end ) 

addEvent( "BuyWep", true )   
   addEventHandler("BuyWep", root, function ( GetThata ) 
    local GetMy = getPlayerMoney ( source ) 
    if ( GetMy >= 3000 ) then    
    takePlayerMoney ( source, 3000 ) 
   giveWeapon( source, 31, GetThata ) 
       outputChatBox(" تم اعطاءك سلاح", source, 255, 0 ,0 , true) 
   end 
  end ) 

جرب ؟

Edited by Guest
Link to comment

^

-- # Server Side 
  
addEvent( "BuyWep", true )   
   addEventHandler("BuyWep", root, function ( GetThata ) 
    local GetMy = getPlayerMoney ( source ) 
    if ( GetMy >= 3000 ) then   
    takePlayerMoney ( source, 3000 ) 
   giveWeapon( source, 31, GetThata ) 
       outputChatBox("تم اعطاءك سلاح", source, 255, 0 ,0 ) 
   end 
  end ) 

Link to comment
^
-- # Server Side 
  
addEvent( "BuyWep", true )   
   addEventHandler("BuyWep", root, function ( GetThata ) 
    local GetMy = getPlayerMoney ( source ) 
    if ( GetMy >= 1000 ) then   
    takePlayerMoney ( source, 3000 ) 
   giveWeapon( source, 31, GetThata ) 
       outputChatBox("تم اعطاءك سلاح", source, 255, 0 ,0 ) 
   end 
  end ) 

تابل انت جني او وش توني معدله انت جيت :P

Edited by Guest
Link to comment

-- # Client Side 
  
    GUIEditor = { 
        button = {}, 
        window = {}, 
        staticimage = {}, 
        edit = {} 
    } 
     
     
TheKey = "F6" 
  
  
    addEventHandler("onClientResourceStart", resourceRoot, function (   ) 
            GUIEditor.window[1] = guiCreateWindow(399, 280, 338, 303, "شراء الاسلحة", false) 
            guiWindowSetSizable(GUIEditor.window[1], false) 
            guiSetVisible ( GUIEditor.window[1], false ) 
            GUIEditor.edit[1] = guiCreateEdit(10, 93, 101, 32, "0", false, GUIEditor.window[1]) 
            GUIEditor.staticimage[1] = guiCreateStaticImage(12, 32, 95, 56, ":guieditor/images/pp.png", false, GUIEditor.window[1]) 
            GUIEditor.button[1] = guiCreateButton(14, 251, 87, 42, "شراء", false, GUIEditor.window[1]) 
            GUIEditor.button[2] = guiCreateButton(111, 251, 87, 42, "اغلاق", false, GUIEditor.window[1])     
        end ) 
      
  
  
addEventHandler ( "onClientGUIClick", guiRoot, function (   ) 
local GetThata = guiGetText ( GUIEditor.edit[1] ) 
if ( source == GUIEditor.button[1] ) then 
triggerServerEvent ("BuyWep", localPlayer, GetThata) 
elseif ( source == GUIEditor.button[2] ) then 
guiSetVisible ( GUIEditor.window[1], false ) 
showCursor ( false ) 
end 
end ) 
  
bindKey (TheKey, "down", function ( ) 
guiSetVisible ( GUIEditor.window[1], not guiGetVisible ( GUIEditor.window[1] ) ) 
showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) 
end ) 
Link to comment
تم اشتغل يخي انا وش استفدت من نسخ ولصق @_@

قولي وش كان ناقص وش عدلت ولماذا

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

اول شي

-- client >> 
function weapon (root) -- هذا غلط وش فايدة root ? 
guiGetText ( root ) -- وهنا guiGetText لازم تحط اسم الايديت وتخلي لها متغير 
triggerServerEvent('ss', localPlayer) -- هنا ماعرفت guiGetText الي هو الكلام الي داخل الايديت 
end 
addEventHandler ( "onClientGUIClick",weapon, )-- فاصلة زايدة 
  
-- server >> 
  
   addEventHandler("BuyWep", root, function ( GetThata ) -- ماعرفت الكلام 
    local GetMy = getPlayerMoney ( source ) --  متغير حق يجيب فلوس الاعب 
    if ( GetMy >= 3000 ) then --  كان ناقصك تحققات ان الاعب عنده 3000 او ازيد 
    takePlayerMoney ( source, 3000 ) --  ياخد فلوس الاعب 
   giveWeapon( source, 31, GetThata ) -- استبدلت عدد الطلقات ب الكلام الي داخل الايديت 
       outputChatBox(" تم اعطاءك سلاح", source, 255, 0 ,0 , true) 
   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...