Jump to content

تعديل كود


Dr.Xen

Recommended Posts

السلام عليكم ورحمة الله وبركاته ..

ممكن تعديل على كود ..

ابي لوحة سيارات تفتح اول ما تلمس الماركر انا عندي اول ما المس تفتح لكل الأعبين السيرفر....

انا ابيه فقط الي لمس الماركر ولازم يكون اعضاء القروب

GUIEditor_Button = {} 
GUIEditor_Grid = {} 
GUIEditor_Marker = {} 
GUIEditor_Window = {} 
local marker = {} 
vehicleId = {510,433,601,497,522,463,596,490,535,409,562,560} 
marker = createMarker(207.51126,1864.24365,12,"cylinder",2,0,100,0,220) 
  
  
local x,y = guiGetScreenSize() 
local x = x - 208 
local y = y - 321 
GUIEditor_Window[1] = guiCreateWindow(500,147,246,413,"Select Car",false) 
guiSetVisible(GUIEditor_Window[1],false) 
guiSetAlpha(GUIEditor_Window[1],1) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Grid[1] = guiCreateGridList(9,34,228,255,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
column = guiGridListAddColumn(GUIEditor_Grid[1],"vehicle name",0.5) 
GUIEditor_Button[2] = guiCreateButton(20,308,210,41,"Select",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(20,352,210,41,"Close",false,GUIEditor_Window[1]) 
  
  
  
for i,id in ipairs ( vehicleId ) do 
guiGridListSetItemText ( GUIEditor_Grid[1], guiGridListAddRow( GUIEditor_Grid[1] ), column, getVehicleNameFromModel( id ), false, false ) 
end 
  
addEventHandler ("onClientMarkerHit", marker, 
function( player ) 
       if getTeamName(getPlayerTeam(player)) == "Police" and getElementData(player, "gang") == "[ARMY]" then 
  
                x999,y999,z999 = getElementPosition( localPlayer ) 
                setElementFrozen ( localPlayer, true ) 
                guiSetVisible(GUIEditor_Window[1],true) 
                showCursor( true ) 
                end 
                end 
                ) 
  
addEventHandler('onClientGUIClick', root, 
function() 
    if ( source == GUIEditor_Button[1] ) then 
        guiSetVisible(GUIEditor_Window[1],false) 
        showCursor( false ) 
        setElementFrozen ( localPlayer, false ) 
    elseif ( source == GUIEditor_Button[2] ) then 
        local name = guiGridListGetItemText( GUIEditor_Grid[1], guiGridListGetSelectedItem ( GUIEditor_Grid[1] ), 1 ) 
        triggerServerEvent('gvoa', getLocalPlayer(), name) 
        guiSetVisible(GUIEditor_Window[1],false) 
        setElementFrozen ( localPlayer, false ) 
        showCursor( false ) 
    end 
end 
) 
  
  
  

local health = {} 
Door = createObject(980,-68.69921875,2064.5,19.200000762939,0,0,89.24743) 
markerDoor = createMarker(-68.69921875,2064.5,19.200000762939,"cylinder",9,0,0,0,0) 
health1 = createMarker(202.39999389648,1920,16.60000038147,"cylinder",2,0,100,0,255) 
health2 = createMarker(265.69921875,1946.19921875,615,"cylinder",2,0,100,0,255) 
eH = createMarker(220.30000305176,1919.6999511719,16.60000038147,"cylinder",1.5,76,31,223,255) 
eH1 = createMarker(224.5,1931.5,18.2,"arrow",1.5,76,31,223,255) 
eH2 = createMarker(256.099609375,1879.69921875,706.09997558594,"arrow",1.5,76,31,223,255) 
eH3 = createMarker(275.7998046875,1954.69921875,618.20001220703,"arrow",1.5,76,31,223,255) 
eH4 = createMarker(220.2998046875,1947.19921875,618.20001220703,"arrow",1.5,76,31,223,255) 
eH5 = createMarker(243.2998046875,1897.099609375,705.29998779297,"arrow",1.5,76,31,223,255) 
oH = createMarker(247.599609375,1881.2998046875,615,"cylinder",1.5,76,31,223,255) 
setElementDimension( oH, 0 ) 
setElementInterior( oH, 0 ) 
createBlip(207.51126,1864.24365,12,20) 
eB2 = createMarker(210.80000305176,1920.5,16.700000762939,"cylinder",2,255,0,0,255) 
eB3 = createMarker(193.39999389648,1920.5999755859,16.6,"cylinder",2,255,0,0,255) 
  
  
addEventHandler("onMarkerHit",root, 
function ( hPlayer ) 
if ( source == markerDoor ) then 
       if getTeamName(getPlayerTeam(hPlayer)) == "Police" and getElementData(hPlayer, "gang") == "[ARMY]" then 
moveObject( Door, 2000,-68.69921875,2064.5,13 ) 
else 
outputChatBox( 'Only '..groupName..' !', hPlayer, 255, 0, 255 ) 
end 
elseif ( source == health1 )or ( source == health2 ) then 
       if getTeamName(getPlayerTeam(hPlayer)) == "Police" and getElementData(hPlayer, "gang") == "[ARMY]" then 
fixVehicle( getPedOccupiedVehicle( hPlayer ) ) 
setPedArmor( hPlayer, 100 ) 
setElementHealth( hPlayer, 200 ) 
end 
elseif ( source == eH ) then 
       if getTeamName(getPlayerTeam(hPlayer)) == "Police" and getElementData(hPlayer, "gang") == "[ARMY]" then 
setElementDimension( hPlayer, 0 ) 
setElementPosition( hPlayer, 247.93990,1884.48706,616.22003 ) 
setElementInterior( hPlayer, 0 ) 
setPedArmor( hPlayer, 100 ) 
setElementHealth( hPlayer, 200 ) 
outputChatBox('Welcome '..getPlayerName( hPlayer )..' !', hPlayer, 0, 255, 0 ) 
else 
outputChatBox('Only '..groupName..' !', hPlayer, 0, 255, 0 ) 
end 
elseif ( source == eH1 ) then 
       if getTeamName(getPlayerTeam(hPlayer)) == "Police" and getElementData(hPlayer, "gang") == "[ARMY]" then 
setElementDimension( hPlayer, 0 ) 
setElementPosition( hPlayer, 254.57642,1880.06226,705.20001 ) 
setElementInterior( hPlayer, 0 ) 
setPedArmor( hPlayer, 100 ) 
setElementHealth( hPlayer, 200 ) 
outputChatBox('Welcome '..getPlayerName( hPlayer )..' !', hPlayer, 0, 255, 0 ) 
else 
outputChatBox('Only '..groupName..' !', hPlayer, 0, 255, 0 ) 
end 
elseif ( source == eH2 ) then 
       if getTeamName(getPlayerTeam(hPlayer)) == "Police" and getElementData(hPlayer, "gang") == "[ARMY]" then 
setElementDimension( hPlayer, 0 ) 
setElementPosition( hPlayer, 226.36015,1931.3930,17.640631 ) 
setElementInterior( hPlayer, 0 ) 
setPedArmor( hPlayer, 100 ) 
setElementHealth( hPlayer, 200 ) 
outputChatBox('Welcome '..getPlayerName( hPlayer )..' !', hPlayer, 0, 255, 0 ) 
else 
outputChatBox('Only '..groupName..' !', hPlayer, 0, 255, 0 ) 
end 
elseif ( source == eH3 ) then 
       if getTeamName(getPlayerTeam(hPlayer)) == "Police" and getElementData(hPlayer, "gang") == "[ARMY]" then 
setElementDimension( hPlayer, 0 ) 
setElementPosition( hPlayer, 254.37010,1902.82642,704.62500 ) 
setElementInterior( hPlayer, 0 ) 
setPedArmor( hPlayer, 100 ) 
setElementHealth( hPlayer, 200 ) 
outputChatBox('Welcome '..getPlayerName( hPlayer )..' !', hPlayer, 0, 255, 0 ) 
else 
outputChatBox('Only '..groupName..' !', hPlayer, 0, 255, 0 ) 
end 
elseif ( source == eH4 ) then 
       if getTeamName(getPlayerTeam(hPlayer)) == "Police" and getElementData(hPlayer, "gang") == "[ARMY]" then 
setElementDimension( hPlayer, 0 ) 
setElementPosition( hPlayer, 254.37010,1902.82642,704.62500 ) 
setElementInterior( hPlayer, 0 ) 
setPedArmor( hPlayer, 100 ) 
setElementHealth( hPlayer, 200 ) 
outputChatBox('Welcome '..getPlayerName( hPlayer )..' !', hPlayer, 0, 255, 0 ) 
else 
outputChatBox('Only '..groupName..' !', hPlayer, 0, 255, 0 ) 
end 
elseif ( source == eH5 ) then 
       if getTeamName(getPlayerTeam(hPlayer)) == "Police" and getElementData(hPlayer, "gang") == "[ARMY]" then 
setElementDimension( hPlayer, 0 ) 
setElementPosition( hPlayer, 211.87152,1915.50549,17.64063 ) 
setElementInterior( hPlayer, 0 ) 
setPedArmor( hPlayer, 100 ) 
setElementHealth( hPlayer, 200 ) 
outputChatBox('See You Soon '..getPlayerName( hPlayer )..' !', hPlayer, 0, 255, 0 ) 
else 
outputChatBox('Only '..groupName..' !', hPlayer, 0, 255, 0 ) 
end 
elseif ( source == eB2 ) then 
       if getTeamName(getPlayerTeam(hPlayer)) == "Police" and getElementData(hPlayer, "gang") == "[ARMY]" then 
if isPedInVehicle( hPlayer ) then setElementPosition( getPedOccupiedVehicle( hPlayer ), 1538.1999511719,-1678,13.5 ) return end 
            setElementPosition( hPlayer, 1538.1999511719,-1678,13.5 ) 
       
        else 
        outputChatBox( groupName .. ' only ', hPlayer, 255, 0, 0, false ) 
        end  
elseif ( source == eB3 ) then 
       if getTeamName(getPlayerTeam(hPlayer)) == "Police" and getElementData(hPlayer, "gang") == "[ARMY]" then 
if isPedInVehicle( hPlayer ) then setElementPosition( getPedOccupiedVehicle( hPlayer ), 587.79998779297,-1239.1999511719,17.799999237061 ) return end 
            setElementPosition( hPlayer, 587.79998779297,-1239.1999511719,17.799999237061 ) 
       
        else 
        outputChatBox( groupName .. ' only ', hPlayer, 255, 0, 0, false ) 
        end          
elseif ( source == oH ) then 
       if getTeamName(getPlayerTeam(hPlayer)) == "Police" and getElementData(hPlayer, "gang") == "[ARMY]" then 
setElementDimension( hPlayer, 0 ) 
setElementPosition( hPlayer, 220.17543,1916.06409,17.64063 ) 
setElementInterior( hPlayer, 0 ) 
outputChatBox('See You Soon  '..getPlayerName( hPlayer )..' !', hPlayer, 0, 255, 0 ) 
end 
end 
end 
) 
  
  
addEventHandler("onMarkerLeave",root, 
function ( hPlayer ) 
if ( source == markerDoor ) then 
       if getTeamName(getPlayerTeam(hPlayer)) == "Police" and getElementData(hPlayer, "gang") == "[ARMY]" then 
moveObject(Door,2000,-68.69921875,2064.5,19.200000762939) 
end 
end 
end 
) 
AircraftIdSpawn = { 
{ 372.70001220703,1927,23 }, 
} 
  
        Door3 = createObject(980,135.19999694824,1940.8000488281,21.10000038147) 
markerDoor3 = createMarker(135.19999694824,1940.8000488281,21.10000038147,'cylinder',11,0,0,0,0) 
     addEventHandler('onMarkerHit',markerDoor3, 
    function ( hitElement ) 
       if getTeamName(getPlayerTeam(hitElement)) == "Police" and getElementData(hitElement, "gang") == "[ARMY]" then 
    moveObject(Door3,2000,135.19999694824,1940.8000488281,13) 
          else 
       outputChatBox ( "* You most be ARMY Group ", hitElement, 0, 0, 255, true ) 
    end 
    end 
    ) 
  
     addEventHandler('onMarkerLeave',markerDoor3, 
    function ( hitElement ) 
         moveObject(Door3,1500,135.19999694824,1940.8000488281,21.10000038147) 
    end 
    ) 
  
  
  
onWasted = function() 
       if getTeamName(getPlayerTeam(source)) == "Police" and getElementData(source, "gang") == "[ARMY]" then 
            function sp( source ) 
             setElementDimension( source, 0 ) 
             setPedSkin( source, 287 ) 
             setElementPosition( source, 254.37010,1902.82642,704.62500 ) 
             setElementInterior( source, 0 ) 
             setPedFightingStyle(source,6) 
             setPedStat(source,24,1000) 
             setElementHealth ( source, 200 ) 
             setPedArmor( source, 100 ) 
            end 
            setTimer(sp,1000,1,source) 
    end 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), onWasted ) 
  
  
    local marker = createMarker ( 192.80000305176, 1888.0999755859, 3, "cylinder", 450, 255, 255, 0, 0 ) 
          
    addEventHandler ( "onMarkerHit", marker, 
        function ( player ) 
            if ( getElementType( player ) == "Police" ) and ( getElementData ( player, "gang" ) ~= "[ARMY]" ) then 
                local theVehicle = getPedOccupiedVehicle ( player ) 
                if ( theVehicle ) then 
                    setElementPosition ( theVehicle, 694.16492, 1942.40430, 5.53906 ) 
                else 
                    setElementPosition ( player, 694.16492, 1942.40430, 5.53906 ) 
                end 
                outputChatBox ( "God Bye!==Only For Group [ARMY]", player, 255, 255, 0) 
            end 
        end 
    ) 

