Advertisement
Shiny_

Untitled

Aug 29th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.08 KB | None | 0 0
  1. public OnPlayerUpdate(playerid) {
  2.         static Float: Angle[2];
  3.         static Float: Speed[2];
  4.         static Float: Position[3];
  5.         static s[96];
  6.        
  7.         // for(new playerid; playerid < MAX_PLAYERS; playerid++) {
  8.         GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
  9.         Speed[1] = floatsqroot(floatadd(floatadd(floatpower(floatabs(floatsub(Position[0], SavedPos[playerid][sX])), 2), floatpower(floatabs(floatsub(Position[1], SavedPos[playerid][sY])), 2)), floatpower(floatabs(floatsub(Position[2], SavedPos[playerid][sZ])), 2)));
  10.         Angle[0] = ReturnPlayerAngle(playerid);
  11.         Angle[1] = GetPlayerTheoreticAngle(playerid);
  12.         Speed[0] = floatmul(Speed[1], 12);
  13.        
  14.         if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && IsCar(GetPlayerVehicleID(playerid)) && floatabs(floatsub(Angle[0], Angle[1])) > DRIFT_MINKAT && floatabs(floatsub(Angle[0], Angle[1])) < DRIFT_MAXKAT && Speed[0] > DRIFT_SPEED) {
  15.             if(Timer_PlayerDriftPoints[playerid] > 0) KillTimer(Timer_PlayerDriftPoints[playerid]);
  16.             Timer_PlayerDriftPoints[playerid] = 0;
  17.             PointsFromDrift[playerid] += floatval(floatabs(floatsub(Angle[0], Angle[1])) * 3 * (Speed[0] * 0.1)) / 10;
  18.             Timer_PlayerDriftPoints[playerid] = SetTimerEx("LoadDrift", 3000, 0, "d", playerid);
  19.         }
  20.        
  21.         if(PointsFromDrift[playerid] > 0) {
  22.             format(s, sizeof(s), "\n\n\n%d $\n%d %s\n~k~~VEHICLE_FIREWEAPON~ - {FF0000}Nitro{FFFFFF}!", PointsFromDrift[playerid] / 2, PointsFromDrift[playerid], dli(PointsFromDrift[playerid], "Punkt", "Punkty", "Punktów"));
  23.             UpdatePlayer3DTextLabelText(playerid, Drift3DText[playerid], -1, s);
  24.         }
  25.  
  26.         SavedPos[playerid][sX] = Position[0];
  27.         SavedPos[playerid][sY] = Position[1];
  28.         SavedPos[playerid][sZ] = Position[2];
  29.  
  30.         static str[128];
  31.         static Float: health;
  32.        
  33.         if(UpdateSpeed[playerid]) {
  34.             GetVehicleHealth(GetPlayerVehicleID(playerid), health);
  35.             format(str, sizeof(str), "[%s]\n%d km/h\n%.0f/1000", VehNames[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400][1],  GetPlayerSpeed(GetPlayerVehicleID(playerid)), health);
  36.             UpdatePlayer3DTextLabelText(playerid, Speed3DText[playerid], -1, str);
  37.         }
  38.         return true;
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement