[Help]Drifting system
#1

hey guys well, i want to make a drifting system for my server just for wen your in a car obviously, and i just cant get this, i can get the angle and display it, but how would i make it add "points" so like, say your angle is 100, your points is 100, then your angle changes to 200, then your points is 300 ect. i just don't know how i would go about doing this, please help iv'e got this from another help script just to test it out n stuff:

pawn Код:
#include <a_samp>
forward Drift(playerid,vehicleid);
new Drifting[MAX_PLAYERS];
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 Float:x,Float:y,Float:z;
        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),"a: %.2f Ang %.2f", 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));
}
Be greatfull if someone would help me, don't say " search " or give me a link to a search params , iv'e been doing it for 3 days and all iv'e found is ppl asking how to do it , just like i am .. but yeah if someone can help id'e be over the moon, actualy, scratch that, venus. ^^
Thanks
Crazy_Joe
Reply
#2

Make a formule like
GetPlayerVehicleZAngle*1.1+25
Reply
#3

Quote:
Originally Posted by FUNExtreme
Make a formule like
GetPlayerVehicleZAngle*1.1+25
:S um ok can you explain to me what this does ? and whare to put it as i'm guessing that i cant just put it anywhare, and how would i go about displaying the points wen they are updated ? thanks for replying

crazy_joe
Reply
#4

Quote:
Originally Posted by Cr@zY!_J?E
Quote:
Originally Posted by FUNExtreme
Make a formule like
GetPlayerVehicleZAngle*1.1+25
:S um ok can you explain to me what this does ? and whare to put it as i'm guessing that i cant just put it anywhare, and how would i go about displaying the points wen they are updated ? thanks for replying

crazy_joe
That was an example lol, You need to do the working out yourself

3 to go
Reply
#5

Does the tanges shows?
Reply
#6

Quote:
Originally Posted by Dujma
Does the tanges shows?
yeah, it says the angle like .. "293.9837" bla bla but i want points not angle, iv'e seen yours just like that
Reply
#7

Quote:
Originally Posted by Cr@zY!_J?E
Quote:
Originally Posted by Dujma
Does the tanges shows?
yeah, it says the angle like .. "293.9837" bla bla but i want points not angle, iv'e seen yours just like that
In my script I use points as variables combined with timer. This are the final points in my script.

pawn Код:
PlayerCurrentPoints[playerid] += ((diference + speed) * bonus);
Those are the points that are shown on top of you screen (GameText) and when you are not drifting for like 3-4 seconds the points are placed in your total points. My system is quite different. It compares vehicle's old angle with new one that is updated with timer.
Reply
#8

Quote:
Originally Posted by Dujma
Quote:
Originally Posted by Cr@zY!_J?E
Quote:
Originally Posted by Dujma
Does the tanges shows?
yeah, it says the angle like .. "293.9837" bla bla but i want points not angle, iv'e seen yours just like that
In my script I use points as variables combined with timer. This are the final points in my script.

pawn Код:
PlayerCurrentPoints[playerid] += ((diference + speed) * bonus);
Those are the points that are shown on top of you screen (GameText) and when you are not drifting for like 3-4 seconds the points are placed in your total points. My system is quite different. It compares vehicle's old angle with new one that is updated with timer.
I'm quite new to this float stuff, but as i can see your not going to release such a good script (thats why i'm trying myself) but if i got the angle using this:
pawn Код:
public Drift(playerid)
{
    if(Drifting[playerid] != 0)
    {
    new Float:x,Float:y,Float:z;
        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),"a: %.2f Ang %f", tang, ann);
        GameTextForPlayer(playerid, string, 100, 6);
        return 1;
    }else return 0;
}
How would i convert the angle i get in "ann" to "points" or "PlayerCurrentPoints[playerid]" this is what i don't understand, like 8 points for 40 degrees (example)
thanks for helping me
crazyjoe
Reply
#9

Well I did not covert anything. I just used floats without decimals (%.0f).
Reply
#10

Luby released a nice Drift Counter, Just after you made this topic >.>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)