GetPlayerSpeed
#1

hey does anyone knows a good working GetPlayerSpeed
I've got
PHP код:
stock GetVehicleSpeed(vehicleid)
{
        if(
vehicleid != INVALID_VEHICLE_ID)
        {
                new 
Float:Pos[3],Float:VS ;
                
GetVehicleVelocity(vehicleidPos[0], Pos[1], Pos[2]);
                
VS floatsqroot(Pos[0]*Pos[0] + Pos[1]*Pos[1] + Pos[2]*Pos[2])*200;
                return 
floatround(VS,floatround_round);
        }
        return 
INVALID_VEHICLE_ID;
}
stock GetPlayerSpeed(playerid)
{
        if(
playerid != INVALID_PLAYER_ID)
        {
                new 
Float:Pos[3],Float:PS;
                
GetPlayerVelocity(playeridPos[0], Pos[1], Pos[2]);
                
PS floatsqroot(Pos[0]*Pos[0] + Pos[1]*Pos[1] + Pos[2]*Pos[2])*200;
                return 
floatround(PS,floatround_round);
        }
        return 
INVALID_PLAYER_ID;

but if i would use GetPlayerSpeed(playerid) >= 120 would work...or its made only for excact speed..?
Reply
#2

The one you posted here should work fairly well.
Reply
#3

I have this one in my [MV]_cPanel:

pawn Код:
stock GetPlayerSpeed(playerid)
{
    new Float:ST[4];
    if(IsPlayerInAnyVehicle(playerid))
    GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
    else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625;
    return floatround(ST[3]);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)