Jump to content

مششششكلة


Recommended Posts

اسلام عليكم

شبااب انا عندي مشكلة بلفريروم

لما انزل سيارة يعني ما يكون حد جمبي انا بقدر انزل سيارة واحد فقط

اااااماااااااا

اذا كان اثنين او ثلاثة بينزل سيارة علي حسب عدد لاعبين جمبي

وهذا الفيديو يوضح شرح اكثر

clientside:

    local vehicleWidth = { 
    [400] = 3.03, [401] = 3.30, [402] = 2.90, [403] = 5.30, [404] = 3.21, [405] = 3.37, [406] = 6.60, [407] = 4.89, [408] = 5.90, [409] = 4.36, 
    [410] = 2.89, [411] = 2.69, [412] = 3.97, [413] = 3.34, [414] = 3.99, [415] = 3.04, [416] = 4.42, [417] = 16.01, [418] = 3.32, [419] = 3.45, 
    [420] = 3.30, [421] = 3.53, [422] = 3.11, [423] = 3.60, [424] = 2.44, [425] = 9.84, [426] = 3.29, [427] = 4.48, [428] = 3.73, [429] = 2.91, 
    [430] = 6.59, [431] = 6.66, [432] = 7.17, [433] = 5.51, [434] = 2.69, [435] = 7.33, [436] = 3.11, [437] = 6.40, [438] = 3.37, [439] = 3.04, 
    [440] = 3.29, [441] = 2.00, [442] = 3.71, [443] = 10.38, [444] = 3.85, [445] = 3.30, [446] = 6.73, [447] = 7.58, [448] = 1.33, [449] = 5.29, 
    [450] = 7.17, [451] = 3.06, [452] = 5.92, [453] = 6.02, [454] = 9.70, [455] = 5.35, [456] = 5.18, [457] = 2.10, [458] = 3.44, [459] = 3.27, 
    [460] = 8.94, [461] = 1.44, [462] = 1.33, [463] = 1.40, [464] = 1.25, [465] = 0.94, [466] = 3.45, [467] = 3.53, [468] = 1.39, [469] = 7.58, 
    [470] = 3.24, [471] = 1.49, [472] = 4.58, [473] = 2.61, [474] = 3.37, [475] = 3.26, [476] = 8.19, [477] = 3.36, [478] = 3.23, [479] = 3.39, 
    [480] = 2.83, [481] = 1.17, [482] = 3.33, [483] = 3.44, [484] = 9.92, [485] = 2.37, [486] = 4.67, [487] = 7.71, [488] = 6.53, [489] = 3.38, 
    [490] = 3.93, [491] = 3.00, [492] = 2.84, [493] = 6.79, [494] = 3.57, [495] = 3.22, [496] = 2.65, [497] = 7.71, [498] = 4.19, [499] = 3.99, 
    [500] = 2.90, [501] = 0.94, [502] = 3.35, [503] = 3.40, [504] = 3.39, [505] = 3.38, [506] = 2.94, [507] = 3.60, [508] = 4.62, [509] = 1.21, 
    [510] = 1.13, [511] = 15.03, [512] = 6.58, [513] = 6.51, [514] = 5.55, [515] = 5.68, [516] = 3.49, [517] = 3.51, [518] = 3.33, [519] = 13.87, 
    [520] = 8.61, [521] = 1.44, [522] = 1.44, [523] = 1.44, [524] = 5.08, [525] = 3.94, [526] = 2.98, [527] = 3.14, [528] = 3.28, [529] = 3.15, 
    [530] = 2.63, [531] = 2.31, [532] = 7.38, [533] = 2.53, [534] = 3.40, [535] = 3.15, [536] = 3.54, [537] = 11.06, [538] = 8.26, [539] = 2.61, 
    [540] = 3.44, [541] = 2.79, [542] = 3.53, [543] = 3.24, [544] = 6.73, [545] = 2.80, [546] = 3.30, [547] = 3.28, [548] = 12.72, [549] = 3.14, 
    [550] = 3.34, [551] = 2.86, [552] = 4.02, [553] = 18.92, [554] = 3.57, [555] = 2.84, [556] = 3.85, [557] = 3.85, [558] = 2.94, [559] = 3.05, 
    [560] = 3.05, [561] = 3.28, [562] = 2.98, [563] = 9.65, [564] = 0.93, [565] = 2.72, [566] = 3.58, [567] = 3.71, [568] = 2.75, [569] = 9.41, 
    [570] = 9.41, [571] = 1.61, [572] = 1.75, [573] = 4.15, [574] = 2.43, [575] = 3.26, [576] = 3.48, [577] = 45.08, [578] = 6.35, [579] = 3.31, 
    [580] = 3.35, [581] = 1.46, [582] = 3.98, [583] = 2.52, [584] = 8.24, [585] = 3.56, [586] = 1.56, [587] = 3.24, [588] = 5.52, [589] = 2.98, 
    [590] = 9.67, [591] = 7.38, [592] = 36.34, [593] = 9.36, [594] = 0.58, [595] = 6.34, [596] = 3.30, [597] = 3.31, [598] = 3.25, [599] = 3.57, 
    [600] = 3.35, [601] = 4.56, [602] = 3.14, [603] = 3.38, [604] = 3.45, [605] = 3.24, [606] = 2.46, [607] = 2.43, [608] = 4.01, [609] = 4.17, 
    [610] = 1.59, [611] = 2.11, 
    } 
      
    addEvent('Checks',true) 
    addEventHandler('Checks',root,function(vx,vy,vz,vehID,vrot) 
        if tonumber(vx and vy and vz and vehID and vrot) then 
            local px,py,pz = getElementPosition(g_Me) 
            local width = vehicleWidth[vehID] or 3 
                if isLineOfSightClear(px,py,pz+1,vx+width,vy+width,vz+1) and isLineOfSightClear(px,py,pz+1,vx+width,vy-width,vz+1) and isLineOfSightClear(px,py,pz+1,vx-width,vy-width,vz+1) and isLineOfSightClear(px,py,pz+1,vx-width,vy+width,vz+1) then 
                    triggerServerEvent('SendAndGiveVeh',g_Me,vx,vy,vz,vehID,vrot) 
            else 
                    errMsg('Please find a clear location to spawn the vehicle.') 
                end 
            end 
        end 
    ) 

serverside:

  function giveMeVehicles(vehicles) 
        if type(vehicles) == 'number' then 
            vehicles = { vehicles } 
        end 
      
        local px, py, pz, prot 
        local radius = 3 
        local playerVehicle = getPedOccupiedVehicle(source) 
        if playerVehicle and isElement(playerVehicle) then 
            px, py, pz = getElementPosition(playerVehicle) 
            prot, prot, prot = getVehicleRotation(playerVehicle) 
        else 
            px, py, pz = getElementPosition(source) 
            prot = getPedRotation(source) 
        end 
        local offsetRot = math.rad(prot) 
        local vx = px + radius * math.cos(offsetRot) 
        local vy = py + radius * math.sin(offsetRot) 
        local vz = pz + 2 
        local vrot = prot 
      
        vehicleList = g_PlayerData[source].vehicles 
        local vehicle 
        if ( not vehicles ) then return end 
        for i,vehID in ipairs(vehicles) do 
            if vehID < 400 or vehID > 611 then 
                errMsg(vehID ..' is incorrect vehicle model', source) 
            elseif not table.find(getOption('vehicles.disallowed'), vehID) then 
                if #vehicleList >= getOption('vehicles.maxperplayer') then 
                    unloadVehicle(vehicleList[1]) 
                end 
                triggerClientEvent('Checks',source,vx,vy,vz,vehID,vrot) 
            end 
        end 
    end 
      
    addEvent('SendAndGiveVeh',true) 
    addEventHandler('SendAndGiveVeh',root, 
    function(vx,vy,vz,vehID,vrot) 
        vehicle = createVehicle(vehID, vx, vy, vz, 0, 0, vrot) 
            if (not isElement(vehicle)) then return end 
                setElementInterior(vehicle, getElementInterior(source)) 
                setElementDimension(vehicle, getElementDimension(source)) 
                table.insert(vehicleList, vehicle) 
                g_VehicleData[vehicle] = { creator = source, timers = {} } 
                if vehID == 464 then 
                    warpPedIntoVehicle(source, vehicle) 
                elseif not g_Trailers[vehID] then 
                    if getOption('vehicles.idleexplode') then 
                        g_VehicleData[vehicle].timers.fire = setTimer(commitArsonOnVehicle, getOption('vehicles.maxidletime'), 1, vehicle) 
                    end 
                    g_VehicleData[vehicle].timers.destroy = setTimer(unloadVehicle, getOption('vehicles.maxidletime') + (getOption('vehicles.idleexplode') and 10000 or 0), 1, vehicle) 
                end 
                vx = vx + 4 
                vz = vz + 4 
        end 
    ) 

كمان مشكلة لما انزل سيارة بجانب الجدران بتظهر رسالة لجميع لاعبين

 errMsg('Please find a clear location to spawn the vehicle.') 

هذا الكود موجود في كلنت سيد

ورجاء ألي عارف يرد

وشكرا

Link to comment

جرب ,

    -- Client Side ~ ! 
local vehicleWidth = { 
    [400] = 3.03, [401] = 3.30, [402] = 2.90, [403] = 5.30, [404] = 3.21, [405] = 3.37, [406] = 6.60, [407] = 4.89, [408] = 5.90, [409] = 4.36, 
    [410] = 2.89, [411] = 2.69, [412] = 3.97, [413] = 3.34, [414] = 3.99, [415] = 3.04, [416] = 4.42, [417] = 16.01, [418] = 3.32, [419] = 3.45, 
    [420] = 3.30, [421] = 3.53, [422] = 3.11, [423] = 3.60, [424] = 2.44, [425] = 9.84, [426] = 3.29, [427] = 4.48, [428] = 3.73, [429] = 2.91, 
    [430] = 6.59, [431] = 6.66, [432] = 7.17, [433] = 5.51, [434] = 2.69, [435] = 7.33, [436] = 3.11, [437] = 6.40, [438] = 3.37, [439] = 3.04, 
    [440] = 3.29, [441] = 2.00, [442] = 3.71, [443] = 10.38, [444] = 3.85, [445] = 3.30, [446] = 6.73, [447] = 7.58, [448] = 1.33, [449] = 5.29, 
    [450] = 7.17, [451] = 3.06, [452] = 5.92, [453] = 6.02, [454] = 9.70, [455] = 5.35, [456] = 5.18, [457] = 2.10, [458] = 3.44, [459] = 3.27, 
    [460] = 8.94, [461] = 1.44, [462] = 1.33, [463] = 1.40, [464] = 1.25, [465] = 0.94, [466] = 3.45, [467] = 3.53, [468] = 1.39, [469] = 7.58, 
    [470] = 3.24, [471] = 1.49, [472] = 4.58, [473] = 2.61, [474] = 3.37, [475] = 3.26, [476] = 8.19, [477] = 3.36, [478] = 3.23, [479] = 3.39, 
    [480] = 2.83, [481] = 1.17, [482] = 3.33, [483] = 3.44, [484] = 9.92, [485] = 2.37, [486] = 4.67, [487] = 7.71, [488] = 6.53, [489] = 3.38, 
    [490] = 3.93, [491] = 3.00, [492] = 2.84, [493] = 6.79, [494] = 3.57, [495] = 3.22, [496] = 2.65, [497] = 7.71, [498] = 4.19, [499] = 3.99, 
    [500] = 2.90, [501] = 0.94, [502] = 3.35, [503] = 3.40, [504] = 3.39, [505] = 3.38, [506] = 2.94, [507] = 3.60, [508] = 4.62, [509] = 1.21, 
    [510] = 1.13, [511] = 15.03, [512] = 6.58, [513] = 6.51, [514] = 5.55, [515] = 5.68, [516] = 3.49, [517] = 3.51, [518] = 3.33, [519] = 13.87, 
    [520] = 8.61, [521] = 1.44, [522] = 1.44, [523] = 1.44, [524] = 5.08, [525] = 3.94, [526] = 2.98, [527] = 3.14, [528] = 3.28, [529] = 3.15, 
    [530] = 2.63, [531] = 2.31, [532] = 7.38, [533] = 2.53, [534] = 3.40, [535] = 3.15, [536] = 3.54, [537] = 11.06, [538] = 8.26, [539] = 2.61, 
    [540] = 3.44, [541] = 2.79, [542] = 3.53, [543] = 3.24, [544] = 6.73, [545] = 2.80, [546] = 3.30, [547] = 3.28, [548] = 12.72, [549] = 3.14, 
    [550] = 3.34, [551] = 2.86, [552] = 4.02, [553] = 18.92, [554] = 3.57, [555] = 2.84, [556] = 3.85, [557] = 3.85, [558] = 2.94, [559] = 3.05, 
    [560] = 3.05, [561] = 3.28, [562] = 2.98, [563] = 9.65, [564] = 0.93, [565] = 2.72, [566] = 3.58, [567] = 3.71, [568] = 2.75, [569] = 9.41, 
    [570] = 9.41, [571] = 1.61, [572] = 1.75, [573] = 4.15, [574] = 2.43, [575] = 3.26, [576] = 3.48, [577] = 45.08, [578] = 6.35, [579] = 3.31, 
    [580] = 3.35, [581] = 1.46, [582] = 3.98, [583] = 2.52, [584] = 8.24, [585] = 3.56, [586] = 1.56, [587] = 3.24, [588] = 5.52, [589] = 2.98, 
    [590] = 9.67, [591] = 7.38, [592] = 36.34, [593] = 9.36, [594] = 0.58, [595] = 6.34, [596] = 3.30, [597] = 3.31, [598] = 3.25, [599] = 3.57, 
    [600] = 3.35, [601] = 4.56, [602] = 3.14, [603] = 3.38, [604] = 3.45, [605] = 3.24, [606] = 2.46, [607] = 2.43, [608] = 4.01, [609] = 4.17, 
    [610] = 1.59, [611] = 2.11, 
    } 
      
    addEvent('Checks',true) 
    addEventHandler('Checks',root,function(vx,vy,vz,vehID,vrot) 
        if tonumber(vx and vy and vz and vehID and vrot) then 
            local px,py,pz = getElementPosition(g_Me) 
            local width = vehicleWidth[vehID] or 3 
                    triggerServerEvent('SendAndGiveVeh',g_Me,vx,vy,vz,vehID,vrot) 
            end 
        end 
    ) 

  -- Server Side ~ ! 
function giveMeVehicles(vehicles) 
        if type(vehicles) == 'number' then 
            vehicles = { vehicles } 
        end 
      
        local px, py, pz, prot 
        local radius = 3 
        local playerVehicle = getPedOccupiedVehicle(source) 
        if playerVehicle and isElement(playerVehicle) then 
            px, py, pz = getElementPosition(playerVehicle) 
            prot, prot, prot = getVehicleRotation(playerVehicle) 
        else 
            px, py, pz = getElementPosition(source) 
            prot = getPedRotation(source) 
        end 
        local offsetRot = math.rad(prot) 
        local vx = px + radius * math.cos(offsetRot) 
        local vy = py + radius * math.sin(offsetRot) 
        local vz = pz + 2 
        local vrot = prot 
      
        vehicleList = g_PlayerData[source].vehicles 
        local vehicle 
        if ( not vehicles ) then return end 
        for i,vehID in ipairs(vehicles) do 
            if vehID < 400 or vehID > 611 then 
                errMsg(vehID ..' is incorrect vehicle model', source) 
            elseif not table.find(getOption('vehicles.disallowed'), vehID) then 
                if #vehicleList >= getOption('vehicles.maxperplayer') then 
                    unloadVehicle(vehicleList[1]) 
                end 
                triggerClientEvent('Checks',source,vx,vy,vz,vehID,vrot) 
            end 
        end 
    end 
  
  
    addEvent('SendAndGiveVeh',true) 
    addEventHandler('SendAndGiveVeh',root, 
    function(vx,vy,vz,vehID,vrot) 
      if isElement ( vehicle   ) then destroyElement ( vehicle  ) end 
        vehicle  = createVehicle(vehID, vx, vy, vz, 0, 0, vrot) 
            if (not isElement(vehicle)) then return end 
                setElementInterior(vehicle, getElementInterior(source)) 
                setElementDimension(vehicle, getElementDimension(source)) 
                table.insert(vehicleList, vehicle) 
                g_VehicleData[vehicle] = { creator = source, timers = {} } 
                if vehID == 464 then 
                    warpPedIntoVehicle(source,vehicle) 
                elseif not g_Trailers[vehID] then 
                    if getOption('vehicles.idleexplode') then 
                        g_VehicleData[vehicle].timers.fire = setTimer(commitArsonOnVehicle, getOption('vehicles.maxidletime'), 1, vehicle [ source ]) 
                    end 
                    g_VehicleData[vehicle].timers.destroy = setTimer(unloadVehicle, getOption('vehicles.maxidletime') + (getOption('vehicles.idleexplode') and 10000 or 0), 1, vehicle) 
                end 
                vx = vx + 4 
                vz = vz + 4 
        end 
    ) 

Edited by Guest
Link to comment
جرب ,
    -- Client Side ~ ! 
local vehicleWidth = { 
    [400] = 3.03, [401] = 3.30, [402] = 2.90, [403] = 5.30, [404] = 3.21, [405] = 3.37, [406] = 6.60, [407] = 4.89, [408] = 5.90, [409] = 4.36, 
    [410] = 2.89, [411] = 2.69, [412] = 3.97, [413] = 3.34, [414] = 3.99, [415] = 3.04, [416] = 4.42, [417] = 16.01, [418] = 3.32, [419] = 3.45, 
    [420] = 3.30, [421] = 3.53, [422] = 3.11, [423] = 3.60, [424] = 2.44, [425] = 9.84, [426] = 3.29, [427] = 4.48, [428] = 3.73, [429] = 2.91, 
    [430] = 6.59, [431] = 6.66, [432] = 7.17, [433] = 5.51, [434] = 2.69, [435] = 7.33, [436] = 3.11, [437] = 6.40, [438] = 3.37, [439] = 3.04, 
    [440] = 3.29, [441] = 2.00, [442] = 3.71, [443] = 10.38, [444] = 3.85, [445] = 3.30, [446] = 6.73, [447] = 7.58, [448] = 1.33, [449] = 5.29, 
    [450] = 7.17, [451] = 3.06, [452] = 5.92, [453] = 6.02, [454] = 9.70, [455] = 5.35, [456] = 5.18, [457] = 2.10, [458] = 3.44, [459] = 3.27, 
    [460] = 8.94, [461] = 1.44, [462] = 1.33, [463] = 1.40, [464] = 1.25, [465] = 0.94, [466] = 3.45, [467] = 3.53, [468] = 1.39, [469] = 7.58, 
    [470] = 3.24, [471] = 1.49, [472] = 4.58, [473] = 2.61, [474] = 3.37, [475] = 3.26, [476] = 8.19, [477] = 3.36, [478] = 3.23, [479] = 3.39, 
    [480] = 2.83, [481] = 1.17, [482] = 3.33, [483] = 3.44, [484] = 9.92, [485] = 2.37, [486] = 4.67, [487] = 7.71, [488] = 6.53, [489] = 3.38, 
    [490] = 3.93, [491] = 3.00, [492] = 2.84, [493] = 6.79, [494] = 3.57, [495] = 3.22, [496] = 2.65, [497] = 7.71, [498] = 4.19, [499] = 3.99, 
    [500] = 2.90, [501] = 0.94, [502] = 3.35, [503] = 3.40, [504] = 3.39, [505] = 3.38, [506] = 2.94, [507] = 3.60, [508] = 4.62, [509] = 1.21, 
    [510] = 1.13, [511] = 15.03, [512] = 6.58, [513] = 6.51, [514] = 5.55, [515] = 5.68, [516] = 3.49, [517] = 3.51, [518] = 3.33, [519] = 13.87, 
    [520] = 8.61, [521] = 1.44, [522] = 1.44, [523] = 1.44, [524] = 5.08, [525] = 3.94, [526] = 2.98, [527] = 3.14, [528] = 3.28, [529] = 3.15, 
    [530] = 2.63, [531] = 2.31, [532] = 7.38, [533] = 2.53, [534] = 3.40, [535] = 3.15, [536] = 3.54, [537] = 11.06, [538] = 8.26, [539] = 2.61, 
    [540] = 3.44, [541] = 2.79, [542] = 3.53, [543] = 3.24, [544] = 6.73, [545] = 2.80, [546] = 3.30, [547] = 3.28, [548] = 12.72, [549] = 3.14, 
    [550] = 3.34, [551] = 2.86, [552] = 4.02, [553] = 18.92, [554] = 3.57, [555] = 2.84, [556] = 3.85, [557] = 3.85, [558] = 2.94, [559] = 3.05, 
    [560] = 3.05, [561] = 3.28, [562] = 2.98, [563] = 9.65, [564] = 0.93, [565] = 2.72, [566] = 3.58, [567] = 3.71, [568] = 2.75, [569] = 9.41, 
    [570] = 9.41, [571] = 1.61, [572] = 1.75, [573] = 4.15, [574] = 2.43, [575] = 3.26, [576] = 3.48, [577] = 45.08, [578] = 6.35, [579] = 3.31, 
    [580] = 3.35, [581] = 1.46, [582] = 3.98, [583] = 2.52, [584] = 8.24, [585] = 3.56, [586] = 1.56, [587] = 3.24, [588] = 5.52, [589] = 2.98, 
    [590] = 9.67, [591] = 7.38, [592] = 36.34, [593] = 9.36, [594] = 0.58, [595] = 6.34, [596] = 3.30, [597] = 3.31, [598] = 3.25, [599] = 3.57, 
    [600] = 3.35, [601] = 4.56, [602] = 3.14, [603] = 3.38, [604] = 3.45, [605] = 3.24, [606] = 2.46, [607] = 2.43, [608] = 4.01, [609] = 4.17, 
    [610] = 1.59, [611] = 2.11, 
    } 
      
    addEvent('Checks',true) 
    addEventHandler('Checks',root,function(vx,vy,vz,vehID,vrot) 
        if tonumber(vx and vy and vz and vehID and vrot) then 
            local px,py,pz = getElementPosition(g_Me) 
            local width = vehicleWidth[vehID] or 3 
                    triggerServerEvent('SendAndGiveVeh',g_Me,vx,vy,vz,vehID,vrot) 
            end 
        end 
    ) 

  -- Server Side ~ ! 
