12.05.2012, 13:38
PHP Code:
public Drift()
{
new Float:Angle1, Float:Angle2, Float:BySpeed, s[128];
new Float:Z, Float:X, Float:Y;
new Float:SpeedX;
for(new g = 0; g < MAX_PLAYERS; g++)
{
GetPlayerPos(g, X, Y, Z);
SpeedX = floatsqroot(floatadd(floatadd(floatpower(floatabs(floatsub(X,SavedPos[ g ][ sX ])),2),floatpower(floatabs(floatsub(Y,SavedPos[ g ][ sY ])),2)),floatpower(floatabs(floatsub(Z,SavedPos[ g ][ sZ ])),2)));
Angle1 = ReturnPlayerAngle(g);
Angle2 = GetPlayerTheoreticAngle(g);
BySpeed = floatmul(SpeedX, 12);
if(IsPlayerInAnyVehicle(g) && IsCar(GetPlayerVehicleID(g)) && floatabs(floatsub(Angle1, Angle2)) > DRIFT_MINKAT && floatabs(floatsub(Angle1, Angle2)) < DRIFT_MAXKAT && BySpeed > DRIFT_SPEED)
{
if(PlayerDriftCancellation[g] > 0) KillTimer(PlayerDriftCancellation[g]);
PlayerDriftCancellation[g] = 0;
DriftPointsNow[g] += 10;
scores[g]++;
PlayerDriftCancellation[g] = SetTimerEx("DriftCancellation", 2000, 0, "d", g);
}
if(DriftPointsNow[g] > 0)
{
if(scplay[g] == 1)
{
TextDrawShowForPlayer(g,Chet[g]);
format(s, sizeof(s), "Drift: ~g~+%d$", DriftPointsNow[g]);
TextDrawSetString(Chet[g], s);
}
}
SavedPos[ g ][ sX ] = X;
SavedPos[ g ][ sY ] = Y;
SavedPos[ g ][ sZ ] = Z;
}
return 1;
}