Jump to content

مشكلة


Recommended Posts

عندي مشكلة مدري ف كود اخذ السيارات للقروب و لا ايش

لما بسوي الكود و باخذ سيارة يتم و ما مشكلة بس لما اسوي مقر اخر و اسوي ذا الكود حق السيارات

لما باخذ سيارة يطلعلي سياراتين حق القروبين مدري ليش

ارجو المساعدة

الكودات لي بستعمل

-- Serve

local upgrades = {} 
upgrades[560] = {1138,1031,1033,1029,1170,1140} 
upgrades[559] = {1162,1072,1068,1066,1173,1161} 
upgrades[562] = {1147,1041,1038,1037,1172,1148} 
upgrades[575] = {1099,1044,1175,1177} 
upgrades[565] = {1050,1052,1054,1046,1153,1151} 
upgrades[561] = {1058,1063,1061,1064,1157,1156} 
upgrades[558] = {1164,1095,1091,1092,1166,1167} 
upgrades[534] = {1124,1127,1185,1180,1125} 
upgrades[567] = {1133,1132,1189,1187} 
upgrades[536] = {1108,1128,1105,1182,1184} 
upgrades[535] = {1121,1116,1114,1117} 
upgrades[576] = {1137,1136,1191,1193} 
  
upgrades[576] = {1137,1136,1191,1193,} 
MarkerCreateXX = 0 
MarkerCreateYY = 0 
  
                    MxXx1 = createMarker( 1216.07263,-1646.05334,12.63682 , "cylinder", 2, 0, 0, 255, 255 ) 
                    local x,y,z = getElementPosition ( MxXx1 ) 
                    MxXx2 = createMarker(1215.39673,-1657.78845,12.63823, "cylinder",  2, 0, 0, 255, 255 ) 
                    local x,y,z = getElementPosition ( MxXx2 ) 
                    MxXx3 = createMarker(1215.90417,-1651.54175,12.63723, "cylinder",  2, 0, 0, 255, 255 ) 
                    local x,y,z = getElementPosition ( MxXx3 ) 
  
  
  
addEventHandler("onMarkerHit", getResourceRootElement(), 
function(player) 
if ( getElementData ( player, "gang" ) == "[sWAT]" ) or ( getElementData ( player, "gang" ) == "[sWAT]" ) then 
     if source == MxXx1 or source == MxXx2 or source == MxXx3 or source == MxXx4 or source == MxXx5 or source == MxXx6 then     
setTimer( 
function(player,source) 
 local x, y, z = getElementPosition(source) 
local xx, yy, zz = getElementPosition(player) 
setElementPosition(player, xx, yy, z+0.5) 
triggerClientEvent ( player, "OpenWindowsMr", player)        
end,150,1,player,source) 
end 
     end 
end) 
  
function upgradeCar ( car ) 
    addVehicleUpgrade ( car, 1010 ) 
    addVehicleUpgrade ( car, 1098 ) 
    local model = getElementModel(car) 
    if ( upgrades[model] ) then 
        for id, v in ipairs ( upgrades[model] ) do 
            addVehicleUpgrade ( car, v ) 
        end 
    end 
end 
  
----------------------------------- 
  
cars = {} 
carsTimer = {} 
function onExplorerMr ()  
       setTimer( 
             function(car)  
                  if (isElement(car)) then 
                           destroyElement(car)  
                  end  
        end,5000, 1, source)  
end 
  
  
function onEnterCarMr(player,seat)  
                  if (seat >= 0 ) and ( getElementData ( player , "gang" ) ~= "[sWAT]" ) and ( getElementData ( player , "gang" ) ~= "[sWAT]" ) then 
                                 cancelEvent() 
                                 outputChatBox("This Car For [sWAT] Group",player, 255, 0, 0, true)   
                 end 
 end   
  
  
function xxxcrete (carName) 
local id = getVehicleModelFromName(carName) 
   if (id) then 
        if (isElement(cars[source])) then 
            destroyElement(cars[source]) 
        end 
          if ( getVehicleType ( id ) == "Helicopter" ) then 
    local place = getElementByID( "AirMr"..tostring(math.random(1,6)) ) 
    local x,y,z = getElementPosition ( place ) 
    local rx,ry,rz = getElementRotation ( place ) 
     
            cars[source] = createVehicle(id, 1280.65198,-1697.01160,39.43750, rz) 
            else 
                                local x, y, z = getElementPosition(source) 
        cars[source] = createVehicle(id, x+5, y, z, 0, 0, 270) 
                                 upgradeCar ( cars[source] ) 
         end 
                                                                                       setVehicleColor( cars[source], 0, 0,255 ) 
                                                                                       setVehiclePaintjob ( cars[source], 2 )  
                                                                                       warpPedIntoVehicle(source, cars[source])      
                                                                                       addEventHandler("onVehicleExplode", cars[source], onExplorerMr ) 
                                                                                       addEventHandler ("onVehicleStartEnter", cars[source], onEnterCarMr ) 
   end 
  