function giveMeVehicles(vehicles) 
        if type(vehicles) == 'number' then 
            vehicles = { vehicles } 
        end 
      
        local px, py, pz, prot 
        local radius = 3 
        local playerVehicle = getPedOccupiedVehicle(source) 
        if playerVehicle and isElement(playerVehicle) then 
            px, py, pz = getElementPosition(playerVehicle) 
            prot, prot, prot = getVehicleRotation(playerVehicle) 
        else 
            px, py, pz = getElementPosition(source) 
            prot = getPedRotation(source) 
        end 
        local offsetRot = math.rad(prot) 
        local vx = px + radius * math.cos(offsetRot) 
        local vy = py + radius * math.sin(offsetRot) 
        local vz = pz + 2 
        local vrot = prot 
      
        vehicleList = g_PlayerData[source].vehicles 
        local vehicle 
        if ( not vehicles ) then return end 
        for i,vehID in ipairs(vehicles) do 
            if vehID < 400 or vehID > 611 then 
                errMsg(vehID ..' is incorrect vehicle model', source) 
            elseif not table.find(getOption('vehicles.disallowed'), vehID) then 
                if #vehicleList >= getOption('vehicles.maxperplayer') then 
                    unloadVehicle(vehicleList[1]) 
                end 
                triggerClientEvent('Checks',source,vx,vy,vz,vehID,vrot) 
            end 
        end 
    end 
  
vehicle = {  }; 
  
    addEvent('SendAndGiveVeh',true) 
    addEventHandler('SendAndGiveVeh',root, 
    function(vx,vy,vz,vehID,vrot) 
      if isElement ( vehicle [ source ]  ) then destroyElement ( vehicle [ source ] ) end 
        vehicle [ source ]  = createVehicle(vehID, vx, vy, vz, 0, 0, vrot) 
            if (not isElement(vehicle [ source ])) then return end 
                setElementInterior(vehicle [ source ], getElementInterior(source)) 
                setElementDimension(vehicle [ source ], getElementDimension(source)) 
                table.insert(vehicleList, vehicle [ source ]) 
                g_VehicleData[vehicle [ source ]] = { creator = source, timers = {} } 
                if vehID == 464 then 
                    warpPedIntoVehicle(source, vehicle [ source ]) 
                elseif not g_Trailers[vehID] then 
                    if getOption('vehicles.idleexplode') then 
                        g_VehicleData[vehicle [ source ]].timers.fire = setTimer(commitArsonOnVehicle, getOption('vehicles.maxidletime'), 1, vehicle [ source ]) 
                    end 
                    g_VehicleData[vehicle [ source ]].timers.destroy = setTimer(unloadVehicle, getOption('vehicles.maxidletime') + (getOption('vehicles.idleexplode') and 10000 or 0), 1, vehicle) 
                end 
                vx = vx + 4 
                vz = vz + 4 
        end 
    ) 

ماا اشتغل :shock::shock::shock:

Link to comment
اممم , لما فتحت الفري روم لقيت أن مافيه هالإيفنت , على العموم جرب انسخ الكود مرة ثانية ><

ماتلاقي لانه هاذ مايكون بل اصل لانه هاذ يسد ثغره فقط

Link to comment

هذا هو الاصلي

clientside:

function createSelectedVehicle(leaf) 
    if not leaf then 
        leaf = getSelectedGridListLeaf(wndCreateVehicle, 'vehicles') 
        if not leaf then 
            return 
        end 
    end 
    server.giveMeVehicles(leaf.id) 
end 
  
wndCreateVehicle = { 
    'wnd', 
    text = 'Create vehicle', 
    width = 300, 
    controls = { 
        { 
            'lst', 
            id='vehicles', 
            width=280, 
            height=340, 
            columns={ 
                {text='Vehicle', attr='name'} 
            }, 
            rows={xml='vehicles.xml', attrs={'id', 'name'}}, 
            onitemdoubleclick=createSelectedVehicle 
        }, 
        {'btn', id='create', onclick=createSelectedVehicle}, 
        {'btn', id='close', closeswindow=true} 
    } 
} 
  
function createVehicleCommand(cmd, ...) 
    local vehID 
    local vehiclesToCreate = {} 
    local args = { ... } 
    for i,v in ipairs(args) do 
        vehID = tonumber(v) 
        if not vehID then 
            vehID = getVehicleModelFromName(v) 
        end 
        if vehID then 
            table.insert(vehiclesToCreate, math.floor(vehID)) 
        end 
    end 
    server.giveMeVehicles(vehiclesToCreate) 
end 
addCommandHandler('createvehicle', createVehicleCommand) 
addCommandHandler('cv', createVehicleCommand) 
  

serverside:

function giveMeVehicles(vehicles) 
    if type(vehicles) == 'number' then 
        vehicles = { vehicles } 
    end 
  
    local px, py, pz, prot 
    local radius = 3 
    local playerVehicle = getPedOccupiedVehicle(source) 
    if playerVehicle and isElement(playerVehicle) then 
        px, py, pz = getElementPosition(playerVehicle) 
        prot, prot, prot = getVehicleRotation(playerVehicle) 
    else 
        px, py, pz = getElementPosition(source) 
        prot = getPedRotation(source) 
    end 
    local offsetRot = math.rad(prot) 
    local vx = px + radius * math.cos(offsetRot) 
    local vy = py + radius * math.sin(offsetRot) 
    local vz = pz + 2 
    local vrot = prot 
  
    local vehicleList = g_PlayerData[source].vehicles 
    local vehicle 
    if ( not vehicles ) then return end 
    for i,vehID in ipairs(vehicles) do 
        if vehID < 400 or vehID > 611 then 
            errMsg(vehID ..' is incorrect vehicle model', source) 
        elseif not table.find(getOption('vehicles.disallowed'), vehID) then 
            if #vehicleList >= getOption('vehicles.maxperplayer') then 
                unloadVehicle(vehicleList[1]) 
            end 
            vehicle = createVehicle(vehID, vx, vy, vz, 0, 0, vrot) 
            if (not isElement(vehicle)) then return end 
            setElementInterior(vehicle, getElementInterior(source)) 
            setElementDimension(vehicle, getElementDimension(source)) 
            table.insert(vehicleList, vehicle) 
            g_VehicleData[vehicle] = { creator = source, timers = {} } 
            if vehID == 464 then 
                warpPedIntoVehicle(source, vehicle) 
            elseif not g_Trailers[vehID] then 
                if getOption('vehicles.idleexplode') then 
                    g_VehicleData[vehicle].timers.fire = setTimer(commitArsonOnVehicle, getOption('vehicles.maxidletime'), 1, vehicle) 
                end 
                g_VehicleData[vehicle].timers.destroy = setTimer(unloadVehicle, getOption('vehicles.maxidletime') + (getOption('vehicles.idleexplode') and 10000 or 0), 1, vehicle) 
            end 
            vx = vx + 4 
            vz = vz + 4 
        else 
            errMsg(getVehicleNameFromModel(vehID):gsub('y$', 'ie') .. 's are not allowed', source) 
        end 
    end 
end 

Link to comment

ممكن من التريقر , جرب,

-- Client Side # 
CONTROL_MARGIN_RIGHT = 5
LINE_MARGIN = 5
LINE_HEIGHT = 16
 
g_Root = getRootElement()
g_ResRoot = getResourceRootElement(getThisResource())
g_Me = getLocalPlayer()
server = createServerCallInterface()
guiSetInputMode("no_binds_when_editing")
 
---------------------------
-- Set skin window
---------------------------
function skinInit()
    setControlNumber(wndSkin, 'skinid', getElementModel(g_Me))
end
 
function showSkinID(leaf)
    if leaf.id then
        setControlNumber(wndSkin, 'skinid', leaf.id)
    end
end
 
function applySkin()
    local skinID = getControlNumber(wndSkin, 'skinid')
    if skinID then
        server.setMySkin(skinID)
        fadeCamera(true)
    end
end
 
wndSkin = {
    'wnd',
    text = 'Set skin',
    width = 250,
    x = -20,
    y = 0.3,
    controls = {
        {
            'lst',
            id='skinlist',
            width=230,
            height=290,
            columns={
                {text='Skin', attr='name'}
            },
            rows={xml='skins.xml', attrs={'id', 'name'}},
            onitemclick=showSkinID,
            onitemdoubleclick=applySkin
        },
        {'txt', id='skinid', text='', width=50},
        {'btn', id='set', onclick=applySkin},
        {'btn', id='close', closeswindow=true}
    },
    oncreate = skinInit
}
 
function setSkinCommand(cmd, skin)
    skin = skin and tonumber(skin)
    if skin then
        server.setMySkin(skin)
        fadeCamera(true)
        closeWindow(wndSpawnMap)
        closeWindow(wndSetPos)
    end
end
addCommandHandler('setskin', setSkinCommand)
addCommandHandler('ss', setSkinCommand)
 
---------------------------
--- Set animation window
---------------------------
 
function applyAnimation(leaf)
    if type(leaf) ~= 'table' then
        leaf = getSelectedGridListLeaf(wndAnim, 'animlist')
        if not leaf then
            return
        end
    end
    server.setPedAnimation(g_Me, leaf.parent.name, leaf.name, true, true)
