SA-MP Forums Archive
Velocity - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Velocity (/showthread.php?tid=298145)



Velocity - park4bmx - 19.11.2011

how would i check in what direction the vehicle is moving ?

pawn Код:
new SaveVelTimer[MAX_PLAYERS];
new Float:VelS[3];

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
SaveVelTimer[playerid] = SetTimerEx("SaveVelocity",500, true, "i", playerid);
return 1;
}

forward SpeedUpdate();
public SpeedUpdate()
{
new Float:Velocity[3];
GetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]);
if(Velocity[0] >= VelS[0] && Velocity[1] >= VelS[1])
{
//Moving Forward ?
}else if(Velocity[0] <= VelS[0]&& Velocity[1] <= VelS[1])
{
//Moving Backwords ?
}else if(Velocity[0] == VelS[0]&& Velocity[1] == VelS[1])
{
//Same Pos ?
}
return 1;
}

forward SaveVelocity(playerid);
public SaveVelocity(playerid)
{
GetVehicleVelocity(GetPlayerVehicleID(playerid), VelS[0], VelS[1], VelS[2]);
return 1;
}
would this work ?
if not please show me a method


Re: Velocity - Gamer_Z - 19.11.2011

Quote:
Originally Posted by Rock_Ro
Посмотреть сообщение
Lol.

A Drift Points Plugin, i was planning to release the best drift counter but this...ruin all my plans

Release aborted

Good Job, when i install San Andreas Again ( if i install ) i will test to see how it works xD

EDIT:
pawn Код:
stock IsVehicleDrivingBackwards(vehicleid)
{
    new
        Float:Float[3]
    ;
    if(GetVehicleVelocity(vehicleid, Float[1], Float[2], Float[0]))
    {
        GetVehicleZAngle(vehicleid, Float[0]);
        if(Float[0] < 90)
        {
            if(Float[1] > 0 && Float[2] < 0) return true;
        }
        else if(Float[0] < 180)
        {
            if(Float[1] > 0 && Float[2] > 0) return true;
        }
        else if(Float[0] < 270)
        {
            if(Float[1] < 0 && Float[2] > 0) return true;
        }
        else if(Float[1] < 0 && Float[2] < 0) return true;
    }
    return false;
}

Function made by Nero_3D if I remember correctly.


Re: Velocity - park4bmx - 19.11.2011

Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение

Function made by Nero_3D if I remember correctly.
Tnx V much