[HELP]Drifting System(almost done)
#1

pawn Код:
#include <a_samp>
forward Drift(playerid,vehicleid);
new Drifting[MAX_PLAYERS];
new Float:x,Float:y,Float:z;
new Float:nx,Float:ny;
new Float:tang;
new Float:ann;
new string[256];

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Testing Drift System");
    print("--------------------------------------\n");
    SetTimer("Drift",200,1);
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerEnterVehicle(playerid,vehicleid)
{
    Drifting[playerid] = 1;
    return 1;
}

public OnPlayerExitVehicle(playerid,vehicleid)
{
    Drifting[playerid] = 0;
    return 1;
}

public Drift(playerid)
{
    if(Drifting[playerid] != 0)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        GetPlayerPos(playerid, x, y, z);
        GetXYInFrontOfPlayer(playerid,nx,nx,10);
        tang = atan2(nx-x,ny-y);
        GetVehicleZAngle(vehicleid,ann);
        format(string,sizeof(string),"Tangen: %f Ang %f", tang, ann);
        GameTextForPlayer(playerid, string, 100, 6);
        return 1;
    }else return 0;
}

GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;

    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);

    if (GetPlayerVehicleID(playerid)) {
      GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }

    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
Yep, guys, i was checking, the angle, changes a lot, from 10 to 300, but, the atan2 thing, when drifting, it stays betwenn, 172 - 175, like, what am i supposed to do now?
Reply


Messages In This Thread
[HELP]Drifting System(almost done) - by faloleroy - 02.02.2009, 14:59
Re: [HELP]Drifting System(almost done) - by MenaceX^ - 02.02.2009, 15:02
Re: [HELP]Drifting System(almost done) - by faloleroy - 02.02.2009, 15:07
Re: [HELP]Drifting System(almost done) - by yezizhu - 03.02.2009, 03:02
Re: [HELP]Drifting System(almost done) - by AlExAlExAlEx - 03.02.2009, 03:04
Re: [HELP]Drifting System(almost done) - by yezizhu - 03.02.2009, 03:35

Forum Jump:


Users browsing this thread: 1 Guest(s)