03.01.2014, 14:46
Код:
/*===================================================================================================*\ ||===================================================================================================|| || ________ ________ ___ _ ______ ______ ________ || || \ | _____| | ____ | | \ | | | _ \ | _ \ | ____ | / || || ======== \ | |_____ | |____| | | |\ \ | | | | | | | |_| / | |____| | / ======== || || | | _____ | | ____ | | | \ \| | | | | | | _ \ | ____ | | || || ======== / ______| | | | | | | | \ \ | | |_| | | | \ \ | | | | \ ======== || || / |________| |_| |_| |_| \__| |______/ |_| \_| |_| |_| \ || || || ||===================================================================================================|| || Created on the 6th of January 2009 by =>Sandra<= || || Do NOT remove my credits!! || \*===================================================================================================*/ #include <a_samp> #include <YSI\\y_ini> #define Min_Reward 10000 #define Reward_Per_Health_Percent 100 #define Reward_Discount_Per_Second 10 #define MAX_MINUTES 6 new Float:RC[54][3] = { {-2286.6353,-1700.7102,478.4358}, {-2288.1792,-1763.1018,454.9219}, {-2353.0198,-1816.9895,432.5812}, {-2447.4729,-1719.8342,431.6024}, {-2440.2600,-1809.7311,410.2217}, {-2522.0500,-1703.0638,402.0119}, {-2523.8193,-1610.5060,398.2629}, {-2477.2080,-1476.4357,390.5564}, {-2320.7549,-1455.6995,381.5133}, {-2256.2595,-1485.9067,378.5980}, {-2211.9927,-1620.1307,379.3380}, {-2212.8423,-1716.5380,376.4465}, {-2189.1406,-1710.7034,376.0816}, {-2197.8906,-1552.8011,361.3695}, {-2274.8806,-1430.9657,355.8955}, {-2358.8079,-1402.7571,359.7164}, {-2468.7893,-1429.2543,362.4955}, {-2551.0388,-1503.3468,358.7271}, {-2575.8269,-1500.5520,358.7248}, {-2572.9800,-1462.5763,358.3174}, {-2398.5942,-1343.1970,333.0944}, {-2337.2688,-1314.2493,309.5719}, {-2345.1946,-1285.9027,308.5854}, {-2387.1357,-1283.1084,300.8869}, {-2464.4963,-1273.0569,282.9333}, {-2524.6392,-1289.1597,270.6183}, {-2574.8892,-1359.1495,265.4158}, {-2613.3279,-1361.4434,263.3748}, {-2670.3860,-1396.1407,254.2419}, {-2637.0603,-1303.4363,232.6432}, {-2614.2776,-1226.5154,208.2767}, {-2587.7229,-1170.2632,190.0163}, {-2511.2334,-1124.0493,177.0565}, {-2540.7468,-1122.5959,175.6718}, {-2610.8096,-1155.4227,170.6376}, {-2713.4504,-1271.4304,154.7756}, {-2737.7273,-1342.7054,147.0784}, {-2755.1047,-1431.3491,140.1418}, {-2780.7881,-1743.0575,141.4138}, {-2759.0439,-1860.2391,141.5795}, {-2683.6941,-1878.9551,136.3070}, {-2653.3979,-1955.6143,127.2152}, {-2608.4011,-2084.2664,131.8737}, {-2565.3149,-2071.6523,130.3119}, {-2436.0454,-2087.6812,123.7501}, {-2343.6467,-2102.0376,112.9725}, {-2217.1072,-2046.2115,119.5078}, {-2161.1846,-1985.0746,118.3621}, {-2104.4814,-1882.6589,110.2269}, {-2108.4790,-1919.6836,103.1151}, {-2141.9709,-2005.1815,95.0584}, {-2200.7427,-2082.0625,79.5675}, {-2276.6218,-2150.2297,52.0756}, {-2391.8550,-2203.0520,32.9933} }; new bool:RaceStarted; new CurrentRacer = -1; new Float:LastPos[4], LastInterior; new Racecar; new CC; new StartTickcount; new CountdownTimer; new Count; new highscoretimes[11]; new tmphighscoretimes[11]; new highscorenames[11][MAX_PLAYER_NAME]; new tmphighscorenames[11][MAX_PLAYER_NAME]; new Text:HighScoreTable[4]; new HighScoreTableString[4][128]; new IsViewingHighScoreTable[MAX_PLAYERS]; new Text:InfoBox; new InfoBoxString[128]; new InfoTimer; new Died; new ExitVehicleTimer; new TimeOutOfVehicle; new CameraTimer, Float:CamCount; new max_minutes = MAX_MINUTES; public OnFilterScriptInit() { new tmp[3]; for(new i=1; i<11; i++) { format(tmp, 5, "T%d", i); highscoretimes[i] = INI_Int("MCR-Highscores.txt",tmp); } for(new i=1; i<11; i++) { format(tmp, 5, "N%d", i); format(highscorenames[i], MAX_PLAYER_NAME, "%s", INI_String("MCR-Highscores.txt", tmp)); } InfoBox = TextDrawCreate(200.0, 350.0, " "); TextDrawUseBox(InfoBox,1); TextDrawTextSize(InfoBox, 440, 410); TextDrawBoxColor(InfoBox,0x00000066); TextDrawSetOutline(InfoBox,1); TextDrawLetterSize(InfoBox,0.5,1.2); TextDrawSetShadow(InfoBox,0); HighScoreTable[0] = TextDrawCreate(150.0,114.3," "); HighScoreTable[1] = TextDrawCreate(150.0,161.0," "); HighScoreTable[2] = TextDrawCreate(150.0,197.0," "); HighScoreTable[3] = TextDrawCreate(150.0,233.0," "); for(new i; i<4; i++) { TextDrawUseBox(HighScoreTable[i],1); TextDrawTextSize(HighScoreTable[i], 550, 410); TextDrawBoxColor(HighScoreTable[i],0x00000066); TextDrawSetOutline(HighScoreTable[i],1); TextDrawLetterSize(HighScoreTable[i],0.5,1.2); TextDrawSetShadow(HighScoreTable[i],0); } print("\n\n-------------------------------------"); print(" Mount Chiliad Race "); print(" by =>Sandra<= "); print(" loaded "); print("-------------------------------------\n\n"); return 1; } public OnFilterScriptExit() { DisablePlayerRaceCheckpoint(CurrentRacer); RemovePlayerFromVehicle(CurrentRacer); DestroyVehicle(Racecar); DestroyHighScoreTable(); TextDrawHideForAll(InfoBox); TextDrawDestroy(InfoBox); return 1; } public OnPlayerConnect(playerid) { SendClientMessage(playerid, 0x00FF00AA, "This server has a Mount Chiliad Race! Type /mcrace to join!!"); IsViewingHighScoreTable[playerid] = 0; return 1; } public OnPlayerDisconnect(playerid, reason) { if(playerid == CurrentRacer) { KillTimer(ExitVehicleTimer); FailedRace(); } return 1; } public OnPlayerDeath(playerid, killerid, reason) { if(playerid == CurrentRacer) { Died = 1; KillTimer(ExitVehicleTimer); FailedRace(); } return 1; } public OnVehicleDeath(vehicleid, killerid) { if(vehicleid == Racecar) { KillTimer(ExitVehicleTimer); FailedRace(); } return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/mcrace", cmdtext, true) == 0) { if(RaceStarted == true) { new rName[MAX_PLAYER_NAME], str[128]; GetPlayerName(CurrentRacer, rName, sizeof(rName)); format(str, 128, "Sorry, %s [ID %d] is already doing this race! Wait till he/she's finished!", rName, CurrentRacer); SendClientMessage(playerid, 0xFF0000AA, str); return 1; } RaceStarted = true; CurrentRacer = playerid; GetPlayerPos(playerid, LastPos[0], LastPos[1], LastPos[2]); GetPlayerFacingAngle(playerid, LastPos[3]); LastInterior = GetPlayerInterior(playerid); Racecar = CreateVehicle(560, -2299.7456,-1673.9592,483.3256,206.6098, 0, 0, -1); AddVehicleComponent(Racecar,1026); AddVehicleComponent(Racecar,1027); AddVehicleComponent(Racecar,1028); AddVehicleComponent(Racecar,1032); AddVehicleComponent(Racecar,1138); AddVehicleComponent(Racecar,1141); AddVehicleComponent(Racecar,1169); AddVehicleComponent(Racecar,1074); AddVehicleComponent(Racecar,1009); // 2x Nitro SetPlayerInterior(playerid, 0); PutPlayerInVehicle(playerid, Racecar, 0); CC = 0; SetPlayerRaceCheckpoint(playerid, 0, RC[CC][0], RC[CC][1], RC[CC][2], RC[CC+1][0], RC[CC+1][1], RC[CC+1][2], 3); SetPlayerCameraPos(playerid, -2308.3823,-1705.7048,490.4961); SetPlayerCameraLookAt(playerid, -2295.3433,-1722,475.4256); CameraTimer = SetTimer("MoveCamera", 25, 1); CamCount = 1722.0; TogglePlayerControllable(playerid, 0); CountdownTimer = SetTimerEx("Countdown", 1000, 1, "i", playerid); Count = 5; GameTextForPlayer(playerid, "~r~Get Ready! ~n~~n~~b~5", 1500, 3); return 1; } if (strcmp("/showhighscore", cmdtext, true) == 0) { if(IsViewingHighScoreTable[playerid] == 0) { SendClientMessage(playerid, 0x00FF00AA, "Type /hidehighscore to hide this highscore-table"); ShowHighScoreTable(playerid, 999); } return 1; } if (strcmp("/hidehighscore", cmdtext, true) == 0) { if(IsViewingHighScoreTable[playerid] == 1) { HideHighScoreTable(playerid); } return 1; } if (strcmp("/exitrace", cmdtext, true) == 0) { if(playerid == CurrentRacer) { FailedRace(); } return 1; } return 0; } public OnPlayerStateChange(playerid, newstate, oldstate) { if(playerid == CurrentRacer) { if(oldstate == PLAYER_STATE_DRIVER) { GameTextForPlayer(playerid, "~r~You have ~y~10 ~r~seconds ~n~to get back~n~in your car!!", 1500, 3); TimeOutOfVehicle = 10; ExitVehicleTimer = SetTimer("OutOfVehicle", 1000, 1); } if(newstate == PLAYER_STATE_DRIVER) { GameTextForPlayer(playerid, " ", 10, 3); KillTimer(ExitVehicleTimer); } } } forward OutOfVehicle(); public OutOfVehicle() { TimeOutOfVehicle--; new str[128]; format(str, 128, "~r~You have ~y~%d ~r~seconds ~n~to get back~n~in your car!!", TimeOutOfVehicle); GameTextForPlayer(CurrentRacer, str, 1500, 3); if(TimeOutOfVehicle == 0) { FailedRace(); KillTimer(ExitVehicleTimer); } } public OnPlayerEnterRaceCheckpoint(playerid) { if(CC < 52) //Show Normal Checkpoints { CC++; SetPlayerRaceCheckpoint(playerid, 0, RC[CC][0], RC[CC][1], RC[CC][2], RC[CC+1][0], RC[CC+1][1], RC[CC+1][2], 3); } else if(CC == 52) //Show Finish Checkpoint { CC++; SetPlayerRaceCheckpoint(playerid, 1, RC[CC][0], RC[CC][1], RC[CC][2], RC[CC][0], RC[CC][1], RC[CC][2], 4); } else if(CC == 53) //Player Is In Last Checkpoint! { DisablePlayerRaceCheckpoint(playerid); WinnerRace(playerid); GameTextForPlayer(CurrentRacer, "~n~~n~~n~~n~~n~~y~Winner!!", 3500, 3); } return 1; } public OnPlayerLeaveRaceCheckpoint(playerid) { return 1; } forward Countdown(playerid); public Countdown(playerid) { if(Count > 1) { Count--; new str[30]; format(str, sizeof(str), "~r~Get Ready! ~n~~n~~b~%d", Count); GameTextForPlayer(playerid, str, 3000, 3); } else { KillTimer(CountdownTimer); GameTextForPlayer(playerid, "~r~Go!", 1500, 3); StartTickcount = GetTickCount(); TogglePlayerControllable(playerid, 1); InfoTimer = SetTimer("UpdateInfoBox", 100, 1); } } WinnerRace(playerid) { new Time = GetTickCount()-StartTickcount; new Float:Health; GetVehicleHealth(Racecar, Health); Health = (Health/10); new Min, Sec, Mil; ConvertTime(Time, Min, Sec, Mil); new Reward = (floatround(Min_Reward + (Health*Reward_Per_Health_Percent)) - ((Min*60+Sec)*Reward_Discount_Per_Second)); GivePlayerMoney(playerid, Reward); new rName[MAX_PLAYER_NAME], str[128]; GetPlayerName(CurrentRacer, rName, sizeof(rName)); if(Time < highscoretimes[1]) { format(str, 128, "%s has finished the Mount Chiliad Race !!. He/She won $%d!!", rName, Reward); SendClientMessageToAll(0x7FFF00AA, str); format(str, 128, "%s broke a new record: %02d:%02d:%03d!!", rName, Min, Sec, Mil); SendClientMessageToAll(0x7FFF00AA, str); } else { format(str, 128, "%s has finished the Mount Chiliad Race in %02d:%02d:%03d!!. He/She won $%d!!", rName, Min, Sec, Mil, Reward); SendClientMessageToAll(0x7FFF00AA, str); } GameTextForPlayer(CurrentRacer, "~y~Winner!!", 3500, 3); TogglePlayerControllable(playerid, 0); SetScoreInHighscoreTable(playerid, Time); DisablePlayerRaceCheckpoint(CurrentRacer); KillTimer(InfoTimer); } FailedRace() { GameTextForPlayer(CurrentRacer, "~r~Game Over", 3500, 3); DisablePlayerRaceCheckpoint(CurrentRacer); new rName[MAX_PLAYER_NAME], str[128]; GetPlayerName(CurrentRacer, rName, sizeof(rName)); format(str, 128, "%s has failed the Mount Chiliad Race. If you want to try, typ /mcrace", rName); SendClientMessageToAll(0xFFA500AA, str); KillTimer(InfoTimer); if(IsPlayerConnected(CurrentRacer)) { SetTimerEx("ResetRace", 5000, 0, "i", CurrentRacer); } else { ResetRace(CurrentRacer); } } forward ResetRace(playerid); public ResetRace(playerid) { if(Died == 0) { SetPlayerInterior(CurrentRacer, LastInterior); SetPlayerPos(CurrentRacer, LastPos[0], LastPos[1], LastPos[2]); SetPlayerFacingAngle(CurrentRacer, LastPos[3]); } Died = 0; TogglePlayerControllable(playerid, 1); RemovePlayerFromVehicle(CurrentRacer); SetCameraBehindPlayer(CurrentRacer); DestroyVehicle(Racecar); DisablePlayerRaceCheckpoint(CurrentRacer); Racecar = -1; RaceStarted = false; CurrentRacer = -1; GameTextForPlayer(playerid, " ", 10, 3); PlayerPlaySound(playerid, 1188, -1633.0308,-2240.3904,37.3984); HideHighScoreTable(playerid); TextDrawHideForPlayer(playerid, InfoBox); } stock SetScoreInHighscoreTable(playerid, time) { new Position = 999; for(new i=1; i<11; i++) { if(time < highscoretimes[i]) { Position = i; break; } } if(Position != 999 && Position != 10) { for(new j=Position; j<10; j++) { tmphighscoretimes[j+1] = highscoretimes[j]; format(tmphighscorenames[j+1], 24, "%s",highscorenames[j]); } for(new j=Position; j<10; j++) { highscoretimes[j+1] = tmphighscoretimes[j+1]; format(highscorenames[j+1], 24, "%s", tmphighscorenames[j+1]); } highscoretimes[Position] = time; GetPlayerName(playerid, highscorenames[Position], 24); WriteScoresToFile(); } if(Position == 10) { highscoretimes[10] = time; GetPlayerName(playerid, highscorenames[10], 24); WriteScoresToFile(); } ShowHighScoreTable(playerid, Position); PlayerPlaySound(playerid, 1187, -1633.0308,-2240.3904,37.3984); SetTimerEx("ResetRace", 10000, 0, "i", playerid); } WriteScoresToFile() { new tmp[5]; for(new i=1; i<11; i++) { format(tmp, 5, "T%d", i); dini_IntSet("MCR-Highscores.txt", tmp, highscoretimes[i]); } for(new i=1; i<11; i++) { format(tmp, 5, "N%d", i); dini_Set("MCR-Highscores.txt", tmp, highscorenames[i]); } } ShowHighScoreTable(playerid, Position) { new mt[10], sc[10], ms[10]; switch(Position) { case 1: { ConvertTime(highscoretimes[1], mt[0], sc[0], ms[0]); ConvertTime(highscoretimes[2], mt[1], sc[1], ms[1]); format(HighScoreTableString[0], 128, "~y~ Highscores:~n~~r~# %5s %10s~n~~y~01: %d:%02d:%03d - %s~n~~g~02: %d:%02d:%03d - %s", "Time", "Name", mt[0], sc[0], ms[0], highscorenames[1], mt[1], sc[1], ms[1], highscorenames[2]); ConvertTime(highscoretimes[3], mt[2], sc[2], ms[2]); ConvertTime(highscoretimes[4], mt[3], sc[3], ms[3]); ConvertTime(highscoretimes[5], mt[4], sc[4], ms[4]); format(HighScoreTableString[1], 128, "~g~03: %d:%02d:%03d - %s~n~~g~04: %d:%02d:%03d - %s~n~~g~05: %d:%02d:%03d - %s", mt[2], sc[2], ms[2], highscorenames[3], mt[3], sc[3], ms[3], highscorenames[4], mt[4], sc[4], ms[4], highscorenames[5]); ConvertTime(highscoretimes[6], mt[5], sc[5], ms[5]); ConvertTime(highscoretimes[7], mt[6], sc[6], ms[6]); ConvertTime(highscoretimes[8], mt[7], sc[7], ms[7]); format(HighScoreTableString[2], 128, "~g~06: %d:%02d:%03d - %s~n~~g~07: %d:%02d:%03d - %s~n~~g~08: %d:%02d:%03d - %s", mt[5], sc[5], ms[5], highscorenames[6], mt[6], sc[6], ms[6], highscorenames[7], mt[7], sc[7], ms[7], highscorenames[8]); ConvertTime(highscoretimes[9], mt[8], sc[8], ms[8]); ConvertTime(highscoretimes[10], mt[9], sc[9], ms[9]); format(HighScoreTableString[3], 128, "~g~09: %d:%02d:%03d - %s~n~~g~10: %d:%02d:%03d - %s", mt[8], sc[8], ms[8], highscorenames[9], mt[9], sc[9], ms[9], highscorenames[10]); } case 2: { ConvertTime(highscoretimes[1], mt[0], sc[0], ms[0]); ConvertTime(highscoretimes[2], mt[1], sc[1], ms[1]); format(HighScoreTableString[0], 128, "~y~ Highscores:~n~~r~# %5s %10s~n~~g~01: %d:%02d:%03d - %s~n~~y~02: %d:%02d:%03d - %s", "Time", "Name", mt[0], sc[0], ms[0], highscorenames[1], mt[1], sc[1], ms[1], highscorenames[2]); ConvertTime(highscoretimes[3], mt[2], sc[2], ms[2]); ConvertTime(highscoretimes[4], mt[3], sc[3], ms[3]); ConvertTime(highscoretimes[5], mt[4], sc[4], ms[4]); format(HighScoreTableString[1], 128, "~g~03: %d:%02d:%03d - %s~n~~g~04: %d:%02d:%03d - %s~n~~g~05: %d:%02d:%03d - %s", mt[2], sc[2], ms[2], highscorenames[3], mt[3], sc[3], ms[3], highscorenames[4], mt[4], sc[4], ms[4], highscorenames[5]); ConvertTime(highscoretimes[6], mt[5], sc[5], ms[5]); ConvertTime(highscoretimes[7], mt[6], sc[6], ms[6]); ConvertTime(highscoretimes[8], mt[7], sc[7], ms[7]); format(HighScoreTableString[2], 128, "~g~06: %d:%02d:%03d - %s~n~~g~07: %d:%02d:%03d - %s~n~~g~08: %d:%02d:%03d - %s", mt[5], sc[5], ms[5], highscorenames[6], mt[6], sc[6], ms[6], highscorenames[7], mt[7], sc[7], ms[7], highscorenames[8]); ConvertTime(highscoretimes[9], mt[8], sc[8], ms[8]); ConvertTime(highscoretimes[10], mt[9], sc[9], ms[9]); format(HighScoreTableString[3], 128, "~g~09: %d:%02d:%03d - %s~n~~g~10: %d:%02d:%03d - %s", mt[8], sc[8], ms[8], highscorenames[9], mt[9], sc[9], ms[9], highscorenames[10]); } case 3: { ConvertTime(highscoretimes[1], mt[0], sc[0], ms[0]); ConvertTime(highscoretimes[2], mt[1], sc[1], ms[1]); format(HighScoreTableString[0], 128, "~y~ Highscores:~n~~r~# %5s %10s~n~~g~01: %d:%02d:%03d - %s~n~~g~02: %d:%02d:%03d - %s", "Time", "Name", mt[0], sc[0], ms[0], highscorenames[1], mt[1], sc[1], ms[1], highscorenames[2]); ConvertTime(highscoretimes[3], mt[2], sc[2], ms[2]); ConvertTime(highscoretimes[4], mt[3], sc[3], ms[3]); ConvertTime(highscoretimes[5], mt[4], sc[4], ms[4]); format(HighScoreTableString[1], 128, "~y~03: %d:%02d:%03d - %s~n~~g~04: %d:%02d:%03d - %s~n~~g~05: %d:%02d:%03d - %s", mt[2], sc[2], ms[2], highscorenames[3], mt[3], sc[3], ms[3], highscorenames[4], mt[4], sc[4], ms[4], highscorenames[5]); ConvertTime(highscoretimes[6], mt[5], sc[5], ms[5]); ConvertTime(highscoretimes[7], mt[6], sc[6], ms[6]); ConvertTime(highscoretimes[8], mt[7], sc[7], ms[7]); format(HighScoreTableString[2], 128, "~g~06: %d:%02d:%03d - %s~n~~g~07: %d:%02d:%03d - %s~n~~g~08: %d:%02d:%03d - %s", mt[5], sc[5], ms[5], highscorenames[6], mt[6], sc[6], ms[6], highscorenames[7], mt[7], sc[7], ms[7], highscorenames[8]); ConvertTime(highscoretimes[9], mt[8], sc[8], ms[8]); ConvertTime(highscoretimes[10], mt[9], sc[9], ms[9]); format(HighScoreTableString[3], 128, "~g~09: %d:%02d:%03d - %s~n~~g~10: %d:%02d:%03d - %s", mt[8], sc[8], ms[8], highscorenames[9], mt[9], sc[9], ms[9], highscorenames[10]); } case 4: { ConvertTime(highscoretimes[1], mt[0], sc[0], ms[0]); ConvertTime(highscoretimes[2], mt[1], sc[1], ms[1]); format(HighScoreTableString[0], 128, "~y~ Highscores:~n~~r~# %5s %10s~n~~g~01: %d:%02d:%03d - %s~n~~g~02: %d:%02d:%03d - %s", "Time", "Name", mt[0], sc[0], ms[0], highscorenames[1], mt[1], sc[1], ms[1], highscorenames[2]); ConvertTime(highscoretimes[3], mt[2], sc[2], ms[2]); ConvertTime(highscoretimes[4], mt[3], sc[3], ms[3]); ConvertTime(highscoretimes[5], mt[4], sc[4], ms[4]); format(HighScoreTableString[1], 128, "~g~03: %d:%02d:%03d - %s~n~~y~04: %d:%02d:%03d - %s~n~~g~05: %d:%02d:%03d - %s", mt[2], sc[2], ms[2], highscorenames[3], mt[3], sc[3], ms[3], highscorenames[4], mt[4], sc[4], ms[4], highscorenames[5]); ConvertTime(highscoretimes[6], mt[5], sc[5], ms[5]); ConvertTime(highscoretimes[7], mt[6], sc[6], ms[6]); ConvertTime(highscoretimes[8], mt[7], sc[7], ms[7]); format(HighScoreTableString[2], 128, "~g~06: %d:%02d:%03d - %s~n~~g~07: %d:%02d:%03d - %s~n~~g~08: %d:%02d:%03d - %s", mt[5], sc[5], ms[5], highscorenames[6], mt[6], sc[6], ms[6], highscorenames[7], mt[7], sc[7], ms[7], highscorenames[8]); ConvertTime(highscoretimes[9], mt[8], sc[8], ms[8]); ConvertTime(highscoretimes[10], mt[9], sc[9], ms[9]); format(HighScoreTableString[3], 128, "~g~09: %d:%02d:%03d - %s~n~~g~10: %d:%02d:%03d - %s", mt[8], sc[8], ms[8], highscorenames[9], mt[9], sc[9], ms[9], highscorenames[10]); } case 5: { ConvertTime(highscoretimes[1], mt[0], sc[0], ms[0]); ConvertTime(highscoretimes[2], mt[1], sc[1], ms[1]); format(HighScoreTableString[0], 128, "~y~ Highscores:~n~~r~# %5s %10s~n~~g~01: %d:%02d:%03d - %s~n~~g~02: %d:%02d:%03d - %s", "Time", "Name", mt[0], sc[0], ms[0], highscorenames[1], mt[1], sc[1], ms[1], highscorenames[2]); ConvertTime(highscoretimes[3], mt[2], sc[2], ms[2]); ConvertTime(highscoretimes[4], mt[3], sc[3], ms[3]); ConvertTime(highscoretimes[5], mt[4], sc[4], ms[4]); format(HighScoreTableString[1], 128, "~g~03: %d:%02d:%03d - %s~n~~g~04: %d:%02d:%03d - %s~n~~y~05: %d:%02d:%03d - %s", mt[2], sc[2], ms[2], highscorenames[3], mt[3], sc[3], ms[3], highscorenames[4], mt[4], sc[4], ms[4], highscorenames[5]); ConvertTime(highscoretimes[6], mt[5], sc[5], ms[5]); ConvertTime(highscoretimes[7], mt[6], sc[6], ms[6]); ConvertTime(highscoretimes[8], mt[7], sc[7], ms[7]); format(HighScoreTableString[2], 128, "~g~06: %d:%02d:%03d - %s~n~~g~07: %d:%02d:%03d - %s~n~~g~08: %d:%02d:%03d - %s", mt[5], sc[5], ms[5], highscorenames[6], mt[6], sc[6], ms[6], highscorenames[7], mt[7], sc[7], ms[7], highscorenames[8]); ConvertTime(highscoretimes[9], mt[8], sc[8], ms[8]); ConvertTime(highscoretimes[10], mt[9], sc[9], ms[9]); format(HighScoreTableString[3], 128, "~g~09: %d:%02d:%03d - %s~n~~g~10: %d:%02d:%03d - %s", mt[8], sc[8], ms[8], highscorenames[9], mt[9], sc[9], ms[9], highscorenames[10]); } case 6: { ConvertTime(highscoretimes[1], mt[0], sc[0], ms[0]); ConvertTime(highscoretimes[2], mt[1], sc[1], ms[1]); format(HighScoreTableString[0], 128, "~y~ Highscores:~n~~r~# %5s %10s~n~~g~01: %d:%02d:%03d - %s~n~~g~02: %d:%02d:%03d - %s", "Time", "Name", mt[0], sc[0], ms[0], highscorenames[1], mt[1], sc[1], ms[1], highscorenames[2]); ConvertTime(highscoretimes[3], mt[2], sc[2], ms[2]); ConvertTime(highscoretimes[4], mt[3], sc[3], ms[3]); ConvertTime(highscoretimes[5], mt[4], sc[4], ms[4]); format(HighScoreTableString[1], 128, "~g~03: %d:%02d:%03d - %s~n~~g~04: %d:%02d:%03d - %s~n~~g~05: %d:%02d:%03d - %s", mt[2], sc[2], ms[2], highscorenames[3], mt[3], sc[3], ms[3], highscorenames[4], mt[4], sc[4], ms[4], highscorenames[5]); ConvertTime(highscoretimes[6], mt[5], sc[5], ms[5]); ConvertTime(highscoretimes[7], mt[6], sc[6], ms[6]); ConvertTime(highscoretimes[8], mt[7], sc[7], ms[7]); format(HighScoreTableString[2], 128, "~y~06: %d:%02d:%03d - %s~n~~g~07: %d:%02d:%03d - %s~n~~g~08: %d:%02d:%03d - %s", mt[5], sc[5], ms[5], highscorenames[6], mt[6], sc[6], ms[6], highscorenames[7], mt[7], sc[7], ms[7], highscorenames[8]); ConvertTime(highscoretimes[9], mt[8], sc[8], ms[8]); ConvertTime(highscoretimes[10], mt[9], sc[9], ms[9]); format(HighScoreTableString[3], 128, "~g~09: %d:%02d:%03d - %s~n~~g~10: %d:%02d:%03d - %s", mt[8], sc[8], ms[8], highscorenames[9], mt[9], sc[9], ms[9], highscorenames[10]); } case 7: { ConvertTime(highscoretimes[1], mt[0], sc[0], ms[0]); ConvertTime(highscoretimes[2], mt[1], sc[1], ms[1]); format(HighScoreTableString[0], 128, "~y~ Highscores:~n~~r~# %5s %10s~n~~g~01: %d:%02d:%03d - %s~n~~g~02: %d:%02d:%03d - %s", "Time", "Name", mt[0], sc[0], ms[0], highscorenames[1], mt[1], sc[1], ms[1], highscorenames[2]); ConvertTime(highscoretimes[3], mt[2], sc[2], ms[2]); ConvertTime(highscoretimes[4], mt[3], sc[3], ms[3]); ConvertTime(highscoretimes[5], mt[4], sc[4], ms[4]); format(HighScoreTableString[1], 128, "~g~03: %d:%02d:%03d - %s~n~~g~04: %d:%02d:%03d - %s~n~~g~05: %d:%02d:%03d - %s", mt[2], sc[2], ms[2], highscorenames[3], mt[3], sc[3], ms[3], highscorenames[4], mt[4], sc[4], ms[4], highscorenames[5]); ConvertTime(highscoretimes[6], mt[5], sc[5], ms[5]); ConvertTime(highscoretimes[7], mt[6], sc[6], ms[6]); ConvertTime(highscoretimes[8], mt[7], sc[7], ms[7]); format(HighScoreTableString[2], 128, "~g~06: %d:%02d:%03d - %s~n~~y~07: %d:%02d:%03d - %s~n~~g~08: %d:%02d:%03d - %s", mt[5], sc[5], ms[5], highscorenames[6], mt[6], sc[6], ms[6], highscorenames[7], mt[7], sc[7], ms[7], highscorenames[8]); ConvertTime(highscoretimes[9], mt[8], sc[8], ms[8]); ConvertTime(highscoretimes[10], mt[9], sc[9], ms[9]); format(HighScoreTableString[3], 128, "~g~09: %d:%02d:%03d - %s~n~~g~10: %d:%02d:%03d - %s", mt[8], sc[8], ms[8], highscorenames[9], mt[9], sc[9], ms[9], highscorenames[10]); } case 8: { ConvertTime(highscoretimes[1], mt[0], sc[0], ms[0]); ConvertTime(highscoretimes[2], mt[1], sc[1], ms[1]); format(HighScoreTableString[0], 128, "~y~ Highscores:~n~~r~# %5s %10s~n~~g~01: %d:%02d:%03d - %s~n~~g~02: %d:%02d:%03d - %s", "Time", "Name", mt[0], sc[0], ms[0], highscorenames[1], mt[1], sc[1], ms[1], highscorenames[2]); ConvertTime(highscoretimes[3], mt[2], sc[2], ms[2]); ConvertTime(highscoretimes[4], mt[3], sc[3], ms[3]); ConvertTime(highscoretimes[5], mt[4], sc[4], ms[4]); format(HighScoreTableString[1], 128, "~g~03: %d:%02d:%03d - %s~n~~g~04: %d:%02d:%03d - %s~n~~g~05: %d:%02d:%03d - %s", mt[2], sc[2], ms[2], highscorenames[3], mt[3], sc[3], ms[3], highscorenames[4], mt[4], sc[4], ms[4], highscorenames[5]); ConvertTime(highscoretimes[6], mt[5], sc[5], ms[5]); ConvertTime(highscoretimes[7], mt[6], sc[6], ms[6]); ConvertTime(highscoretimes[8], mt[7], sc[7], ms[7]); format(HighScoreTableString[2], 128, "~g~06: %d:%02d:%03d - %s~n~~g~07: %d:%02d:%03d - %s~n~~y~08: %d:%02d:%03d - %s", mt[5], sc[5], ms[5], highscorenames[6], mt[6], sc[6], ms[6], highscorenames[7], mt[7], sc[7], ms[7], highscorenames[8]); ConvertTime(highscoretimes[9], mt[8], sc[8], ms[8]); ConvertTime(highscoretimes[10], mt[9], sc[9], ms[9]); format(HighScoreTableString[3], 128, "~g~09: %d:%02d:%03d - %s~n~~g~10: %d:%02d:%03d - %s", mt[8], sc[8], ms[8], highscorenames[9], mt[9], sc[9], ms[9], highscorenames[10]); } case 9: { ConvertTime(highscoretimes[1], mt[0], sc[0], ms[0]); ConvertTime(highscoretimes[2], mt[1], sc[1], ms[1]); format(HighScoreTableString[0], 128, "~y~ Highscores:~n~~r~# %5s %10s~n~~g~01: %d:%02d:%03d - %s~n~~g~02: %d:%02d:%03d - %s", "Time", "Name", mt[0], sc[0], ms[0], highscorenames[1], mt[1], sc[1], ms[1], highscorenames[2]); ConvertTime(highscoretimes[3], mt[2], sc[2], ms[2]); ConvertTime(highscoretimes[4], mt[3], sc[3], ms[3]); ConvertTime(highscoretimes[5], mt[4], sc[4], ms[4]); format(HighScoreTableString[1], 128, "~g~03: %d:%02d:%03d - %s~n~~g~04: %d:%02d:%03d - %s~n~~g~05: %d:%02d:%03d - %s", mt[2], sc[2], ms[2], highscorenames[3], mt[3], sc[3], ms[3], highscorenames[4], mt[4], sc[4], ms[4], highscorenames[5]); ConvertTime(highscoretimes[6], mt[5], sc[5], ms[5]); ConvertTime(highscoretimes[7], mt[6], sc[6], ms[6]); ConvertTime(highscoretimes[8], mt[7], sc[7], ms[7]); format(HighScoreTableString[2], 128, "~g~06: %d:%02d:%03d - %s~n~~g~07: %d:%02d:%03d - %s~n~~g~08: %d:%02d:%03d - %s", mt[5], sc[5], ms[5], highscorenames[6], mt[6], sc[6], ms[6], highscorenames[7], mt[7], sc[7], ms[7], highscorenames[8]); ConvertTime(highscoretimes[9], mt[8], sc[8], ms[8]); ConvertTime(highscoretimes[10], mt[9], sc[9], ms[9]); format(HighScoreTableString[3], 128, "~y~09: %d:%02d:%03d - %s~n~~g~10: %d:%02d:%03d - %s", mt[8], sc[8], ms[8], highscorenames[9], mt[9], sc[9], ms[9], highscorenames[10]); } case 10: { ConvertTime(highscoretimes[1], mt[0], sc[0], ms[0]); ConvertTime(highscoretimes[2], mt[1], sc[1], ms[1]); format(HighScoreTableString[0], 128, "~y~ Highscores:~n~~r~# %5s %10s~n~~g~01: %d:%02d:%03d - %s~n~~g~02: %d:%02d:%03d - %s", "Time", "Name", mt[0], sc[0], ms[0], highscorenames[1], mt[1], sc[1], ms[1], highscorenames[2]); ConvertTime(highscoretimes[3], mt[2], sc[2], ms[2]); ConvertTime(highscoretimes[4], mt[3], sc[3], ms[3]); ConvertTime(highscoretimes[5], mt[4], sc[4], ms[4]); format(HighScoreTableString[1], 128, "~g~03: %d:%02d:%03d - %s~n~~g~04: %d:%02d:%03d - %s~n~~g~05: %d:%02d:%03d - %s", mt[2], sc[2], ms[2], highscorenames[3], mt[3], sc[3], ms[3], highscorenames[4], mt[4], sc[4], ms[4], highscorenames[5]); ConvertTime(highscoretimes[6], mt[5], sc[5], ms[5]); ConvertTime(highscoretimes[7], mt[6], sc[6], ms[6]); ConvertTime(highscoretimes[8], mt[7], sc[7], ms[7]); format(HighScoreTableString[2], 128, "~g~06: %d:%02d:%03d - %s~n~~g~07: %d:%02d:%03d - %s~n~~g~08: %d:%02d:%03d - %s", mt[5], sc[5], ms[5], highscorenames[6], mt[6], sc[6], ms[6], highscorenames[7], mt[7], sc[7], ms[7], highscorenames[8]); ConvertTime(highscoretimes[9], mt[8], sc[8], ms[8]); ConvertTime(highscoretimes[10], mt[9], sc[9], ms[9]); format(HighScoreTableString[3], 128, "~g~09: %d:%02d:%03d - %s~n~~y~10: %d:%02d:%03d - %s", mt[8], sc[8], ms[8], highscorenames[9], mt[9], sc[9], ms[9], highscorenames[10]); } case 999: { ConvertTime(highscoretimes[1], mt[0], sc[0], ms[0]); ConvertTime(highscoretimes[2], mt[1], sc[1], ms[1]); format(HighScoreTableString[0], 128, "~y~ Highscores:~n~~r~# %5s %10s~n~~g~01: %d:%02d:%03d - %s~n~~g~02: %d:%02d:%03d - %s", "Time", "Name", mt[0], sc[0], ms[0], highscorenames[1], mt[1], sc[1], ms[1], highscorenames[2]); ConvertTime(highscoretimes[3], mt[2], sc[2], ms[2]); ConvertTime(highscoretimes[4], mt[3], sc[3], ms[3]); ConvertTime(highscoretimes[5], mt[4], sc[4], ms[4]); format(HighScoreTableString[1], 128, "~g~03: %d:%02d:%03d - %s~n~~g~04: %d:%02d:%03d - %s~n~~g~05: %d:%02d:%03d - %s", mt[2], sc[2], ms[2], highscorenames[3], mt[3], sc[3], ms[3], highscorenames[4], mt[4], sc[4], ms[4], highscorenames[5]); ConvertTime(highscoretimes[6], mt[5], sc[5], ms[5]); ConvertTime(highscoretimes[7], mt[6], sc[6], ms[6]); ConvertTime(highscoretimes[8], mt[7], sc[7], ms[7]); format(HighScoreTableString[2], 128, "~g~06: %d:%02d:%03d - %s~n~~g~07: %d:%02d:%03d - %s~n~~g~08: %d:%02d:%03d - %s", mt[5], sc[5], ms[5], highscorenames[6], mt[6], sc[6], ms[6], highscorenames[7], mt[7], sc[7], ms[7], highscorenames[8]); ConvertTime(highscoretimes[9], mt[8], sc[8], ms[8]); ConvertTime(highscoretimes[10], mt[9], sc[9], ms[9]); format(HighScoreTableString[3], 128, "~g~09: %d:%02d:%03d - %s~n~~g~10: %d:%02d:%03d - %s", mt[8], sc[8], ms[8], highscorenames[9], mt[9], sc[9], ms[9], highscorenames[10]); } } for(new i; i<4; i++) { TextDrawSetString(HighScoreTable[i], HighScoreTableString[i]); TextDrawShowForPlayer(playerid, HighScoreTable[i]); IsViewingHighScoreTable[playerid] = 1; } } HideHighScoreTable(playerid) { for(new i; i<4; i++) { TextDrawHideForPlayer(playerid, HighScoreTable[i]); IsViewingHighScoreTable[playerid] = 0; } } DestroyHighScoreTable() { for(new i; i<4; i++) { TextDrawHideForAll(HighScoreTable[i]); TextDrawDestroy(HighScoreTable[i]); } } forward UpdateInfoBox(); public UpdateInfoBox() { new Reward, Float:Health; GetVehicleHealth(Racecar, Health); Health = (Health/10); new Time = GetTickCount()-StartTickcount; new Min, Sec, Mil; ConvertTime(Time, Min, Sec, Mil); Reward = (floatround(Min_Reward + (Health*Reward_Per_Health_Percent)) - (Min*60+Sec*Reward_Discount_Per_Second)); format(InfoBoxString, 128, "~r~Checkpoint: ~y~%d/54~n~~r~Time Elapsed: ~y~%01d:%02d:%02d~n~~r~CarHealth: ~y~%.1f~n~~r~Estimated Reward: ~y~$%d", CC, Min, Sec, Mil, Health, Reward); TextDrawHideForPlayer(CurrentRacer, InfoBox); TextDrawSetString(InfoBox, InfoBoxString); TextDrawShowForPlayer(CurrentRacer, InfoBox); if(Min == max_minutes-1 && Sec == 0) { GameTextForPlayer(CurrentRacer, "~r~1 minute left!!", 2000, 3); } if(Min == max_minutes-1 && Sec == 50) { GameTextForPlayer(CurrentRacer, "~r~10 seconds left!!", 1500, 3); } if(Min == max_minutes) { FailedRace(); } } forward MoveCamera(playerid); public MoveCamera(playerid) { CamCount = CamCount- 0.35; SetPlayerCameraLookAt(CurrentRacer, -2295.3433,-CamCount,475.4256); if(CamCount < 1670.0) { KillTimer(CameraTimer); SetTimer("CBP", 1000, 0); } } forward CBP(); public CBP() { SetCameraBehindPlayer(CurrentRacer); } ConvertTime(tm, &minutes, &seconds, &milliseconds) { for(new i; i<1000; i++) { if(tm >= 1000) { tm = tm-1000; seconds++; if(seconds == 60) { seconds = 0; minutes++; } } else { milliseconds = tm; break; } } }