Szerző Téma: MTA traffipax script  (Megtekintve 1457 alkalommal)

MTA traffipax script
« Dátum: 2017. Június 25. - 10:39:13 »
0
Sziasztok! Olyan scriptet keresek, ami ha beírsz egy parancsot (pl.:/traffipax) megmutatja az előtted elhaladó autó sebességét.

MTA traffipax script
« Válasz #1 Dátum: 2017. Július 10. - 02:19:21 »
+1
createColSphere()
isElementWithinColShape() / onColShapeHit()
getElementSpeed()Sok sikert, bármi kérdésed van, segítünk!

MTA traffipax script
« Válasz #2 Dátum: 2017. Július 10. - 10:22:07 »
+1
A getElementSpeed \'Useful Function\' hogy müködjön bekell ezt raknod:
 

Function source
 


   This function requires MTA: SA 1.4 or higher to work. It doesn\'t need, however, to activate OOP.


function getElementSpeed(theElement, unit)
    -- Check arguments for errors
    assert(isElement(theElement), \"Bad argument 1 @ getElementSpeed (element expected, got \" .. type(theElement) .. \")\")
    local elementType = getElementType(theElement)
    assert(elementType == \"player\" or elementType == \"ped\" or elementType == \"object\" or elementType == \"vehicle\" or elementType == \"projectile\", \"Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got \" .. elementType .. \")\")
    assert((unit == nil or type(unit) == \"string\" or type(unit) == \"number\") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == \"m/s\" or unit == \"km/h\" or unit == \"mph\"), \"Bad argument 2 @ getElementSpeed (invalid speed unit)\")
    -- Default to m/s if no unit specified and \'ignore\' argument type if the string contains a number
    unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit))
    -- Setup our multiplier to convert the velocity to the specified unit
    local mult = (unit == 0 or unit == \"m/s\") and 50 or ((unit == 1 or unit == \"km/h\") and 180 or 111.84681456)
    -- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit
    return (Vector3(getElementVelocity(theElement)) * mult).length
end

MTA traffipax script
« Válasz #3 Dátum: 2017. Július 10. - 10:57:35 »
0
úgy gondoltam, talán ez magától értedődik neki :D 

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal