Jump to content

طلب


Recommended Posts

السلام عليكم ورحمة الله وبركاته اليوم ابي كيف اخلي نرسبن شخصية مو حقيقية (بيد) يركب بسيارتك اذا قربت منو وتكون انت بتيم معين ويطلع اذا خشينا بماركر وبعدها يختفي وشكرا :mrgreen:

Link to comment
function pedLoad () 
function onEnter(player) 
   createPed ( modelid, x, y, z )  
   warpPedIntoVehicle(thePed,vehicle) 
   removePedFromVehicle(theprisoner) 
   end 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(), pedLoad ) 

نعم تقدر عبر كلنت و تقرايقر سيرفر م اجل يركب

+

مكي هريسه

ليه عامل فنيشن 2

و مو معرف البيد

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

local marker2 = createMarker (1536.27,-1686.387,13.546,"cylinder", 2, 0, 255, 0, 255)  
local blip2 = createBlip (1536.27, -1686.387, 13.546,5)  
  
addEventHandler("onClientMarkerHit", marker2, 
function (hit) 
  if (hit == localPlayer) then 
   if isElement (ped) then 
     destroyElement ( ped )  
    end 
  end  
end 
)  
  
local marker33 = createMarker ( 1536.27,-1686.387+5,13.54,"cylinder", 2, 0, 255, 0, 255)  
addEventHandler("onClientMarkerHit", marker33, 
function (hit) 
  if (hit == localPlayer) then 
    if getPlayerTeam (localPlayer) and getTeamName (getPlayerTeam (localPlayer)) == "No Team" then 
      ped = createPed(0, getElementPosition(localPlayer)) 
     end 
  end 
end 
)  
  
addEventHandler("onClientRender", root,  
function() 
  if getPlayerTeam (localPlayer) and getTeamName (getPlayerTeam (localPlayer)) == "No Team" then   
    local x, y, z = getElementPosition(localPlayer) 
    local tx, ty, tz = getElementPosition(ped) 
    local dis = getDistanceBetweenPoints2D(x, y, tx, ty) 
    if dis > 2 then 
    setPedControlState(ped, "forwards", true) 
    else 
    setPedControlState(ped, "forwards", false) 
    end 
    setPedRotation(ped, findRotation(tx, ty, x, y)) 
  end 
end 
) 
  
function findRotation(x1,y1,x2,y2) 
    local t = -math.deg(math.atan2(x2-x1,y2-y1)) 
    if t < 0 then t = t + 360 end 
    return t 
end 
Link to comment

تفضل أخوي جرب

local id = ------- ايدي البيد 
local x, y, z = -------- احداثيات البيد 
local xx, yy, zz = -------- احداثيات الماركر الي لمن تصله يشيل البيد من السيارة ويخفيه 
local team = "" -------- اسم التيم الي تبيه بس لهم حطه بين القوسين 
-------------------------------------------------------- 
ped = createPed( id, x, y, z ) 
marker = createMarker ( x, y, z-1,"cylinder", 1.5, 0, 0, 0, 0 ) 
markerout = createMarker ( xx, yy, zz,"cylinder", 1.5, 100, 90, 80, 150 ) 
local playervehicle = getPedOccupiedVehicle ( localPlayer ) 
function destroyPed() 
    destroyElement(ped) 
end 
addEventHandler("onClientMarkerHit",getRootElement(),function 
if ( source == marker ) and ( playervehicle ) and ( getTeamName(getPlayerTeam(localPlayer)) == team ) then 
    warpPedIntoVehicle ( ped, playervehicle ) 
    destroyElement(marker) 
elseif ( source == markerout ) and ( playervehicle ) and ( getTeamName(getPlayerTeam(localPlayer)) == team ) then    
    removePedFromVehicle ( ped ) 
    setTimer ( destroyPed, 5000, 1 ) 
    end  
end 
) 
  
Link to comment
تفضل أخوي جرب

local id = ------- ايدي البيد 
local x, y, z = -------- احداثيات البيد 
local xx, yy, zz = -------- احداثيات الماركر الي لمن تصله يشيل البيد من السيارة ويخفيه 
local team = "" -------- اسم التيم الي تبيه بس لهم حطه بين القوسين 
-------------------------------------------------------- 
ped = createPed( id, x, y, z ) 
marker = createMarker ( x, y, z-1,"cylinder", 1.5, 0, 0, 0, 0 ) 
markerout = createMarker ( xx, yy, zz,"cylinder", 1.5, 100, 90, 80, 150 ) 
local playervehicle = getPedOccupiedVehicle ( localPlayer ) 
function destroyPed() 
    destroyElement(ped) 
end 
addEventHandler("onClientMarkerHit",getRootElement(),function 
if ( source == marker ) and ( playervehicle ) and ( getTeamName(getPlayerTeam(localPlayer)) == team ) then 
    warpPedIntoVehicle ( ped, playervehicle ) 
    destroyElement(marker) 
elseif ( source == markerout ) and ( playervehicle ) and ( getTeamName(getPlayerTeam(localPlayer)) == team ) then    
    removePedFromVehicle ( ped ) 
    setTimer ( destroyPed, 5000, 1 ) 
    end  
end 
) 
  

