Jump to content

تصحيح كود


Recommended Posts

شباب انا سويت كود يدبل السبرنت

تكون سرعة الاعب بالركض دبلها space يعني لما الشخص يضغط

يعني السرعة الطبيعية للاعب لما يركض 21 انا خليتها 42 اي الدبل بس مدري ليه ما اشتغل السكربت

function setElementSpeed(element, unit, speed)  
    if (unit == nil) then unit = 0 end 
    if (speed == nil) then speed = 0 end 
    speed = tonumber(speed) 
    local acSpeed = getElementSpeed(element, unit) 
    if (acSpeed~=false) then  
        local diff = speed/acSpeed 
        local x,y,z = getElementVelocity(element) 
        setElementVelocity(element,x*diff,y*diff,z*diff) 
        return true 
    end 
  
    return false 
end 
  
function getElementSpeed(element,unit) 
    if (unit == nil) then unit = 0 end 
    if (isElement(element)) then 
        local x,y,z = getElementVelocity(element) 
        if (unit=="mph" or unit==0 or unit =='1') then 
            return (x^2 + y^2 + z^2) ^ 0.5 * 100 
        else 
            return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100 
        end 
    else 
        outputDebugString("Not an element. Can't get speed") 
        return false 
    end 
end 
  
addEventHandler("onClientRender",root,function() 
    local speed = getElementSpeed(localPlayer,"mph") 
    if ( speed and speed < 21 and getControlState("sprint") == true ) then 
        setElementSpeed(localPlayer,"mph",42) 
    end 
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...