# تصحيح كود

## Recommended Posts

```function aa()
local theVehicle = getPedOccupiedVehicle(source)
warpPedIntoVehicle ( Ped, theVehicle )
end
```

شو المشكلة

اطــــــرح الكــــــود كامل عـــــشان نــقـــــدر نساعدكــ

اتوقع هذه ثاني مره تفتح فيها موضوع وبنفس الموضوع

وعاطينك الكود كامل بس انت مصر على كودك الغلط ....

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

تبي كود عندما تركيب سيارة يركب معاك رجل وعندما تمشي يتبعك صحح او لا ؟ لا ابي بس اركب يركب لاني انا عندي انو يتبعني
```local inveh = false
if(isPedInVehicle(player)) then
inveh = true
end
if(inveh == true) and (getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) < 4) then
if(stat[p]["inveh"] ~= true) and (stat[p]["enterveh"] ~= true) then
stat[p]["enterveh"] = true
setPedAnimation(p)
triggerClientEvent(getRootElement(), "doPedEnter", player, p, true)
setTimer(function()
local occupants = getVehicleOccupants(getPedOccupiedVehicle(player))
for i = 1, getVehicleMaxPassengers(getPedOccupiedVehicle(player)), 1 do
if not(occupants[i]) then
warpPedIntoVehicle(p, getPedOccupiedVehicle(player), i)
stat[p]["inveh"] = true
break;
end
end
stat[p]["enterveh"] = false
end, 2000, 1)
end
else
if(stat[p]["inveh"] == true) and (stat[p]["enterveh"] == false) and(isPedInVehicle(player) == false) then -- er ist nicht im auto aber ich bin es
stat[p]["enterveh"] = true
triggerClientEvent(getRootElement(), "doPedExitVeh", player, p, true)
setTimer(function()
removePedFromVehicle(p)
stat[p]["enterveh"] = false
stat[p]["inveh"] = false
end, 1000, 1)
end
end
```

تفضل الكود مو حقي حق واحد أجنبي ومدري ايش والكود مو مرتب triggerClientEvent اتمنى تعطيني الكود كاملل لانو في

