Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerUpdate(playerid) {
- static Float: Angle[2];
- static Float: Speed[2];
- static Float: Position[3];
- static s[96];
- static ttime;
- CzasZapisany[playerid] = 0;
- ttime = GetTickCount();
- if((ttime - CzasZapisany[playerid]) >= 80) {
- CzasZapisany[playerid] = ttime;
- // for(new playerid; playerid < MAX_PLAYERS; playerid++) {
- GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
- 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)));
- Angle[0] = ReturnPlayerAngle(playerid);
- Angle[1] = GetPlayerTheoreticAngle(playerid);
- Speed[0] = floatmul(Speed[1], 12);
- 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) {
- if(Timer_PlayerDriftPoints[playerid] > 0) KillTimer(Timer_PlayerDriftPoints[playerid]);
- Timer_PlayerDriftPoints[playerid] = 0;
- PointsFromDrift[playerid] += floatval(floatabs(floatsub(Angle[0], Angle[1])) * 3 * (Speed[0] * 0.1)) / 10;
- Timer_PlayerDriftPoints[playerid] = SetTimerEx("LoadDrift", 3000, 0, "d", playerid);
- }
- if(PointsFromDrift[playerid] > 0) {
- 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"));
- UpdatePlayer3DTextLabelText(playerid, Drift3DText[playerid], -1, s);
- }
- SavedPos[playerid][sX] = Position[0];
- SavedPos[playerid][sY] = Position[1];
- SavedPos[playerid][sZ] = Position[2];
- }
- static str[128];
- static Float: health;
- if(UpdateSpeed[playerid]) {
- GetVehicleHealth(GetPlayerVehicleID(playerid), health);
- format(str, sizeof(str), "[%s]\n%d km/h\n%.0f/1000", VehNames[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400][1], GetPlayerSpeed(GetPlayerVehicleID(playerid)), health);
- UpdatePlayer3DTextLabelText(playerid, Speed3DText[playerid], -1, str);
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement