kardeşim bu mtada bile zor yapılır neyin kafasındasınız siz?
Bir çok aynı ismini vermek istemediğim altyapıya sahip MTA sunucusunda bu sistem var, amacı oyundan düştüğünüzde birisinin gelip aracınızı alıp gitmesini önlemek. SA:MP desteklemeyebilir. Kanıt istiyorsanız araç sisteminde bulunan aşağıdaki fonksiyonu bırakıyorum, az buz ingilizcesi olan biri bile anlayabilir ^^
function quitPlayer ( quitReason )
if (quitReason == "Timed out") then -- if timed out
if (isPedInVehicle(source)) then -- if in vehicle
local vehicleSeat = getPedOccupiedVehicleSeat(source)
if (vehicleSeat == 0) then -- is in driver seat?
local theVehicle = getPedOccupiedVehicle(source)
local dbid = tonumber(getElementData(theVehicle, "dbid"))
--------------------------------------------
-- Bu kısım başka bir şeyle ilgili
--Take the player's key / Crash fix -> Done by Anthony
if exports.global:hasItem(theVehicle, 3, dbid) then
exports.global:takeItem(theVehicle, 3, dbid)
exports.global:giveItem(source, 3, dbid)
end
--------------------------------------------
-- Aşağıdan devam ediyor
local passenger1 = getVehicleOccupant( theVehicle , 1 )
local passenger2 = getVehicleOccupant( theVehicle , 2 )
local passenger3 = getVehicleOccupant( theVehicle , 3 )
if not (passenger1) and not (passenger2) and not (passenger3) then
local vehicleFaction = tonumber(getElementData(theVehicle, "faction"))
local playerFaction = tonumber(getElementData(source, "faction"))
if exports.global:hasItem(source, 3, dbid) or ((playerFaction == vehicleFaction) and (vehicleFaction ~= -1)) then
if not isVehicleLocked(theVehicle) then -- check if the vehicle aint locked already
lockUnlockOutside(theVehicle)
exports.logs:dbLog(thePlayer, 31, { theVehicle }, "LOCK FROM CRASH")
end
local engine = getElementData(theVehicle, "engine")
if engine == 1 then -- stop the engine when its running
setVehicleEngineState(theVehicle, false)
exports.anticheat:changeProtectedElementDataEx(theVehicle, "engine", 0, false)
end
end
exports.anticheat:changeProtectedElementDataEx(theVehicle, "handbrake", 1, false)
setElementVelocity(theVehicle, 0, 0, 0)
setElementFrozen(theVehicle, true)
end
end
end
end
end
addEventHandler("onPlayerQuit",getRootElement(), quitPlayer)
Bu arada yapılabiliyorsa, destekliyorum.
kardeşim bu mtada bile zor yapılır neyin kafasındasınız siz?
Bir çok aynı ismini vermek istemediğim altyapıya sahip MTA sunucusunda bu sistem var, amacı oyundan düştüğünüzde birisinin gelip aracınızı alıp gitmesini önlemek. SA:MP desteklemeyebilir. Kanıt istiyorsanız araç sisteminde bulunan aşağıdaki fonksiyonu bırakıyorum, az buz ingilizcesi olan biri bile anlayabilir ^^
function quitPlayer ( quitReason )
if (quitReason == "Timed out") then -- if timed out
if (isPedInVehicle(source)) then -- if in vehicle
local vehicleSeat = getPedOccupiedVehicleSeat(source)
if (vehicleSeat == 0) then -- is in driver seat?
local theVehicle = getPedOccupiedVehicle(source)
local dbid = tonumber(getElementData(theVehicle, "dbid"))
--------------------------------------------
-- Bu kısım başka bir şeyle ilgili
--Take the player's key / Crash fix -> Done by Anthony
if exports.global:hasItem(theVehicle, 3, dbid) then
exports.global:takeItem(theVehicle, 3, dbid)
exports.global:giveItem(source, 3, dbid)
end
--------------------------------------------
-- Aşağıdan devam ediyor
local passenger1 = getVehicleOccupant( theVehicle , 1 )
local passenger2 = getVehicleOccupant( theVehicle , 2 )
local passenger3 = getVehicleOccupant( theVehicle , 3 )
if not (passenger1) and not (passenger2) and not (passenger3) then
local vehicleFaction = tonumber(getElementData(theVehicle, "faction"))
local playerFaction = tonumber(getElementData(source, "faction"))
if exports.global:hasItem(source, 3, dbid) or ((playerFaction == vehicleFaction) and (vehicleFaction ~= -1)) then
if not isVehicleLocked(theVehicle) then -- check if the vehicle aint locked already
lockUnlockOutside(theVehicle)
exports.logs:dbLog(thePlayer, 31, { theVehicle }, "LOCK FROM CRASH")
end
local engine = getElementData(theVehicle, "engine")
if engine == 1 then -- stop the engine when its running
setVehicleEngineState(theVehicle, false)
exports.anticheat:changeProtectedElementDataEx(theVehicle, "engine", 0, false)
end
end
exports.anticheat:changeProtectedElementDataEx(theVehicle, "handbrake", 1, false)
setElementVelocity(theVehicle, 0, 0, 0)
setElementFrozen(theVehicle, true)
end
end
end
end
end
addEventHandler("onPlayerQuit",getRootElement(), quitPlayer)
Bu arada yapılabiliyorsa, destekliyorum.
kodların arasında sa:mp'ın desteklemeyeceği kodlar vardır, emin ol.