end
 
function stopAnimation()
    server.setPedAnimation(g_Me, false)
end
 
wndAnim = {
    'wnd',
    text = 'Set animation',
    width = 250,
    x = -20,
    y = 0.3,
    controls = {
        {
            'lst',
            id='animlist',
            width=230,
            height=290,
            columns={
                {text='Animation', attr='name'}
            },
            rows={xml='animations.xml', attrs={'name'}},
            expandlastlevel=false,
            onitemdoubleclick=applyAnimation
        },
        {'btn', id='set', onclick=applyAnimation},
        {'btn', id='stop', onclick=stopAnimation},
        {'btn', id='close', closeswindow=true}
    }
}
 
addCommandHandler('anim',
    function(command, lib, name)
        server.setPedAnimation(g_Me, lib, name, true, true)
    end
)
 
---------------------------
-- Weapon window
---------------------------
 
function addWeapon(leaf, amount)
    if type(leaf) ~= 'table' then
        leaf = getSelectedGridListLeaf(wndWeapon, 'weaplist')
        amount = getControlNumber(wndWeapon, 'amount')
        if not amount or not leaf then
            return
        end
    end
    server.giveMeWeapon(leaf.id, amount)
end
 
wndWeapon = {
    'wnd',
    text = 'Give weapon',
    width = 250,
    controls = {
        {
            'lst',
            id='weaplist',
            width=230,
            height=280,
            columns={
                {text='Weapon', attr='name'}
            },
            rows={xml='weapons.xml', attrs={'id', 'name'}},
            onitemdoubleclick=function(leaf) addWeapon(leaf, 500) end
        },
        {'br'},
        {'txt', id='amount', text='500', width=60},
        {'btn', id='add', onclick=addWeapon},
        {'btn', id='close', closeswindow=true}
    }
}
 
function giveWeaponCommand(cmd, weapon, amount)
    weapon = tonumber(weapon) or getWeaponIDFromName(weapon)
    if not weapon then
        return
    end
    amount = amount and tonumber(amount) or 500
    server.giveMeWeapon(math.floor(weapon), amount)
end
addCommandHandler('give', giveWeaponCommand)
addCommandHandler('wp', giveWeaponCommand)
 
---------------------------
-- Fighting style
---------------------------
 
addCommandHandler('setstyle',
    function(cmd, style)
        style = style and tonumber(style)
        if style then
            server.setPedFightingStyle(g_Me, style)
        end
    end
)
 
---------------------------
-- Clothes window
---------------------------
function clothesInit()
    if getElementModel(g_Me) ~= 0 then
        errMsg('You must have the CJ skin set in order to apply clothes.')
        closeWindow(wndClothes)
        return
    end
    if not g_Clothes then
        triggerServerEvent('onClothesInit', g_Me)
    end
end
 
addEvent('onClientClothesInit', true)
addEventHandler('onClientClothesInit', g_Root,
    function(clothes)
        g_Clothes = clothes.allClothes
        for i,typeGroup in ipairs(g_Clothes) do
            for j,cloth in ipairs(typeGroup.children) do
                if not cloth.name then
                    cloth.name = cloth.model .. ' - ' .. cloth.texture
                end
                cloth.wearing =
                    clothes.playerClothes[typeGroup.type] and
                    clothes.playerClothes[typeGroup.type].texture == cloth.texture and
                    clothes.playerClothes[typeGroup.type].model == cloth.model
                    or false
            end
            table.sort(typeGroup.children, function(a, b) return a.name < b.name end)
        end
        bindGridListToTable(wndClothes, 'clothes', g_Clothes, false)
    end
)
 
function clothListClick(cloth)
    setControlText(wndClothes, 'addremove', cloth.wearing and 'remove' or 'add')
end
 
function applyClothes(cloth)
    if not cloth then
        cloth = getSelectedGridListLeaf(wndClothes, 'clothes')
        if not cloth then
            return
        end
    end
    if cloth.wearing then
        cloth.wearing = false
        setControlText(wndClothes, 'addremove', 'add')
        server.removePlayerClothes(g_Me, cloth.parent.type)
    else
        local prevClothIndex = table.find(cloth.siblings, 'wearing', true)
        if prevClothIndex then
            cloth.siblings[prevClothIndex].wearing = false
        end
        cloth.wearing = true
        setControlText(wndClothes, 'addremove', 'remove')
        server.addPedClothes(g_Me, cloth.texture, cloth.model, cloth.parent.type)
    end
end
 
wndClothes = {
    'wnd',
    text = 'Clothes',
    x = -20,
    y = 0.3,
    width = 350,
    controls = {
        {
            'lst',
            id=
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...