Jump to content

طلب فنكشن


Recommended Posts

السلام عليكم و رحمه الله و بركاته :)

كيف الحال شباب, انشاء الله بخير :D

في عندي استفسار و هو :

لما واحد يدخل ماركر يصنع بيد

ولاكن ما اعرف كيف اخلي البيد يلحق الشخص الي دخل الماركر :roll:

انشاء الله فهمتوا 8)

وشكرآ لكم :)

Link to comment

سوي على آخر كودان مثال لاهنت و أذكر فائدتهم

getDistanceBetweenPoints3D 
setPedControlState 

setPedControlState ( ped thePed, string control, bool state ) 

ped thePed = اسم البيد

string control = سترنج

مثال = "fire"

bool state = القيمه false or true .

Link to comment

سوي على آخر كودان مثال لاهنت و أذكر فائدتهم

getDistanceBetweenPoints3D 
setPedControlState 

getDistanceBetweenPoints3D -- تجيب المسافه بين شي معين

setPedControlState -- تخلي الشخصيه تسوي شي معين

Example:
ped = createPed(0, getElementPosition(localPlayer)) 
  
addEventHandler("onClientRender", root, 
function() 
    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) 
  
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

سويت الكود وكل شي تمام ولاكن في مشكلة

لما شخص يدخل الماركر يطلع البيد لكل الي بالتيم

Client

local marker2 = createMarker ( 1536.2789306641,-1686.3870849609,13.546875,"cylinder",2, 0,255, 0, 255)  
 local blip2 = createBlip ( 1536.2789306641,-1686.3870849609,13.546875,5)  
 addEventHandler("onClientMarkerHit", marker2, 
 function () 
destroyElement ( ped )  
end)  
  
local marker33 = createMarker ( 1536.2789306641,-1686.3870849609+5,13.546875,"cylinder",2, 0,255, 0, 255)  
addEventHandler("onClientMarkerHit", marker33, 
 function () 
local player = getLocalPlayer() 
local playerTeam = getPlayerTeam ( player ) 
local TeamName = getTeamName ( playerTeam ) 
if ( TeamName == "No Team" ) then    
ped = createPed(0, getElementPosition(localPlayer)) 
  
end 
end)  
  
  
  
  
  
addEventHandler("onClientRender", root, 
function() 
local player = getLocalPlayer() 
local playerTeam = getPlayerTeam ( player ) 
local TeamName = getTeamName ( playerTeam ) 
if ( TeamName == "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 

Edited by Guest
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...