Jump to content

طلب كود


Recommended Posts

  
-- Client 
'onClientGUIClick' 
guiGridListGetItemText 
guiGridListGetSelectedItem 
triggerServerEvent 
  

  
-- Server 
createVehicle 
-- للطلب الثاني 
destroyElement 
  

كذا في خطأ ؟

if (source ==  GUIEditor.gridlist[1]) then 
        if id == -1 and idd then 
            guiGridListSetSelectedItem( GUIEditor.gridlist[1], idd, 1) 
            return false 
        else 
            idd = guiGridListGetSelectedItem( GUIEditor.gridlist[1]) 
        end 
    elseif id == -1 then 
    elseif (source == GUIEditor.button[1]) then 
    if not isInColExport () then 
        triggerServerEvent("SpawnMyVehicle", localPlayer, ID) 
                end 
    elseif (source == GUIEditor.button[2]) then  
        triggerServerEvent("DestroyMyVehicle", localPlayer, ID) 

Link to comment

ده فيه خطأ ؟

addEventHandler( 'onClientGUIClick', root, 
function() 
 if (source ==  GUIEditor.gridlist[1]) then 
        if id == -1 and idd then 
            guiGridListSetSelectedItem( GUIEditor.gridlist[1], idd, 1) 
            return false 
        else 
            idd = guiGridListGetSelectedItem( GUIEditor.gridlist[1]) 
        end 
    elseif id == -1 then 
    elseif (source == GUIEditor.button[1]) then 
        triggerServerEvent("SpawnMyVehicle", localPlayer, ID) 
      
    
    elseif (source == GUIEditor.button[2]) then 
        triggerServerEvent("DestroyMyVehicle", localPlayer, ID) 
  
 elseif (source == GUIEditor.button[5]) then 
triggerServerEvent( 'WVehicleToMe', localPlayer ) 
  
 elseif (source == GUIEditor.button[4]) then 
triggerServerEvent( 'WMEToVehicle', localPlayer ) 
  
end 
end ) 

Link to comment

و هنا في خطأ ؟

server

addEvent('SpawnMyVehicle', true) 
addEventHandler( 'SpawnMyVehicle', root, 
  function(getCarID, Serial) 
  local name = getPlayerName(source) 
  player_1 = getPlayerFromName(name) 
   local x, y, z = getElementPosition(source) 
   if isElement(vehicle[source]) then destroyElement(vehicle[source]) end 
    vehicle[source] = createVehicle( getCarID, x + 2, y + 2, z + 1) 
    setElementData(vehicle[source],'VehicleSerial',getPlayerSerial(source)) 
end) 
  
  
addEvent( 'DestroyMyVehicle', true ) 
addEventHandler( 'DestroyMyVehicle', root, 
function() 
if not isElement(vehicle[source]) then  
destroyElement(vehicle[source]) 
end  
  end) 

Link to comment

146168112584741.png

addEvent('SpawnMyVehicle', true) 
addEventHandler( 'SpawnMyVehicle', root, 
  function(getCarID, Serial) 
   local x, y, z = getElementPosition(source) 
   if isElement(vehicle[source]) then destroyElement(vehicle[source]) end 
    vehicle[source] = createVehicle( getCarID, x + 2, y + 2, z + 1) 
    setElementData(vehicle[source],'VehicleSerial',getPlayerSerial(source)) 
end) 
  
  
addEvent( 'DestroyMyVehicle', true ) 
addEventHandler( 'DestroyMyVehicle', root, 
function() 
if not isElement(vehicle[source]) then  
destroyElement(vehicle[source]) 
end  
  end) 

Link to comment
addEventHandler( 'onClientGUIClick', root, 
function() 
 if (source ==  GUIEditor.gridlist[1]) then 
        if id == -1 and idd then 
            guiGridListSetSelectedItem( GUIEditor.gridlist[1], idd, 1) 
            return false 
        else 
            idd = guiGridListGetSelectedItem( GUIEditor.gridlist[1]) 
        end 
    elseif id == -1 then 
    elseif (source == GUIEditor.button[1]) then 
        triggerServerEvent("SpawnMyVehicle", localPlayer, ID) 
      
    
    elseif (source == GUIEditor.button[2]) then 
        triggerServerEvent("DestroyMyVehicle", localPlayer, ID) 
  
 elseif (source == GUIEditor.button[5]) then 
triggerServerEvent( 'WVehicleToMe', localPlayer ) 
  
 elseif (source == GUIEditor.button[4]) then 
triggerServerEvent( 'WMEToVehicle', localPlayer ) 
  
end 
end ) 

Link to comment
دي الاكواد كامله ؟
  
local key = "o" 
  
 GUIEditor.window is deleted * 
  
function Show_Hide() 
if guiGetVisible(GUIEditor.window[1]) == false then 
guiSetVisible(GUIEditor.window[1], true) 
showCursor(true) 
else 
guiSetVisible(GUIEditor.window[1], false) 
showCursor(false) 
end 
end 
bindKey(key,"down",Show_Hide) 
  
  
-- Code By Dabl 
for id = 400, 611 do 
    if getVehicleNameFromModel(id) ~= "" then 
        local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
        guiGridListSetItemText(GUIEditor.gridlist[1], row, 2, getVehicleNameFromModel(id), false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, tostring(id), false, false) 
    end 
end 
  
  
  
  
  
 ---------- code by Saed 
addEventHandler( 'onClientGUIClick', root, 
function() 
 if (source ==  GUIEditor.gridlist[1]) then 
        if id == -1 and idd then 
            guiGridListSetSelectedItem( GUIEditor.gridlist[1], idd, 1) 
            return false 
        else 
            idd = guiGridListGetSelectedItem( GUIEditor.gridlist[1]) 
        end 
    elseif id == -1 then 
    elseif (source == GUIEditor.button[1]) then 
        triggerServerEvent("SpawnMyVehicle", localPlayer, ID) 
      
    
    elseif (source == GUIEditor.button[2]) then 
        triggerServerEvent("DestroyMyVehicle", localPlayer, ID) 
  
 elseif (source == GUIEditor.button[5]) then 
triggerServerEvent( 'WVehicleToMe', localPlayer ) 
  
 elseif (source == GUIEditor.button[4]) then 
triggerServerEvent( 'WMEToVehicle', localPlayer ) 
  
end 
end ) 

Link to comment

  
-- Client Side 
local key = "o" 
  
--GUIEditor.window is deleted * 
  
bindKey( key,"down", 
function Show_Hide( ) 
    guiSetVisible(GUIEditor.window[1] , not guiGetVisible( GUIEditor.window[1] ) ) 
        showCursor( guiGetVisible( GUIEditor.window[1] ) ) 
 end ) 
  
  
for id = 400, 611 do 
    if getVehicleNameFromModel(id) ~= "" then 
        local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
        guiGridListSetItemText(GUIEditor.gridlist[1], row, 2, getVehicleNameFromModel(id), false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, tostring(id), false, false) 
    end 
end 
  
addEventHandler( 'onClientGUIClick', root, 
function() 
    if (source ==  GUIEditor.gridlist[1]) then 
    if id == -1 and idd then 
            guiGridListSetSelectedItem( GUIEditor.gridlist[1], idd, 1) 
            return false 
        else 
            idd = guiGridListGetSelectedItem( GUIEditor.gridlist[1]) 
        end 
    elseif (source == GUIEditor.button[1]) then 
        triggerServerEvent("SpawnMyVehicle", localPlayer, ID) 
      
    
    elseif (source == GUIEditor.button[2]) then 
        triggerServerEvent("DestroyMyVehicle", localPlayer, ID) 
  
    elseif (source == GUIEditor.button[5]) then 
        triggerServerEvent( 'WVehicleToMe', localPlayer ) 
  
    elseif (source == GUIEditor.button[4]) then 
        triggerServerEvent( 'WMEToVehicle', localPlayer ) 
    end 
end ) 

  
--Server Side 
addEvent('SpawnMyVehicle', true) 
addEventHandler( 'SpawnMyVehicle', root, 
function ( ID )  
    if isElement(vehicle[client]) then destroyElement(vehicle[client]) end 
        local Player , SerialPlayer , x, y, z = getPlayerFromName( getPlayerName(client) ) , getPlayerSerial(client) , getElementPosition(client) 
            vehicle[client] = createVehicle( getCarID, x + 2, y + 2, z + 1) 
                setElementData(vehicle[client],'VehicleSerial',SerialPlayer) 
                    warpPedIntoVehicle ( client, vehicle[client] ) 
                        outputChatBox(getPlayerName(client)..'Welcome in Your Car ', client ,255,255,255,true ) 
end ) 
  
addEvent( 'DestroyMyVehicle', true ) 
addEventHandler( 'DestroyMyVehicle', root, 
function ( ) 
    if not isElement(vehicle[client]) then 
        destroyElement(vehicle[client]) 
        end 
end ) 

