Jump to content

تصحيح كود


Recommended Posts

لا ابي بس اركب يركب لاني انا عندي انو يتبعني
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 

تفضل الكود مو حقي حق واحد أجنبي

:mrgreen:

Link to comment
ومدري ايش والكود مو مرتب 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) 
  
addCommandHandler("follower", function(p) 
    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) 
    --addEventHandler("onClientPedDamage", ped, on_damage_check) 
    pedSayTimer[ped[p]] = setTimer(doPedSaySomething, 5000, 1, ped[p]) 
    addEventHandler("onPedWasted", ped[p], function() 
        local ped = source 
        setTimer(destroyElement, 1000, 1, ped) 
        ablauf[p] = false 
         
    end) 
end) 
  

تفضل الكود أكتب " follower " في أف 8 يتبعك وين تروح :mrgreen:8)

Link to comment
ما ظبط ممكن تعطيني الرابط

client

local gMe = getLocalPlayer() 
  
addEvent("doPedJump", true) 
addEvent("doPedEnter", true) 
addEvent("doPedExitVeh", true) 
  
addEventHandler("doPedJump", getLocalPlayer(), function(p, boolean) 
    setPedControlState(p, "jump", boolean) 
end) 
  
addEventHandler("doPedEnter", getLocalPlayer(), function(p, boolean) 
    setPedControlState(p, "enter_passenger", boolean) 
end) 
  
addEventHandler("doPedExitVeh", getLocalPlayer(), function(p, boolean) 
    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 
  
addEventHandler("onClientPedDamage", getRootElement(), function(attacker) 
    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 -- 
  
  
addEventHandler("onClientRender", getRootElement(), function() 
    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 = { 
    [1] = "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) 
  
  
  
  
addCommandHandler("follower", function(p) 
    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) 
    --addEventHandler("onClientPedDamage", ped, on_damage_check) 
    pedSayTimer[ped[p]] = setTimer(doPedSaySomething, 5000, 1, ped[p]) 
    addEventHandler("onPedWasted", ped[p], function() 
        local ped = source 
        setTimer(destroyElement, 1000, 1, ped) 
        ablauf[p] = false 
         
    end) 
end) 
  

أتمنا عدم سرقة حقوق صنع مود أو تقول انتا صنعه حقوق الرجل أسمه : Noneatme :evil:

والسلام عليكم 8)

Link to comment

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

local theVehicle = getPedOccupiedVehicle(source)

warpPedIntoVehicle ( Ped, theVehicle )

end

addEventHandler("onClientPlayerVehicleEnter",getRootElement(),aa)

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

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