VlageZ

مشكله بكود

Recommended Posts

--ايش المشكله بهذا الكود, اللاعب ما يسوي له اتاش Attach
function
 FindNearestElement(to,elementType,maxDistance) 
    local x,y,z = getElementPosition(to)             
    local bestD = maxDistance + 1 
    local bv = nil 
    for _,av in pairs(getElementsByType(elementType)) do 
            local vx,vy,vz = getElementPosition(av) 
            local d = getDistanceBetweenPoints3D(x,y,z,vx,vy,vz) 
            if d < bestD then 
                bestD = d 
                bv = av 
            end 
        end 
    return bv,bestD  
end 
 
function attach ( thePlayer, command, who )
    local nearstElement = FindNearestElement(thePlayer,"player",15)
    attachElements ( nearstElement, thePlayer, 020 )
end 
addCommandHandler ( "cuff", attach )
 
function dettach ( thePlayer, command, who )
    local unarrest = getPlayerFromName(who)
    if isElement(unarrest) then 
        detachElements ( unarrest, thePlayer )
        outputChatBox("تم فك الكلبشه",thePlayer,255,0,0)
    else 
        outputChatBox("اللاعب غير مكلبش",thePlayer,255,0,0)
    end    
end
addCommandHandler ( "uncuff", dettach )

Share this post


Link to post

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.