Jump to content

طلب تصحيح كود ماركر سيارات حق قروبات


Recommended Posts

GUIEditor_Button = {} 
GUIEditor_Grid = {} 
GUIEditor_Marker = {} 
GUIEditor_Window = {} 
local markers = {} 
local groupName = 'group name' 
vehicleId = {411,431,415,451,485,487,521,522,541,560,586} 
marker = createMarker(849.2998046875,1283.899140625,35.099998474121,"cylinder",2,0,0,0,0) 
local x,y = guiGetScreenSize() 
local x = x - 208 
local y = y - 321 
GUIEditor_Window[1] = guiCreateWindow(500,147,246,413,"سيارات الغروب",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],"اسم المركبة",0.5) 
GUIEditor_Button[2] = guiCreateButton(20,308,210,41,"اختيار",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(20,352,210,41,"إغلاق",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 getPlayerTeam( player ) and getTeamName( getPlayerTeam( player ) ) == 'No Team' and not isPedInVehicle( player ) and player == localPlayer and getElementData ( player , "Group" ) == groupName 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 
) 
  
  
  

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

Link to comment
GUIEditor_Button = {} 
GUIEditor_Grid = {} 
GUIEditor_Marker = {} 
GUIEditor_Window = {} 
  
Marker = { 
    [1] = { 849.2998046875,1283.899140625,35.099998474121 }, 
    [2] = { 849.2998046875,1284.899140625,35.099998474121 }, 
    [3] = { 849.2998046875,1285.899140625,35.099998474121 }, 
    [4] = { 849.2998046875,1286.899140625,35.099998474121 }, 
    [5] = { 849.2998046875,1287.899140625,35.099998474121 }, 
    [6] = { 849.2998046875,1288.899140625,35.099998474121 }, 
} 
  
addEventHandler ( "onClientResourceStart", resourceRoot, 
    function ( ) 
        for _,Markers in ipairs ( Marker ) do 
            TheMarker = createMarker ( Markers[1], Markers[2], Markers[3] - 1, "cylinder", 2, 255, 0, 0, 250 ) 
        end 
    end 
) 
  
local groupName = 'group name' 
vehicleId = {411,431,415,451,485,487,521,522,541,560,586} 
local x,y = guiGetScreenSize() 
local x = x - 208 
local y = y - 321 
GUIEditor_Window[1] = guiCreateWindow(500,147,246,413,"سيارات القروب",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],"اسم المركبة",0.5) 
GUIEditor_Button[2] = guiCreateButton(20,308,210,41,"اختيار",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(20,352,210,41,"إغلاق",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", resourceRoot,  
function( player ) 
    if getPlayerTeam( player ) and getTeamName( getPlayerTeam( player ) ) == 'No Team' and not isPedInVehicle( player ) and player == localPlayer and getElementData ( player , "Group" ) == "groupName" 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 
) 
  

Edited by Guest
Link to comment
مرحبا اخي الغزيز انا جربتها ما اشتغل تيجي لوحا لما احط اختيار ما يعطي سيارة ويقفل فقط ولا في اكواد تانية

هذا لأن الكود ناقص

فيه كود ثاني حق سيرفر

بس الرجال ما طرح غير كلنت

Link to comment

server#

  
  markerpv = createMarker( 1847.0590820313, -2552.94140625, 12.55, "cylinder", 2, 0, 0, 255, 255 ) 
   
local vehicles = {} 
      
function spawnVehp(id) 
local x, y, z = getElementPosition(source) 
if isElement(vehicles[source]) then destroyElement(vehicles[source]) end 
vehicles[source] = createVehicle(id,x,y,z) 
warpPedIntoVehicle(source, vehicles[source]) 
end 
addEvent("CreVehicePv",true) 
addEventHandler("CreVehicePv", root, spawnVehp) 
      
addEventHandler("onPlayerQuit", root, 
function() 
if isElement(vehicles[source]) then 
destroyElement(vehicles[source]) 
vehicles[source] = nil 
end 
end) 
  
function showGUIpv(hitPlayer) 
if hitPlayer and getElementType(hitPlayer) == "player" then 
if ( getElementData(hitPlayer, "Group" ) == "G" ) then 
triggerClientEvent (hitPlayer,"showGUIpv",getRootElement(),hitPlayer) 
else 
end 
end 
end 
addEventHandler("onMarkerHit",markerpv,showGUIpv) 
  

client#

  
    Wnd1 = guiCreateWindow ( 0.2, 0.2, 0.25, 0.5, "Free Vehicles", true ) 
  --  guiSetAlpha( Wnd1, 1 ) 
    buttonv = guiCreateButton ( 0.5, 0.8, 0.45, 0.15, "close", true, Wnd1 ) 
    button1v = guiCreateButton ( 0.01, 0.8, 0.45, 0.15, "Selection", true, Wnd1 ) 
    label = guiCreateLabel ( 0.1, 0.1, 0.9, 0.1, "get free vehicle", true, Wnd1 ) 
    showCursor(false) 
    guiSetVisible( Wnd1, false ) 
    guiWindowSetSizable( Wnd1, false ) 
    guiWindowSetMovable( Wnd1, false ) 
    
      
      
        vehicles = 
                { 
                {"Police LS", 596}, 
                {"Police SF", 597}, 
                {"Police LV", 598}, 
                {"Police Ranger", 599}, 
                {"HPV1000", 523}, 
                {"Enforcer", 427}, 
                {"ENTER", 427}, 
                }     
        grid = guiCreateGridList(0.01, 0.2, 0.99, 0.5, true, Wnd1) 
        guiGridListAddColumn(grid, "Vehicles", 0.85) 
          
        for i,veh in ipairs(vehicles) do 
             row = guiGridListAddRow(grid) 
             -- 
             guiGridListSetItemText(grid, row, 1, tostring(veh[1]), false, false) 
             guiGridListSetItemData(grid, row, 1, tostring(veh[2])) 
        end 
          
    function useP() 
        local row, col = guiGridListGetSelectedItem(grid)   
        if (row and col and row ~= -1 and col ~= -1) then 
            local model = tonumber(guiGridListGetItemData(grid, row, 1)) 
            if model ~= "" then 
                triggerServerEvent("CreVehicePv", localPlayer, model) 
                guiSetVisible(Wnd1,false) 
            showCursor(false) 
            end 
        end 
    end 
    addEventHandler("onClientGUIClick", button1v, useP, false) 
      
    function close() 
        if (source == buttonv) then 
            guiSetVisible(Wnd1,false) 
            showCursor(false) 
        end 
    end 
    addEventHandler("onClientGUIClick", buttonv, close) 
        
    function showGUIpv() 
        guiSetVisible(Wnd1,true) 
        showCursor(true) 
    end 
    addEvent("showGUIpv",true) 
    addEventHandler("showGUIpv", getRootElement(), showGUIpv) 
  

Link to comment

Client Side !

Wnd1 = guiCreateWindow ( 0.2, 0.2, 0.25, 0.5, "Free Vehicles", true ) 
guiSetAlpha( Wnd1, 1 ) 
buttonv = guiCreateButton ( 0.5, 0.8, 0.45, 0.15, "close", true, Wnd1 ) 
button1v = guiCreateButton ( 0.01, 0.8, 0.45, 0.15, "Selection", true, Wnd1 ) 
grid = guiCreateGridList(0.01, 0.2, 0.99, 0.5, true, Wnd1) 
label = guiCreateLabel ( 0.1, 0.1, 0.9, 0.1, "get free vehicle", true, Wnd1 ) 
showCursor(false) 
guiSetVisible( Wnd1, false ) 
guiWindowSetSizable( Wnd1, false ) 
guiWindowSetMovable( Wnd1, false )    
  
vehicles = { 
{"Police LS", 596}, 
{"Police SF", 597}, 
{"Police LV", 598}, 
{"Police Ranger", 599}, 
{"HPV1000", 523}, 
{"Enforcer", 427}, 
{"ENTER", 427}, 
}      
guiGridListAddColumn(grid, "Vehicles", 0.85)      
  
for i,veh in ipairs(vehicles) do                   
row = guiGridListAddRow(grid)          
guiGridListSetItemText(grid, row, 1, tostring(veh[1]), false, false) 
guiGridListSetItemData(grid, row, 1, tostring(veh[2])) 
end 
          
function useP() 
  local row, col = guiGridListGetSelectedItem (  grid )    
   if ( row and col and row ~= -1 and col ~= -1 ) then 
        local model  = tonumber( guiGridListGetItemData( grid, guiGridListGetSelectedItem( grid ) ) ) 
     if model and model ~= '' then 
          triggerServerEvent("CreVehicePv", localPlayer, model) 
          guiSetVisible(Wnd1,false) 
          showCursor(false) 
        end 
    end 
end 
addEventHandler("onClientGUIClick", button1v, useP, false) 
      
function close() 
  if (source == buttonv) then 
    guiSetVisible(Wnd1,false) 
    showCursor(false) 
  end 
end 
addEventHandler("onClientGUIClick", buttonv, close) 
        
function showGUIpv() 
      guiSetVisible(Wnd1,true) 
      showCursor(true) 
end 
addEvent("showGUIpv",true) 
addEventHandler("showGUIpv", getRootElement(), showGUIpv) 

-------------------------

Server Side !

markerpv = createMarker( 1847.0590820313, -2552.94140625, 12.55, "cylinder", 2, 0, 0, 255, 255 ) 
  
local vehicles = {} 
      
function spawnVehp( model ) 
local x, y, z = getElementPosition(source) 
if isElement(vehicles[source]) then destroyElement(vehicles[source]) end 
vehicles[source] = createVehicle(model, x + 2, y, z) 
warpPedIntoVehicle(source, vehicles[source]) 
end 
addEvent("CreVehicePv",true) 
addEventHandler("CreVehicePv", root, spawnVehp) 
      
addEventHandler('onPlayerQuit', root,function() 
    if isElement(vehicles[source]) then 
        destroyElement(vehicles[source]) 
            vehicles[source] = nil 
         end 
    end 
) 
  
  
addEventHandler ( "onMarkerHit", markerpv, function ( za7f ) 
   if getElementType ( za7f ) == "player" then 
    if ( getElementData( za7f, "Group" ) == "G" ) then 
      triggerClientEvent (za7f, "showGUIpv", za7f) 
     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...