[Help] Charging using SetPlayerVelocity
#3

Quote:
Originally Posted by thimo
Посмотреть сообщение
First off all i thnik you gotta set the velocity like this: SetPlayerVeloCity(playerid, 0.2, 0.2, 0.2);
Second I have a script wich checks the speed of player infront of him when i got the thing out how i did it i will tell you
Edit:
This is to get vehicleid but since i see your post count i guess you know how to change it for anything
pawn Код:
GetVehicleInfrontID (vehid)
{
    new Float: temp = 7.0;
    new j = 0;
    for (new i = 1; i <= MAX_VEHICLES; i++)
    {
        new Float: a, Float: x1, Float: y1, Float: z1, Float: x2, Float: y2, Float: z2;
        GetVehiclePos (vehid, x1, y1, z1);
        GetVehicleZAngle (vehid, a);
        if (i != vehid)
        {
            if (GetVehiclePos (i, x2, y2, z2))
            {
                new Float: distance = floatsqroot (floatpower ((x1 - x2), 2) + floatpower ((y1 - y2), 2) + floatpower ((z1 - z2), 2));
                GetVehicleZAngle (vehid, a);

                if (distance < 300.0)
                {
                    x1 = x1 + (distance * floatsin(-a, degrees));
                    y1 = y1 + (distance * floatcos(-a, degrees));

                    distance = floatsqroot ((floatpower ((x1 - x2), 2)) + (floatpower ((y1 - y2), 2)));

                    if (temp > distance)
                    {
                        temp = distance;
                        j = i;
                    }
                }
            }
        }
    }
    if (temp < 7.0) return j;
    return -1;
}
Ha, thanks buddy! I'll change it for my needs.
I'll give a reply on wether I succeed or not.
Reply


Messages In This Thread
[Help] Charging using SetPlayerVelocity - by Universal - 04.02.2012, 14:31
Re: [Help] Charging using SetPlayerVelocity - by thimo - 04.02.2012, 14:47
Re: [Help] Charging using SetPlayerVelocity - by Universal - 04.02.2012, 15:03
Re: [Help] Charging using SetPlayerVelocity - by Universal - 04.02.2012, 15:22
Re: [Help] Charging using SetPlayerVelocity - by thimo - 05.02.2012, 08:29

Forum Jump:


Users browsing this thread: 4 Guest(s)