Micro Posted October 15, 2013 Share Posted October 15, 2013 سلام عليكم وظيفة الكود تجميد سيارة عند عدم الاستخدام وفك تجميد عند الاستخدام فقمت بكتابة الكود players = getElementsByType ( "player" ) veh = getElementsByType( "vehicle" ) local function freeze (player) for thePlayer,theVehicle in ipairs(veh) do for pla,player in ipairs( players) do playername = getPlayerName(player) if(isPlayerInVehicle(player)) then playerVehicle = getPlayerOccupiedVehicle (player) setVehicleFrozen(playerVehicle,false) else playername = getPlayerName(player) numseats = getVehicleMaxPassengers (theVehicle) setVehicleFrozen(theVehicle,true) end end end end setTimer(freeze,100,-1) فهي شغالة 100 % عندما يكون لاعب واحد بسيرفر ادا اصبح سيرفر اكتر من واحد يصبح بها مشاكل Link to comment
TAPL Posted October 15, 2013 Share Posted October 15, 2013 قصدك تبي السيارة تتجمد لما ما يكون احد راكب فيها؟ Link to comment
Micro Posted October 15, 2013 Author Share Posted October 15, 2013 نعم ولعكس صحيح ادا احد استخدم سيارة بتفك تجميد انا عملت هدة الكود وشغال لمة يكون واحد بس بسيرفر ولمة يكون اكتر من واحد يخرب Link to comment
TAPL Posted October 15, 2013 Share Posted October 15, 2013 جرب function freeze() for i, vehicle in ipairs (getElementsByType("vehicle")) do if isVehicleEmpty(vehicle) then setElementFrozen(vehicle, true) else setElementFrozen(vehicle, false) end end end setTimer(freeze, 500, 0) function isVehicleEmpty( vehicle ) if not isElement( vehicle ) or getElementType( vehicle ) ~= "vehicle" then return true end local passengers = getVehicleMaxPassengers( vehicle ) if type( passengers ) == 'number' then for seat = 0, passengers do if getVehicleOccupant( vehicle, seat ) then return false end end end return true end Link to comment
Micro Posted October 15, 2013 Author Share Posted October 15, 2013 للاسف يا الغالي فيها مشاكل Link to comment
Micro Posted October 15, 2013 Author Share Posted October 15, 2013 يسلمو هل ادين تابل شغال 100% Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now