Note : ماجربته , ومادري لو صح او غلط

Link to comment
  
-- Client Side 
local key = "o" 
  
--GUIEditor.window is deleted * 
  
bindKey( key,"down", 
function Show_Hide( ) 
    guiSetVisible(GUIEditor.window[1] , not guiGetVisible( GUIEditor.window[1] ) ) 
        showCursor( guiGetVisible( GUIEditor.window[1] ) ) 
 end ) 
  
  
for id = 400, 611 do 
    if getVehicleNameFromModel(id) ~= "" then 
        local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
        guiGridListSetItemText(GUIEditor.gridlist[1], row, 2, getVehicleNameFromModel(id), false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, tostring(id), false, false) 
    end 
end 
  
addEventHandler( 'onClientGUIClick', root, 
function() 
    if (source ==  GUIEditor.gridlist[1]) then 
    if id == -1 and idd then 
            guiGridListSetSelectedItem( GUIEditor.gridlist[1], idd, 1) 
            return false 
        else 
            idd = guiGridListGetSelectedItem( GUIEditor.gridlist[1]) 
        end 
    elseif (source == GUIEditor.button[1]) then 
        triggerServerEvent("SpawnMyVehicle", localPlayer, ID) 
      
    
    elseif (source == GUIEditor.button[2]) then 
        triggerServerEvent("DestroyMyVehicle", localPlayer, ID) 
  
    elseif (source == GUIEditor.button[5]) then 
        triggerServerEvent( 'WVehicleToMe', localPlayer ) 
  
    elseif (source == GUIEditor.button[4]) then 
        triggerServerEvent( 'WMEToVehicle', localPlayer ) 
    end 
end ) 

  
--Server Side 
addEvent('SpawnMyVehicle', true) 
addEventHandler( 'SpawnMyVehicle', root, 
function ( ID )  
    if isElement(vehicle[client]) then destroyElement(vehicle[client]) end 
        local Player , SerialPlayer , x, y, z = getPlayerFromName( getPlayerName(client) ) , getPlayerSerial(client) , getElementPosition(client) 
            vehicle[client] = createVehicle( getCarID, x + 2, y + 2, z + 1) 
                setElementData(vehicle[client],'VehicleSerial',SerialPlayer) 
                    warpPedIntoVehicle ( client, vehicle[client] ) 
                        outputChatBox(getPlayerName(client)..'Welcome in Your Car ', client ,255,255,255,true ) 
end ) 
  
addEvent( 'DestroyMyVehicle', true ) 
addEventHandler( 'DestroyMyVehicle', root, 
function ( ) 
    if not isElement(vehicle[client]) then 
        destroyElement(vehicle[client]) 
        end 
end ) 

Note : ماجربته , ومادري لو صح او غلط

نفس المشكلة مفيش حاجة اتغيرت

Link to comment

اهه الاكواد اخي صنعت لوحة شبيهها

كلنت

  
local key = "o" 
GUIEditor = { 
    button = {}, 
    window = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(219, 117, 485, 375, "", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
  
        GUIEditor.button[1] = guiCreateButton(121, 40, 148, 32, "صنع المركبة", false, GUIEditor.window[1]) 
        GUIEditor.button[2] = guiCreateButton(121, 82, 148, 32, "ازالة المركبة", false, GUIEditor.window[1]) 
        GUIEditor.button[3] = guiCreateButton(121, 124, 148, 32, "إصلاح المركبة", false, GUIEditor.window[1]) 
        GUIEditor.button[4] = guiCreateButton(121, 166, 148, 32, "الأنتقال إلي المركبة", false, GUIEditor.window[1]) 
        GUIEditor.button[5] = guiCreateButton(121, 214, 148, 32, "سحب المركبة", false, GUIEditor.window[1]) 
        GUIEditor.button[6] = guiCreateButton(121, 256, 148, 32, "X", false, GUIEditor.window[1])     
    end 
) 
function Show_Hide() 
if guiGetVisible(GUIEditor.window[1]) == false then 
guiSetVisible(GUIEditor.window[1], true) 
showCursor(true) 
else 
guiSetVisible(GUIEditor.window[1], false) 
showCursor(false) 
end 
end 
bindKey(key,"down",Show_Hide) 
  
  
for id = 400, 611 do 
    if getVehicleNameFromModel(id) ~= "" then 
        local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
        guiGridListSetItemText(GUIEditor.gridlist[1], row, 2, getVehicleNameFromModel(id), false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, tostring(id), false, false) 
    end 
end 
  
addEventHandler( 'onClientGUIClick', root, 
function() 
    if (source ==  GUIEditor.gridlist[1]) then 
    if id == -1 and idd then 
            guiGridListSetSelectedItem( GUIEditor.gridlist[1], idd, 1) 
            return false 
        else 
            idd = guiGridListGetSelectedItem( GUIEditor.gridlist[1]) 
        end 
    elseif (source == GUIEditor.button[1]) then 
        triggerServerEvent("SpawnMyVehicle", localPlayer, ID) 
      
    
    elseif (source == GUIEditor.button[2]) then 
        triggerServerEvent("DestroyMyVehicle", localPlayer, ID) 
  
    elseif (source == GUIEditor.button[5]) then 
        triggerServerEvent( 'WVehicleToMe', localPlayer ) 
  
    elseif (source == GUIEditor.button[4]) then 
        triggerServerEvent( 'WMEToVehicle', localPlayer ) 
    end 
end ) 
  
  
--#Client 
addEventHandler("onClientGUIClick", root, 
function() 
    if source == GUIEditor.checkbox[2] and guiCheckBoxGetSelected(GUIEditor.checkbox[2]) == true then 
    Timer = setTimer(function() 
    triggerServerEvent("VehicleColor", localPlayer) 
    end, 500, 0) 
    elseif source == GUIEditor.checkbox[2] and guiCheckBoxGetSelected(GUIEditor.checkbox[2]) == false then 
    killTimer(Timer) 
    end 
end) 
  
  

سيرفر

--Server Side 
addEvent('SpawnMyVehicle', true) 
addEventHandler( 'SpawnMyVehicle', root, 
function ( ID ) 
    if isElement(vehicle[client]) then destroyElement(vehicle[client]) end 
        local Player , SerialPlayer , x, y, z = getPlayerFromName( getPlayerName(client) ) , getPlayerSerial(client) , getElementPosition(client) 
            vehicle[client] = createVehicle( getCarID, x + 2, y + 2, z + 1) 
                setElementData(vehicle[client],'VehicleSerial',SerialPlayer) 
                    warpPedIntoVehicle ( client, vehicle[client] ) 
                        outputChatBox(getPlayerName(client)..'Welcome in Your Car ', client ,255,255,255,true ) 
end ) 
  
addEvent( 'DestroyMyVehicle', true ) 
addEventHandler( 'DestroyMyVehicle', root, 
function ( ) 
    if not isElement(vehicle[client]) then 
        destroyElement(vehicle[client]) 
        end 
end ) 
  

Link to comment
  
-- Client 
addEventHandler('onClientGUIClick',root, 
function () 
if source = CheckBox and guiComboBoxGetSelected(CheckBox) == true then 
triggerServerEvent('Create',localPlayer) 
elseif source = CheckBox and guiComboBoxGetSelected(CheckBox) == false then 
triggerServerEvent('Destroy',localPlayer) 
end 
end 
) 
  

  
--Server 
  
addEvent('Create',true) 
addEvent('Delete',true) 
  
  
addEventHandler('Create',root, 
function (  ) 
local x,y,z = getElementPosition(source) 
Obj = createObject(1318,x, y + 10 , z ) 
end 
) 
  
addEventHandler('Delete',root, 
function () 
if not isElement( Obj ) then return end 
destroyElement( Obj ) 
end 
) 
  
  

Not Testing

Edited by Guest
Link to comment
  
-- Client 
addEventHandler('onClientGUIClick',root, 
function () 
if source = CheckBox and guiComboBoxGetSelected(CheckBox) == true then 
triggerServerEvent('Create',localPlayer) 
elseif source = CheckBox and guiComboBoxGetSelected(CheckBox) == false then 
triggerServerEvent('Destroy',localPlayer) 
end 
end 
) 
  

  
--Server 
  
addEvent('Create',true) 
addEvent('Delete',true) 
  
  
addEventHandler('Create',root, 
function (  ) 
local x,y,z = getElementPosition(source) 
Obj = createObject(1318,x, y + 10 , z ) 
end 
) 
  
addEventHandler('Delete',root, 
function () 
if isElement( Obj ) then return end 
destroyElement( Obj ) 
end 
) 
  
  

Not Testing

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

المفروض تضيف نوت

if not ( isElement( Obj ) ) then return 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...