ماتفرق بين فنكشنات السيرفر والكلنت

وعندك playervehicle

حطه داخل الحدثonClientMarkerHit

Link to comment
تفضل أخوي جرب

local id = ------- ايدي البيد 
local x, y, z = -------- احداثيات البيد 
local xx, yy, zz = -------- احداثيات الماركر الي لمن تصله يشيل البيد من السيارة ويخفيه 
local team = "" -------- اسم التيم الي تبيه بس لهم حطه بين القوسين 
-------------------------------------------------------- 
ped = createPed( id, x, y, z ) 
marker = createMarker ( x, y, z-1,"cylinder", 1.5, 0, 0, 0, 0 ) 
markerout = createMarker ( xx, yy, zz,"cylinder", 1.5, 100, 90, 80, 150 ) 
local playervehicle = getPedOccupiedVehicle ( localPlayer ) 
function destroyPed() 
    destroyElement(ped) 
end 
addEventHandler("onClientMarkerHit",getRootElement(),function 
if ( source == marker ) and ( playervehicle ) and ( getTeamName(getPlayerTeam(localPlayer)) == team ) then 
    warpPedIntoVehicle ( ped, playervehicle ) 
    destroyElement(marker) 
elseif ( source == markerout ) and ( playervehicle ) and ( getTeamName(getPlayerTeam(localPlayer)) == team ) then    
    removePedFromVehicle ( ped ) 
    setTimer ( destroyPed, 5000, 1 ) 
    end  
end 
) 
  

ماتفرق بين فنكشنات السيرفر والكلنت

وعندك playervehicle

حطه داخل الحدثonClientMarkerHit

local كل الفنكشات الي انا حاططها كلنت + م يحتاج اضيفه لداخل الحدث صحيح انا مسوي

بس ماهي بداخل فنكشن او شي هي تكون في كل الملف يعني تقدر تستعملها + لو م ضبطت يمديه يشيل كلمة لوكال

Link to comment

*[MSN]MHMD

local playervehicle = getPedOccupiedVehicle ( localPlayer )

الكود هاد لازم يكون داخل الحدث لانه

هو يجيب سيارة الاعب اول ما يشتغل المود يعني اذا ما كان راكب يكون على طول مو راكب سيارة

و لو كان راكب يكون على طول راكب سيارة

بس لما تحطة في الحدث

يتحقق اذا راكب ولا مو راكب لما يلمس الماركر

فهمت علي

Link to comment
*[MSN]MHMD

local playervehicle = getPedOccupiedVehicle ( localPlayer )

الكود هاد لازم يكون داخل الحدث لانه

هو يجيب سيارة الاعب اول ما يشتغل المود يعني اذا ما كان راكب يكون على طول مو راكب سيارة

و لو كان راكب يكون على طول راكب سيارة

بس لما تحطة في الحدث

يتحقق اذا راكب ولا مو راكب لما يلمس الماركر

فهمت علي

اها مشكور على الشرح توني فاهم لانه م فهمت من ذاك زين

Link to comment
local marker2 = createMarker (1536.27,-1686.387,13.546,"cylinder", 2, 0, 255, 0, 255) 
local blip2 = createBlip (1536.27, -1686.387, 13.546,5) 
  
addEventHandler("onClientMarkerHit", marker2, 
function (hit) 
  if (hit == localPlayer) then 
   if isElement (ped) then 
     destroyElement ( ped ) 
    end 
  end 
end 
) 
  
local marker33 = createMarker ( 1536.27,-1686.387+5,13.54,"cylinder", 2, 0, 255, 0, 255) 
addEventHandler("onClientMarkerHit", marker33, 
function (hit) 
  if (hit == localPlayer) then 
    if getPlayerTeam (localPlayer) and getTeamName (getPlayerTeam (localPlayer)) == "No Team" then 
      ped = createPed(0, getElementPosition(localPlayer)) 
     end 
  end 
end 
) 
  
addEventHandler("onClientRender", root, 
function() 
  if getPlayerTeam (localPlayer) and getTeamName (getPlayerTeam (localPlayer)) == "No Team" then   
    local x, y, z = getElementPosition(localPlayer) 
    local tx, ty, tz = getElementPosition(ped) 
    local dis = getDistanceBetweenPoints2D(x, y, tx, ty) 
    if dis > 2 then 
    setPedControlState(ped, "forwards", true) 
    else 
    setPedControlState(ped, "forwards", false) 
    end 
    setPedRotation(ped, findRotation(tx, ty, x, y)) 
  end 
end 
) 
  
function findRotation(x1,y1,x2,y2) 
    local t = -math.deg(math.atan2(x2-x1,y2-y1)) 
    if t < 0 then t = t + 360 end 
    return t 
end 
  
  

اناعندي ذا الكود بس اخش يرسبن بيد ويلحقني اسا انا ابيه بس اركب سيارة يركب معي وبس اخرج يخرج معي

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