end 
addEvent("CreateCarMr", true) 
addEventHandler("CreateCarMr", root, xxxcrete ) 
  
  
function isVehicleEmpty(veh) 
     local cc = false 
     local occupants = getVehicleOccupants(veh) 
     local seats = getVehicleMaxPassengers(veh) 
     for seat = 0, seats do 
          if occupants[seat] then cc = true end 
     end 
     return  
end 
  
addEventHandler ( "onMarkerHit", w8h, openMyGate6) 
  

*

-- Client

GUIEditor_Grid = {} 
GUIEditor_Button = {} 
  
Vehicle = guiCreateWindow(453,218,302,379,"gang - [sWAT]",false) 
guiSetVisible(Vehicle,false) 
guiSetAlpha (Vehicle, 1) 
GUIEditor_Button[5] = guiCreateButton (0.0795,0.8575,0.4007,0.1135,"x[ oK ]x",true,Vehicle) 
GUIEditor_Button[4] = guiCreateButton (0.5166,0.8602,0.4007,0.1135,"x[ close ]x",true,Vehicle) 
GUIEditor_Grid[1] = guiCreateGridList(0.106,0.1214,0.7583,0.6887,true,Vehicle) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
local col = guiGridListAddColumn(GUIEditor_Grid[1],"Vehicle  ",0.9) 
guiSetAlpha(GUIEditor_Grid[1],0.89999997615814) 
  
      
CarsTable = { 
    { "Bullet" }, 
    { "Infernus" }, 
    { "Flash" }, 
    { "Sultan" }, 
    { "Police Maverick" }, 
    { "NRG-500" }, 
    { "Banshee" }, 
    { "Elegy" }, 
    { "Cheetah" }, 
    { "Turismo" }, 
  
} 
        
for i, v in ipairs ( CarsTable ) do 
    local row = guiGridListAddRow ( GUIEditor_Grid[1] ) 
    guiGridListSetItemText ( GUIEditor_Grid[1], row, 1, v[1], false, true ) 
end 
  
function onWaste() 
     guiSetVisible(Vehicle, false) 
     showCursor(false) 
end 
addEventHandler("onClientPlayerWasted", getLocalPlayer(), onWaste) 
  
function OpenWindowsCar () 
     guiSetVisible(Vehicle, true) 
     showCursor(true) 
end 
addEvent("OpenWindowsMr", true) 
addEventHandler("OpenWindowsMr", getLocalPlayer(), OpenWindowsCar ) 
  
  
function createTheChoosenCar () 
     local row = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
     if row and row >= 0 then 
          guiSetVisible(Vehicle, false) 
          showCursor(false) 
          triggerServerEvent("CreateCarMr", localPlayer, guiGridListGetItemText(GUIEditor_Grid[1], row, col)) 
     end 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[5], createTheChoosenCar , false) 
  
  
  
  
addEventHandler("onClientGUIClick",GUIEditor_Button[4], 
function () 
            guiSetVisible(Vehicle,false) 
            showCursor(false) 
end,false) 
  
  
addEvent("NssoR",true) 
addEventHandler("NssoR",root, 
function() 
setPedCanBeKnockedOffBike ( getLocalPlayer(), false ) 
end) 
  
addEvent("d5wl",true) 
addEventHandler("d5wl",root, 
function() 
setPedCanBeKnockedOffBike ( getLocalPlayer(), true ) 
end) 
  
addEvent("Tool",true) 
addEventHandler("Tool",root, 
function() 
setPedCanBeKnockedOffBike ( getLocalPlayer(), false ) 
end) 
  
  
  
  
addEvent("oooo",true) 
addEventHandler("oooo",root, 
function() 
setPedCanBeKnockedOffBike ( getLocalPlayer(), true ) 
end) 

Link to comment

ادري , بس هم يحبو يستهبلون , وانا شفت التريقرات تمام عندك ,

بس حبيت اشرح لك ايش هو trigger ,

مشكلتك , في 2 امر صنع سيارة ,

  cars[source] = createVehicle(id, 1280.65198,-1697.01160,39.43750, rz) 
            else 
                                local x, y, z = getElementPosition(source) 
        cars[source] = createVehicle(id, x+5, y, z, 0, 0, 270) 

ليش مسوي 2 ؟

+

if source == 1 or source == 2 or source == 3

ليه مطول ام السالفة ؟

مسوي تيبل ومتحقق منها , ومريح راسك , كودك فيه اخطاْء كثير , وعن نفسي يبي لي فترة امخمخ عليه ,

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