ومدري ايش والكود مو مرتب triggerClientEvent اتمنى تعطيني الكود كاملل لانو في
```local ablauf = {}
local ped = {}
local stat = {}
local firetimer = {}
local timer = {}
local jx, jy, jz = {}, {}, {}
local pedSayTimer = {}

local function doPedSaySomething(ped)
if(isTimer(pedSayTimer[ped])) then
killTimer(pedSayTimer[ped])
end
if(isElement(ped)) then
local message = say_messages[math.random(1, #say_messages)]
local x, y, z = getElementPosition(ped)
local col = createColSphere(x, y, z, 10)
for index, p in ipairs( getElementsWithinColShape(col, "player") ) do
local x2, y2, z2 = getElementPosition ( p )
local distance = getDistanceBetweenPoints3D ( x, y, z, x2, y2, z2 )
local rgb = 15 * distance - 125
local rgb = math.abs ( rgb - 255 ) + 125
outputChatBox ("Bodyguard sagt: " ..message, p, rgb, rgb, rgb )
end
destroyElement(col)
pedSayTimer[ped] = setTimer(doPedSaySomething, 10000+math.random(5000, 60000), 1, ped)
end
end

local function functionscheck()
for index, p in next, ped do
if(isElement(p)) then
local player = getPlayerFromName(getElementData(p, "besitzer"))
if(player) and (ped[player]) then
if(isElement(p)) and (ablauf[player] == true) then
if not(stat[p]) then
stat[p] = {}
timer[p] = {}
end
local owner = player
if(owner) then
local x, y, z = getElementPosition(owner)
local x2, y2, z2 = getElementPosition(p)
if(getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) > 3) then
-- SPRINT CHECK --
stat[p]["running"] = true
if(getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) > 10) then
if(stat[p]["jumping"] ~= true) and (stat[p]["inveh"] ~= true) then
setPedAnimation(p, "ped" , "sprint_civi", -1, true, true, false) -- Sprintet
end
else
if(stat[p]["jumping"] ~= true) and (stat[p]["inveh"] ~= true) then
setPedAnimation(p, "ped" , "JOG_maleA", -1, true, true, false) -- Joggt
end
end
-- ROTATION --
local x1, y1 = getElementPosition(p)
local x2, y2 = getElementPosition(owner)
local rot = math.atan2(y2 - y1, x2 - x1) * 180 / math.pi
rot = rot-90
setPedRotation(p, rot)
-- CAR --
local inveh = false
if(isPedInVehicle(player)) then
inveh = true
end
if(inveh == true) and (getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) < 4) then
if(stat[p]["inveh"] ~= true) and (stat[p]["enterveh"] ~= true) then
stat[p]["enterveh"] = true
setPedAnimation(p)
triggerClientEvent(getRootElement(), "doPedEnter", player, p, true)
setTimer(function()
local occupants = getVehicleOccupants(getPedOccupiedVehicle(player))
for i = 1, getVehicleMaxPassengers(getPedOccupiedVehicle(player)), 1 do
if not(occupants[i]) then
warpPedIntoVehicle(p, getPedOccupiedVehicle(player), i)
stat[p]["inveh"] = true
break;
end
end
stat[p]["enterveh"] = false
end, 2000, 1)
end
else
if(stat[p]["inveh"] == true) and (stat[p]["enterveh"] == false) and(isPedInVehicle(player) == false) then -- er ist nicht im auto aber ich bin es
stat[p]["enterveh"] = true
triggerClientEvent(getRootElement(), "doPedExitVeh", player, p, true)
setTimer(function()
removePedFromVehicle(p)
stat[p]["enterveh"] = false
stat[p]["inveh"] = false
end, 1000, 1)
end
end
-- JUMP CHECK  --
if(inveh == false) then
if((z-z2) > 0.-- s8) --> and (getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) < 4) and (stat[p]["jumping"] ~= true) then -- er ist oben
stat[p]["jumping"] = true
setPedAnimation(p)
triggerClientEvent(getRootElement(), "doPedJump", player, p, true)
if(isTimer(timer[p]["jump"])) then killTimer(timer[p]["jump"]) end
timer[p]["jump"] = setTimer(function()
stat[p]["jumping"] = false
triggerClientEvent(getRootElement(), "doPedJump", player, p, false)
end, 800, 1)
end
end
else
if (stat[p]["running"] == true)then
stat[p]["running"] = false
setPedAnimation(p)
end
end
else
destroyElement(p)
end
end
end
else
if(isElement(p)) then
destroyElement(p)
end
p = nil
end
end
end

setTimer(functionscheck, 200, -1)

if(ablauf[p] == true) then return end
ablauf[p] = true
local x, y, z = getElementPosition(p)
ped[p] = createPed(164, x, y+1, z)
setElementData(ped[p], "besitzer", getPlayerName(p))
setElementData(ped[p], "bodyguard", true)
setTimer(giveWeapon, 1000, 1, ped[p], 27, 99999, true)
setPedStat (ped[p], 72, 999)
setPedStat (ped[p], 76, 999)
setPedStat (ped[p], 74, 999)
pedSayTimer[ped[p]] = setTimer(doPedSaySomething, 5000, 1, ped[p])
local ped = source
setTimer(destroyElement, 1000, 1, ped)
ablauf[p] = false

end)
end)

```

تفضل الكود أكتب " follower " في أف 8 يتبعك وين تروح  شكرا اخي ما قصرت

العفو  الحين جربته ما ظبط

اذا تقدر تعطين رابط تحميل المود

سبب عطيتك مود مو كامل هذا سيرفر بس كلنت معطيتك ما ظبط ممكن تعطيني الرابط

client

