Martex

DD

Apr 19th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. public OnPlayerEnterRaceCheckpoint(playerid)
  2. {
  3. if(RaceStarted == 1)
  4. {
  5. if(Joined[playerid] == true)
  6. {
  7. if(CPProgess[playerid] == TotalCP -1)
  8. {
  9. new
  10. TimeStamp,
  11. TotalRaceTime,
  12. string[256],
  13. rFile[256],
  14. rTime[3],
  15. Prize[2],
  16. TempTotalTime,
  17. TempTime[3]
  18. ;
  19. Position++;
  20. TimeStamp = GetTickCount();
  21. TotalRaceTime = TimeStamp - RaceTick;
  22. ConvertTime(var, TotalRaceTime, rTime[0], rTime[1], rTime[2]);
  23. switch(Position)
  24. {
  25. case 1:
  26. {
  27. Prize[0] = (random(random(5000)) + 10000), Prize[1] = 10;
  28. pData[playerid][RaceWon]++;
  29. }
  30. case 2: Prize[0] = (random(random(4500)) + 9000), Prize[1] = 9;
  31. case 3: Prize[0] = (random(random(4000)) + 8000), Prize[1] = 8;
  32. case 4: Prize[0] = (random(random(3500)) + 7000), Prize[1] = 7;
  33. case 5: Prize[0] = (random(random(3000)) + 6000), Prize[1] = 6;
  34. case 6: Prize[0] = (random(random(2500)) + 5000), Prize[1] = 5;
  35. case 7: Prize[0] = (random(random(2000)) + 4000), Prize[1] = 4;
  36. case 8: Prize[0] = (random(random(1500)) + 3000), Prize[1] = 3;
  37. case 9: Prize[0] = (random(random(1000)) + 2000), Prize[1] = 2;
  38. default: Prize[0] = random(random(1000)), Prize[1] = 1;
  39. }
  40. format(string, sizeof(string), ">> \"%s\" has finished the race in position \"%d\".", pName(playerid), Position);
  41. SendClientMessageToAll(WHITE, string);
  42. new IRC[100+1000];
  43. format(IRC, sizeof(IRC), "0,13* %s (ID: %d) has finished the race in position %d.",GetName(playerid),playerid, Position);
  44. IRC_GroupSay(groupID, IRC_CHANNEL, IRC);
  45. format(string, sizeof(string), " - Time: \"%d:%d.%d\".", rTime[0], rTime[1], rTime[2]);
  46. SendClientMessageToAll(WHITE, string);
  47. format(string, sizeof(string), " - Prize: \"$%d and +%d Score\".", Prize[0], Prize[1]);
  48. SendClientMessageToAll(WHITE, string);
  49.  
  50. if(FinishCount <= 5)
  51. {
  52. format(rFile, sizeof(rFile), "/rRaceSystem/%s.RRACE", RaceName);
  53. format(string, sizeof(string), "BestRacerTime_%d", TimeProgress);
  54. TempTotalTime = dini_Int(rFile, string);
  55. ConvertTime(var1, TempTotalTime, TempTime[0], TempTime[1], TempTime[2]);
  56. if(TotalRaceTime <= dini_Int(rFile, string) || TempTotalTime == 0)
  57. {
  58. dini_IntSet(rFile, string, TotalRaceTime);
  59. format(string, sizeof(string), "BestRacer_%d", TimeProgress);
  60. if(TempTotalTime != 0) format(string, sizeof(string), ">> \"%s\" has broken the record of \"%s\" with \"%d\" seconds faster on the \"%d\"'st/th place!", pName(playerid), dini_Get(rFile, string), -(rTime[1] - TempTime[1]), TimeProgress+1);
  61. else format(string, sizeof(string), ">> \"%s\" has broken a new record of on the \"%d\"'st/th place!", pName(playerid), TimeProgress+1);
  62. SendClientMessageToAll(GREEN, " ");
  63. SendClientMessageToAll(GREEN, string);
  64. SendClientMessageToAll(GREEN, " ");
  65. format(string, sizeof(string), "BestRacer_%d", TimeProgress);
  66. dini_Set(rFile, string, pName(playerid));
  67. TimeProgress++;
  68. }
  69. }
  70. FinishCount++;
  71. GivePlayerMoney(playerid, Prize[0]);
  72. SetPlayerScore(playerid, GetPlayerScore(playerid) + Prize[1]);
  73. DisablePlayerRaceCheckpoint(playerid);
  74. CPProgess[playerid]++;
  75. if(FinishCount >= JoinCount) return StopRace();
  76. }
  77. else
  78. {
  79. CPProgess[playerid]++;
  80. CPCoords[CPProgess[playerid]][3]++;
  81. RacePosition[playerid] = floatround(CPCoords[CPProgess[playerid]][3], floatround_floor);
  82. SetCP(playerid, CPProgess[playerid], CPProgess[playerid]+1, TotalCP, RaceType);
  83. PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
  84. }
  85. }
  86. }
  87. return 1;
  88. }
Advertisement
Add Comment
Please, Sign In to add comment