Link to comment

حطه Client

  
local Marker = createMarker ( X, Y, Z, "cylinder", 1, 255, 255, 0, 150 ) عوض هنا احداثيات الماركر 
  
addEventHandler('onClientMarkerHit', Marker, 
  
function ( hitPlayer ) 
  
         if ( hitPlayer == localPlayer ) then 
  
         guiSetVisible ( abu ,true ) اسم اللوحة بدل abu 
  
        showCursor( true ) 
  
       guiSetInputEnabled(false) 
  
    end 
  
end ) 

Link to comment

local Marker = createMarker ( X, Y, Z, "cylinder", 1, 255, 255, 0, 150 ) عوض هنا احداثيات الماركر 
  
addEventHandler("onClientMarkerHit", Marker, 
  
function ( hitPlayer ) 
          if getElementType ( hitPlayer ) == "localPlayer" and getElementData( hitPlayer, "gang" ) == "[ARMY]" then 
          guiSetVisible ( GUIEditor_Window[1] ,true ) 
         showCursor( true ) 
        end 
    end  
) 
  
  
  
addEventHandler("onClientMarkerLeave", Marker, 
  
function ( leftPlayer ) 
          if getElementType ( leftPlayer ) == "localPlayer" and getElementData( leftPlayer, "gang" ) == "[ARMY]" then 
          guiSetVisible ( GUIEditor_Window[1] ,false ) 
         showCursor( false ) 
        end 
    end  
) 
Link to comment

