Jump to content

تصليح كود لوحه سيارات


Recommended Posts

السلام عليكم

شباب الحين ذا المود شغال

بس اذا كان معاي سياره وجاء واحد ثاني اخذ سياره يسحب مني ويجيه ليه ؟

يعني سياره وحده بس تنزل

الاكواد

client

    GUIEditor_Window = {} 
    GUIEditor_Button = {} 
    GUIEditor_Grid = {} 
    GUIEditor_Checkbox = {} 
     
    car = { 
    {411}, 
    {451}, 
    {444}, 
    {522}, 
    {602}, 
    {560}, 
    } 
     
local marker = createMarker( 2777.8000488281, 2732.1000976563, 9.8000001907349, "cylinder", 2, 239, 57, 15, 255) 
    GUIEditor_Window[1] = guiCreateWindow(314, 148, 170, 280, "vehicle panel", false) 
    guiSetVisible(GUIEditor_Window[1],false) 
    GUIEditor_Grid[1] = guiCreateGridList(11, 51, 149, 160, false, GUIEditor_Window[1]) 
    guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
    guiGridListAddColumn(GUIEditor_Grid[1], "cars", 0.9) 
    GUIEditor_Button[1] = guiCreateButton(10, 221, 150, 45, "Select Vehicle", false, GUIEditor_Window[1]) 
    GUIEditor_Button[2] = guiCreateButton(9, 22, 36, 19, "X", false, GUIEditor_Window[1])     
     
    for i,v in ipairs (car) do 
        local carName = getVehicleNameFromModel (v[1]) 
        local row = guiGridListAddRow (GUIEditor_Grid[1]) 
        guiGridListSetItemText (GUIEditor_Grid[1], row, 1, carName, false, true) 
    end 
    function onClientClick (button, state, absoluteX, absoluteYe) 
      if (source == GUIEditor_Button[1]) then 
        if (guiGridListGetSelectedItem (GUIEditor_Grid[1])) then 
          local car = guiGridListGetItemText (GUIEditor_Grid[1], guiGridListGetSelectedItem (GUIEditor_Grid[1]), 1) 
          triggerServerEvent ("cars", getLocalPlayer(), car) 
          if ( car == "" ) then 
          guiSetVisible(GUIEditor_Window[1],true) 
          showCursor(true) 
          guiSetEnabled ( GUIEditor_Button[1], false ) 
          setTimer ( guiSetEnabled, 3000, 1, GUIEditor_Button[1], true ) 
          else 
          setPedFrozen(source, false) 
          guiSetVisible(GUIEditor_Window[1],false) 
          showCursor(false) 
          end 
        end 
      end 
    end 
    addEventHandler ("onClientGUIClick", GUIEditor_Button[1], onClientClick) 
    function onClientClick (button, state, absoluteX, absoluteYe) 
      if (source == GUIEditor_Button[2]) then 
    guiSetVisible(GUIEditor_Window[1],false) 
    showCursor(false) 
    setPedFrozen(source, false) 
    end 
    end 
    addEventHandler ("onClientGUIClick", GUIEditor_Button[2], onClientClick) 
    function onClientClick (button, state, absoluteX, absoluteYe) 
      if (source == GUIEditor_Button[1]) then 
      local car = guiGridListGetItemText (GUIEditor_Grid[1], guiGridListGetSelectedItem (GUIEditor_Grid[1]), 1) 
      if ( car == "" ) then 
      else 
    end 
    end 
    end 
    addEventHandler ("onClientGUIClick", GUIEditor_Button[1], onClientClick) 
addEventHandler("onClientMarkerHit", marker, 
function ( thePlayer, matchingDimension ) 
    if ( isElementWithinMarker(thePlayer, marker) ) then 
    if isPedInVehicle ( thePlayer ) then 
    guiSetVisible ( GUIEditor_Window[1], false ) 
    showCursor(false) 
    else 
    setElementFrozen(source, true) 
    if (getElementData(thePlayer,"Group") == "Grim") then 
        guiSetVisible ( GUIEditor_Window[1], true ) 
        showCursor(true) 
     end 
    end 
    end 
    end) 

server

spawn = { 
    {2822.3000488281,2745.6000976563,9.8000001907349}, 
} 
addEvent ("cars", true) 
addEventHandler ("cars", getRootElement(), 
function(car) 
         if getElementType(source) == "player" then 
         if isElement( veh ) then destroyElement( veh ) end 
         local mt = math.random(#spawn) 
         local cn = getVehicleModelFromName (car) 
         local x,y,z = getElementPosition(source) 
         local cn2 = getVehicleNameFromModel (cn) 
         if car == "" then 
         end 
         if (cn == 487) then 
        veh = createVehicle(cn, spawn[mt][1]) 
        setVehicleColor(veh, 255, 102, 0) 
        warpPedIntoVehicle(source, veh) 
        else 
         veh = createVehicle(cn, x,y,z) 
         setVehicleColor(veh, 255, 102, 0) 
         warpPedIntoVehicle(source, veh) 
  
             
end 
end 
end 
) 

Link to comment

لا انا قصدي مثلا انت معك سياره جيت انا ابي اخذ سياره من الماركر يجيك لوحه وينسحب منك السياره ليه ؟

انا مابيها تنسحب منك السياره ولا تجيك لوحه

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

Link to comment

لأن في جانب السيرفر راح يكون المعرف شآمل للكل

veh مثل

لو واحد جاء واخذ سيارة بـ نفس التعريف هذا

بتصير بأسمه وانت مآلك شيء <@>

الأفضل انك تستخدم الجداول لـ الحفظ

Ex.:

Vehicles = { } -- إنشاء جدول جديد 
  
Vehicles [ element ] = createVehicle ( .. ) -- تعيين قيمة داخل الجدول اللي هي السيارة 

بـ كذا انت حفظ السيارة على المنت محدد وتقدر تتحكم فيه متى ماتبي

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

addEventHandler ( "onPlayerQuit", root, -- إيفنت 
    function ( ) -- فنكشن 
        if Vehicles [ source ] then -- إثبات وجود جدول حفظ لـ اللاعب 
            if isElement ( Vehicles [ source ] ) then -- إثبات ان القيمة اللي بالجدول == إلمنت 
                destroyElement ( Vehicles [ source ] ) -- إزالة السيارة 
            end -- إنهاء الشرط الثاني 
        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...