```local gMe = getLocalPlayer()

setPedControlState(p, "jump", boolean)
end)

setPedControlState(p, "enter_passenger", boolean)
end)

setPedControlState(p, "enter_exit", boolean)
end)

-- DAMAGE ABFRAGE --

local pedTarget = {}
local pedTimer = {}
local pedShooting = {}

local function doPedAttackOtherPlayer(ped)
if(isTimer(pedTimer[ped])) or (isPedInVehicle(ped)) then
killTimer(pedTimer[ped])
end
if(isElement(ped)) then
pedTimer[ped] = setTimer(function()
if(isElement(ped)) then
local target = pedTarget[ped]
if(target) then
local x, y, z = getElementPosition(ped)
local x2, y2, z2 = getElementPosition(target)
if(isLineOfSightClear(x, y, z, x2, y2, z2, true, false, false, false, false, false)) then
if(getElementHealth(target) > 1) then
if(pedShooting[ped] ~= true) then
--[[
local x1, y1 = getElementPosition(ped)
local x2, y2 = getElementPosition(target)
local rot = math.atan2(y2 - y1, x2 - x1) * 180 / math.pi
rot = rot-90
setPedRotation(ped, rot)
setPedAnimation(ped)
if(getPedControlState(ped, "fire") ~= true) then
setPedControlState(ped, "fire", true)
end
setPedAimTarget(ped, x2, y2, z2)]]
setPedControlState(ped, "fire", true)
pedShooting[ped] = true
else
local x1, y1, z1 = getElementPosition(ped)
local x2, y2, z2 = getElementPosition(target)
local rot = math.atan2(y2 - y1, x2 - x1) * 180 / math.pi
rot = rot-90
setPedRotation(ped, rot)
setPedAimTarget(ped, x2, y2, z2)
end
else
killTimer(pedTimer[ped])
pedShooting[ped] = false
setPedControlState(ped, "fire", false)
end
else
killTimer(pedTimer[ped])
pedShooting[ped] = false
setPedControlState(ped, "fire", false)
end
end
else
killTimer(pedTimer[ped])
end
end, 500, -1)
else
killTimer(pedTimer[ped])
end
end

if(getElementData(source, "bodyguard") == true) then
if(attacker) and (isElement(attacker)) then
if(getElementType(attacker) == "player") or (getElementType(attacker) == "vehicle") then
pedTarget[source] = attacker
doPedAttackOtherPlayer(source)
end
end
end
end)

-- onClientRender Func --

for index, p in pairs(getElementsByType("ped", getRootElement(), true)) do
if(getElementData(p, "bodyguard") == true) then
local owner = getElementData(p, "besitzer")
if(owner) then
local x, y, z = getElementPosition(p)
local x2, y2, z2 = getElementPosition(gMe)
if(isLineOfSightClear(x, y, z, x2, y2, z2, true, true, false, true)) then
local sx, sy = getScreenFromWorldPosition(x, y, z+1)
if(sx) and (sy) then
local distance = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2)
if(distance < 30) then
dxDrawText(owner.."'s Bodyguard", sx+2, sy+2, sx, sy, tocolor(0, 0, 0, 200), 2-(distance/20), "arial", "center", "center")
dxDrawText(owner.."'s Bodyguard", sx, sy, sx, sy, tocolor(0, 255, 0, 200), 2-(distance/20), "arial", "center", "center")
end
end
end
end
end
end
end)
```

في هذا سطر

```dxDrawText(owner.."'s Bodyguard", sx+2, sy+2, sx, sy, tocolor(0, 0, 0, 200), 2-(distance/20), "arial", "center", "center")
dxDrawText(owner.."'s Bodyguard", sx, sy, sx, sy, tocolor(0, 255, 0, 200), 2-(distance/20), "arial", "center", "center")
```

أكتب شيء لي تبي يطلع فوق الرجل .

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

server

```local ablauf = {}
local ped = {}
local stat = {}
local firetimer = {}
local timer = {}
local jx, jy, jz = {}, {}, {}
local pedSayTimer = {}

local say_messages = {
 = "Hallo!",
}

local function doPedSaySomething(ped)
if(isTimer(pedSayTimer[ped])) then
killTimer(pedSayTimer[ped])
end
if(isElement(ped)) then
local message = say_messages[math.random(1, #say_messages)]
local x, y, z = getElementPosition(ped)
local col = createColSphere(x, y, z, 10)
for index, p in ipairs( getElementsWithinColShape(col, "player") ) do
local x2, y2, z2 = getElementPosition ( p )
local distance = getDistanceBetweenPoints3D ( x, y, z, x2, y2, z2 )
local rgb = 15 * distance - 125
local rgb = math.abs ( rgb - 255 ) + 125
outputChatBox ("Bodyguard sagt: " ..message, p, rgb, rgb, rgb )
end
destroyElement(col)
pedSayTimer[ped] = setTimer(doPedSaySomething, 10000+math.random(5000, 60000), 1, ped)
end
end

local function functionscheck()
for index, p in next, ped do
if(isElement(p)) then
local player = getPlayerFromName(getElementData(p, "besitzer"))
if(player) and (ped[player]) then
if(isElement(p)) and (ablauf[player] == true) then
if not(stat[p]) then
stat[p] = {}
timer[p] = {}
end
local owner = player
if(owner) then
local x, y, z = getElementPosition(owner)
local x2, y2, z2 = getElementPosition(p)
if(getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) > 3) then
-- SPRINT CHECK --
stat[p]["running"] = true
if(getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) > 10) then
if(stat[p]["jumping"] ~= true) and (stat[p]["inveh"] ~= true) then
setPedAnimation(p, "ped" , "sprint_civi", -1, true, true, false) -- Sprintet
end
else
if(stat[p]["jumping"] ~= true) and (stat[p]["inveh"] ~= true) then
setPedAnimation(p, "ped" , "JOG_maleA", -1, true, true, false) -- Joggt
end
end
-- ROTATION --
local x1, y1 = getElementPosition(p)
local x2, y2 = getElementPosition(owner)
local rot = math.atan2(y2 - y1, x2 - x1) * 180 / math.pi
rot = rot-90
setPedRotation(p, rot)
-- CAR --
local inveh = false
if(isPedInVehicle(player)) then
inveh = true
end
if(inveh == true) and (getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) < 4) then
if(stat[p]["inveh"] ~= true) and (stat[p]["enterveh"] ~= true) then
stat[p]["enterveh"] = true
setPedAnimation(p)
triggerClientEvent(getRootElement(), "doPedEnter", player, p, true)
setTimer(function()
local occupants = getVehicleOccupants(getPedOccupiedVehicle(player))
for i = 1, getVehicleMaxPassengers(getPedOccupiedVehicle(player)), 1 do
if not(occupants[i]) then
warpPedIntoVehicle(p, getPedOccupiedVehicle(player), i)
stat[p]["inveh"] = true
break;
end
end
stat[p]["enterveh"] = false
end, 2000, 1)
end
else
if(stat[p]["inveh"] == true) and (stat[p]["enterveh"] == false) and(isPedInVehicle(player) == false) then -- er ist nicht im auto aber ich bin es
stat[p]["enterveh"] = true
triggerClientEvent(getRootElement(), "doPedExitVeh", player, p, true)
setTimer(function()
removePedFromVehicle(p)
stat[p]["enterveh"] = false
stat[p]["inveh"] = false
end, 1000, 1)
end
end
-- JUMP CHECK  --
if(inveh == false) then
if((z-z2) > 0.-- s8) --> and (getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) < 4) and (stat[p]["jumping"] ~= true) then -- er ist oben
stat[p]["jumping"] = true
setPedAnimation(p)
triggerClientEvent(getRootElement(), "doPedJump", player, p, true)
if(isTimer(timer[p]["jump"])) then killTimer(timer[p]["jump"]) end
timer[p]["jump"] = setTimer(function()
stat[p]["jumping"] = false
triggerClientEvent(getRootElement(), "doPedJump", player, p, false)
end, 800, 1)
end
end
else
if (stat[p]["running"] == true)then
stat[p]["running"] = false
setPedAnimation(p)
end
end
else
destroyElement(p)
end
end
end
else
if(isElement(p)) then
destroyElement(p)
end
p = nil
end
end
end

setTimer(functionscheck, 200, -1)

if(ablauf[p] == true) then return end
ablauf[p] = true
local x, y, z = getElementPosition(p)
ped[p] = createPed(164, x, y+1, z)
setElementData(ped[p], "besitzer", getPlayerName(p))
setElementData(ped[p], "bodyguard", true)
setTimer(giveWeapon, 1000, 1, ped[p], 27, 99999, true)
setPedStat (ped[p], 72, 999)
setPedStat (ped[p], 76, 999)
setPedStat (ped[p], 74, 999)
pedSayTimer[ped[p]] = setTimer(doPedSaySomething, 5000, 1, ped[p])
local ped = source
setTimer(destroyElement, 1000, 1, ped)
ablauf[p] = false

end)
end)

```

أتمنا عدم سرقة حقوق صنع مود أو تقول انتا صنعه حقوق الرجل أسمه : Noneatme والسلام عليكم يجيليانه في مشكله بالسيرفر بسطر 101

سيرفر أو كلنت ؟ جربت استفيد من المود الياعطاني ايا اذواف بس ما ظبط طلبي:وش احط هنا function aa()

local theVehicle = getPedOccupiedVehicle(source)

warpPedIntoVehicle ( Ped, theVehicle )

end

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

## Create an account

Register a new account