شوف هرست الكود

GUIEditor_Button = {} 
GUIEditor_Grid = {} 
GUIEditor_Marker = {} 
GUIEditor_Window = {} 
local marker = {} 
vehicleId = {510,433,601,497,522,463,596,490,535,409,562,560} 
marker = createMarker(207.51126,1864.24365,12,"cylinder",2,0,100,0,220) 
  
  
local x,y = guiGetScreenSize() 
local x = x - 208 
local y = y - 321 
GUIEditor_Window[1] = guiCreateWindow(500,147,246,413,"Select Car",false) 
guiSetVisible(GUIEditor_Window[1],false) 
guiSetAlpha(GUIEditor_Window[1],1) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Grid[1] = guiCreateGridList(9,34,228,255,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
column = guiGridListAddColumn(GUIEditor_Grid[1],"vehicle name",0.5) 
GUIEditor_Button[2] = guiCreateButton(20,308,210,41,"Select",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(20,352,210,41,"Close",false,GUIEditor_Window[1]) 
  
  
  
      
    addEventHandler("onClientMarkerHit", marker, 
      
    function ( hitPlayer ) 
              if getElementType ( hitPlayer ) == "localPlayer" and getElementData( hitPlayer, "gang" ) == "[ARMY]" then 
              guiSetVisible ( GUIEditor_Window[1] ,true ) 
             showCursor( true ) 
            end 
        end 
    ) 
      
      
      
    addEventHandler("onClientMarkerLeave", marker, 
      
    function ( leftPlayer ) 
              if getElementType ( leftPlayer ) == "localPlayer" and getElementData( leftPlayer, "gang" ) == "[ARMY]" then 
              guiSetVisible ( GUIEditor_Window[1] ,false ) 
             showCursor( false ) 
            end 
        end 
    )             ) 
  
  
  
  
  

ممكن تعدلي على الكود الى فوق ..^

وأآسف تعبتك

Link to comment
local x,y = guiGetScreenSize() 
local x = x - 208 
local y = y - 321 
GUIEditor_Window[1] = guiCreateWindow(500,147,246,413,"Select Car",false) 

بالنسبة لهذا الكود

local x,y = guiGetScreenSize() 
local x = x - 208 
local y = y - 321 

ليه حاط هذا الكود و ماعرفت x.y

وماااشوفه حاطه باللوحة

Link to comment

الحين ليه كل ذي المسافات بالكود؟؟؟

رتب كودك عشان تقدر تفهمه

GUIEditor_Button = {} 
GUIEditor_Grid = {} 
GUIEditor_Marker = {} 
GUIEditor_Window = {} 
vehicleId = {510,433,601,497,522,463,596,490,535,409,562,560} 
marker = createMarker(207.51126,1864.24365,12,"cylinder",2,0,100,0,220) 
  
local x,y = guiGetScreenSize() 
  
GUIEditor_Window[1] = guiCreateWindow(x/2-123,y/2-206,246,413,"Select Car",false) 
guiSetVisible(GUIEditor_Window[1],false) 
guiSetAlpha(GUIEditor_Window[1],1) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Grid[1] = guiCreateGridList(9,34,228,255,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
column = guiGridListAddColumn(GUIEditor_Grid[1],"vehicle name",0.5) 
GUIEditor_Button[2] = guiCreateButton(20,308,210,41,"Select",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(20,352,210,41,"Close",false,GUIEditor_Window[1]) 
  
addEventHandler("onClientMarkerHit", marker, 
function(hitPlayer) 
    if hitPlayer == localPlayer and getElementData(hitPlayer, "gang") == "[ARMY]" then 
        guiSetVisible(GUIEditor_Window[1], true) 
        showCursor(true) 
    end 
end) 
  
addEventHandler("onClientMarkerLeave", marker, 
function(leftPlayer) 
    if leftPlayer == localPlayer and getElementData(leftPlayer, "gang") == "[ARMY]" then 
        guiSetVisible(GUIEditor_Window[1], false) 
        showCursor(false) 
    end 
end) 

Link to comment
الحين انت رتبت؟

هذا لانك ما نسخت الكود بالطريقة الصحيحة

الطريقة الصحيح للنسخ

لأخفاء ارقام الأسطر LINE NUMBER ON/OFF اول شي اضغط على الزر

لتحديد كل الكود SELECT ALL بعدين اضغط على الزر

لنسخ الكود Ctrl + c بعدين اضغط

على حسب لغة المتصفح عندك copy او ممكن تضغط يمين و تختار نسخ او

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