Jump to content

طلب كود بسيط


XboxMS

Recommended Posts

السلام عليكم

ابي كود لحدف سيارة لو خرج اللاعب من السيرفر انا سويت بداية وفيها ماركر اخد سيارة

:oops: كل شي تمام بس لما يخرج اللاعب من السيرفر السيارة ماتنحدف لو ممكن تساعدوني شباب

marker = createMarker(1133.0999755859 ,-1599.5999755859, 12,"cylinder",3,25,151,178,255) 
marker2 = createMarker(1133.0999755859 ,-1609.8000488281, 12,"cylinder",3,25,151,178,255) 
local vehicles = {480,411,506,522,419,559,560,550,565,562} 
local vehicleT = {}  
  
local spawns = {   
  {1268.93140,-1795.98230, 13}, 
  {1276.86926 ,-1796.88538, 13}, 
} 
  
function onMarkerHit(player) 
    if ( getElementType(player) == "player" ) then 
        if not( isPedInVehicle(player) ) then 
            if ( isElement(cars) ) then 
            destroyElement(cars) 
 end 
            local model = vehicles[math.random(#vehicles)] 
            local x,y,z = getElementPosition(source) 
            local rnd = math.random( 1, #spawns )    
            local cars = createVehicle(model,spawns[rnd][1], spawns[rnd][2],13) 
            setElementRotation(cars,0,0,180) 
           
addVehicleUpgrade (  cars, 1010 ) 
    addVehicleUpgrade ( cars, 1080 ) 
   addVehicleUpgrade (  cars, 1034 ) 
   addVehicleUpgrade (  cars, 1171 ) 
   addVehicleUpgrade ( cars, 1087 ) 
   addVehicleUpgrade ( cars, 1010 ) 
   addVehicleUpgrade (  cars, 1149 ) 
  addVehicleUpgrade (  cars, 1038 ) 
  addVehicleUpgrade (  cars, 1041 ) 
  addVehicleUpgrade ( cars, 1147 ) 
setVehiclePaintjob(cars,0) 
            warpPedIntoVehicle ( player,cars ) 
setVehicleColor(cars, 200, 60, 40 ) 
        end 
    end 
end 
  
addEventHandler("onVehicleExplode",root,  
    function()  
        setTimer(destroyElement,2500,1,source)   
    end 
) 
  
  
addEventHandler("onMarkerHit",marker,onMarkerHit) 
addEventHandler("onMarkerHit",marker2,onMarkerHit) 
 addEventHandler("onVehicleExplode",cars,onVehicleExplode ) 
  
  
Link to comment

جربه

marker = createMarker(1133.0999755859 ,-1599.5999755859, 12,"cylinder",3,25,151,178,255) 
marker2 = createMarker(1133.0999755859 ,-1609.8000488281, 12,"cylinder",3,25,151,178,255) 
local vehicles = {480,411,506,522,419,559,560,550,565,562} 
local vehicleT = {} 
  
local spawns = {   
  {1268.93140,-1795.98230, 13}, 
  {1276.86926 ,-1796.88538, 13}, 
} 
  
function onMarkerHit(player) 
    if ( getElementType(player) == "player" ) then 
        if not( isPedInVehicle(player) ) then 
            if ( isElement(cars) ) then 
            destroyElement(cars) 
 end 
            local model = vehicles[math.random(#vehicles)] 
            local x,y,z = getElementPosition(source) 
            local rnd = math.random( 1, #spawns )   
            local cars = createVehicle(model,spawns[rnd][1], spawns[rnd][2],13) 
            setElementRotation(cars,0,0,180) 
          
addVehicleUpgrade (  cars, 1010 ) 
    addVehicleUpgrade ( cars, 1080 ) 
   addVehicleUpgrade (  cars, 1034 ) 
   addVehicleUpgrade (  cars, 1171 ) 
   addVehicleUpgrade ( cars, 1087 ) 
   addVehicleUpgrade ( cars, 1010 ) 
   addVehicleUpgrade (  cars, 1149 ) 
  addVehicleUpgrade (  cars, 1038 ) 
  addVehicleUpgrade (  cars, 1041 ) 
  addVehicleUpgrade ( cars, 1147 ) 
setVehiclePaintjob(cars,0) 
            warpPedIntoVehicle ( player,cars ) 
setVehicleColor(cars, 200, 60, 40 ) 
        end 
    end 
end 
  
addEventHandler("onVehicleExplode",root, 
    function() 
        setTimer(destroyElement,2500,1,source)   
    end 
) 
  
  
addEventHandler("onMarkerHit",marker,onMarkerHit) 
addEventHandler("onMarkerHit",marker2,onMarkerHit) 
 addEventHandler("onVehicleExplode",cars,onVehicleExplode ) 
  
addEventHandler('onPlayerQuit', root, 
function() 
    if isElement( cars) then 
        destroyElement( cars ) 
    end 
end 
) 

Link to comment

المشكلة ان كل الكود خطا

المهم صصحت الكود واختصرته لكـ :

marker = createMarker(1133.0999755859 ,-1599.5999755859, 12,"cylinder",3,25,151,178,255) 
marker2 = createMarker(1133.0999755859 ,-1609.8000488281, 12,"cylinder",3,25,151,178,255) 
local vehicles = {480,411,506,522,419,559,560,550,565,562} 
local vehicleT = {} 
local vehicle = { }; 
local spawns = {   
  {1268.93140,-1795.98230, 13}, 
  {1276.86926 ,-1796.88538, 13}, 
} 
local Upgrades = { 
  1010, 
  1080, 
  1034, 
  1171, 
  1087, 
  1149, 
  1038, 
  1147, 
} 
  
function onMarkerHit ( player ) 
   if ( getElementType(player) == "player" ) then 
    if not ( isPedInVehicle ( player ) ) then 
      if ( isElement ( vehicle [ player ] ) ) then 
            destroyElement(vehicle [ player ]) 
        end 
        local model = vehicles[math.random(#vehicles)] 
        local x,y,z = getElementPosition(source) 
        local rnd = math.random( 1, #spawns )   
        vehicle [ player ] = createVehicle(model,spawns[rnd][1], spawns[rnd][2],13) 
        if ( vehicle [ player ] ) then 
        setElementRotation ( vehicle [ player ], 0, 0, 180 ) 
        for i = 1, #Upgrades do 
           addVehicleUpgrade ( vehicle [ player ], Upgrades [ i ] ) 
        end      
         setVehiclePaintjob ( vehicle [ player ], 0 ) 
         warpPedIntoVehicle ( player, vehicle [ player ] ) 
         setVehicleColor( vehicle [ player ], 200, 60, 40 ) 
      end 
    end 
  end 
end 
addEventHandler ( "onMarkerHit", resourceRoot, onMarkerHit ) 
  
addEventHandler( "onVehicleExplode", root, function(   ) 
     setTimer ( destroyElement, 2500, 1, source )   
end ) 
  
addEventHandler( "onPlayerQuit", root, function (   ) 
   if ( vehicle [ source ] ) then 
    if ( isElement ( vehicle [ source ] ) ) then 
        destroyElement ( vehicle [ source ] ) 
    end 
    vehicle [ source ] = nil 
end )    
Link to comment
  • Other Languages Moderators
marker1 = createMarker(1133.0999755859, -1599.5999755859, 12, "cylinder", 3, 25, 151, 178, 255) 
marker2 = createMarker(1133.0999755859, -1609.8000488281, 12, "cylinder", 3, 25, 151, 178, 255) 
local vehicles = {480, 411, 506, 522, 419, 559, 560, 550, 565, 562} 
local vehicleT = {} 
  
local spawns = { 
    {1268.93140, -1795.98230, 13}, 
    {1276.86926, -1796.88538, 13} 
} 
  
addEventHandler("onMarkerHit", root, 
function(player) 
    if source == marker1 or source == marker2 then 
        if getElementType(player) == "player" and not isPedInVehicle(player) then 
            if isElement(vehicleT[player]) then 
                destroyElement(vehicleT[player]) 
                vehicleT[player] = nil 
            end 
            local model = vehicles[math.random(#vehicles)] 
            local x, y, z = unpack(spawns[math.random(#spawns)]) 
            local vehicleT[player] = createVehicle(model, x, y, z, 0, 0, 180) 
            warpPedIntoVehicle(player, vehicleT[player]) 
            addVehicleUpgrade(vehicleT[player], 1010) 
            addVehicleUpgrade(vehicleT[player], 1080) 
            addVehicleUpgrade(vehicleT[player], 1034) 
            addVehicleUpgrade(vehicleT[player], 1171) 
            addVehicleUpgrade(vehicleT[player], 1087) 
            addVehicleUpgrade(vehicleT[player], 1010) 
            addVehicleUpgrade(vehicleT[player], 1149) 
            addVehicleUpgrade(vehicleT[player], 1038) 
            addVehicleUpgrade(vehicleT[player], 1041) 
            addVehicleUpgrade(vehicleT[player], 1147) 
            setVehiclePaintjob(vehicleT[player], 0) 
            setVehicleColor(vehicleT[player], 200, 60, 40) 
        end 
    end 
end) 
  
addEventHandler("onVehicleExplode", root, 
function() 
    setTimer(destroyElement, 2500, 1, source)   
end) 
  
 addEventHandler("onPlayerQuit", root, 
function() 
    if isElement(vehicleT[source]) then 
        destroyElement(vehicleT[source]) 
        vehicleT[source] = nil 
    end 
end) 

Edited by Guest
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...