Advertisement
Shiny_

Untitled

Aug 29th, 2013
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.26 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.         static ttime;
  7.        
  8.         CzasZapisany[playerid] = 0;
  9.         ttime = GetTickCount();
  10.         if((ttime - CzasZapisany[playerid]) >= 80) {
  11.             CzasZapisany[playerid] = ttime;
  12.        
  13.             // for(new playerid; playerid < MAX_PLAYERS; playerid++) {
  14.             GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
  15.             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)));
  16.             Angle[0] = ReturnPlayerAngle(playerid);
  17.             Angle[1] = GetPlayerTheoreticAngle(playerid);
  18.             Speed[0] = floatmul(Speed[1], 12);
  19.            
  20.             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) {
  21.                 if(Timer_PlayerDriftPoints[playerid] > 0) KillTimer(Timer_PlayerDriftPoints[playerid]);
  22.                 Timer_PlayerDriftPoints[playerid] = 0;
  23.                 PointsFromDrift[playerid] += floatval(floatabs(floatsub(Angle[0], Angle[1])) * 3 * (Speed[0] * 0.1)) / 10;
  24.                 Timer_PlayerDriftPoints[playerid] = SetTimerEx("LoadDrift", 3000, 0, "d", playerid);
  25.             }
  26.            
  27.             if(PointsFromDrift[playerid] > 0) {
  28.                 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"));
  29.                 UpdatePlayer3DTextLabelText(playerid, Drift3DText[playerid], -1, s);
  30.             }
  31.  
  32.             SavedPos[playerid][sX] = Position[0];
  33.             SavedPos[playerid][sY] = Position[1];
  34.             SavedPos[playerid][sZ] = Position[2];
  35.         }
  36.  
  37.         static str[128];
  38.         static Float: health;
  39.        
  40.         if(UpdateSpeed[playerid]) {
  41.             GetVehicleHealth(GetPlayerVehicleID(playerid), health);
  42.             format(str, sizeof(str), "[%s]\n%d km/h\n%.0f/1000", VehNames[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400][1],  GetPlayerSpeed(GetPlayerVehicleID(playerid)), health);
  43.             UpdatePlayer3DTextLabelText(playerid, Speed3DText[playerid], -1, str);
  44.         }
  45.         return true;
  46.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement