Guest User

Untitled

a guest
Feb 9th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1.  
  2. ocmd:joinevent(playerid,params[])
  3. {
  4. switch (eventstart)
  5. {
  6. case 0: {
  7. //Mitte
  8. new vID = CreateVehicle(502,1156.4369,-897.5735,42.8511,183.1492,-1,-1,60);
  9. SetPlayerPos(playerid,1156.4369,-897.5735,42.8511);
  10. PutPlayerInVehicle(playerid,vID,0);
  11. eventstart = 2;
  12. SendClientMessage(playerid,CL_GREEEN,"Du bist dem Event beigetreten. Fahre nun an die Startlinie!");
  13. jEvent[playerid] = 1;
  14. //SetPlayerCheckpoint(playerid, , 5.0);
  15. return 1;
  16. }
  17. //Rechts
  18. case 1: {
  19. new vID = CreateVehicle(503,1152.7489,-897.8755,42.8496,183.1492,-1,-1,60);
  20. SetPlayerPos(playerid,1152.7489,-897.8755,42.8496);
  21. PutPlayerInVehicle(playerid,vID,0);
  22. eventstart = 0;
  23. SendClientMessage(playerid,CL_GREEEN,"Du bist dem Event beigetreten. Fahre nun an die Startlinie!");
  24. jEvent[playerid] = 1;
  25. return 1;
  26. }
  27. //Links
  28. case 2:{
  29. new vID = CreateVehicle(502,1162.0453,-897.6024,42.8875,183.1492,-1,-1,60);
  30. SetPlayerPos(playerid,1162.0453,-897.6024,42.8875);
  31. PutPlayerInVehicle(playerid,vID,0);
  32. eventstart = 1;
  33. SendClientMessage(playerid,CL_GREEEN,"Du bist dem Event beigetreten. Fahre nun an die Startlinie!");
  34. jEvent[playerid] = 1;
  35. return 1;
  36. }
  37. }
  38. return 1;
  39. }
  40. forward Racestart(playerid);
  41. public Racestart(playerid)
  42. {
  43. for(new i= 0; i<MAX_PLAYERS; i++)
  44. {
  45. if(jEvent[i] == 1 && LSRACE[i] == 1) continue;
  46. printf("jevent[%i] == 1 && LSRACE[%i] == 1",i,i);
  47. TogglePlayerControllable(i,0);
  48. SCMTOADMIN("Spieler im Rennen wurden unfreezed");
  49. DisablePlayerCheckpoint(i);
  50. SetPlayerCheckpoint(i,1104.4375,-949.0429,42.8388,8); //1. Checkpoint
  51. SendClientMessage(i,RED,"GO GO GO!");
  52. SendClientMessageToAll(RED,"GO GO GO! Das Rennen wurde gestartet!");
  53. LSRACE[playerid] = 1;
  54. OnPlayerEnterCheckpoint(i);
  55.  
  56. }
  57. //SetPlayerCheckpoint(playerid,1104.4375,-949.0429,42.8388,8);
  58. return 1;
  59. }
  60. ocmd:startrace(playerid,params[])
  61. {
  62. SetTimerEx("Racestart",10000,false,"");
  63. SendClientMessageToAll(CL_ORANGE,"Das Rennen startet in 10 Sekunden");
  64. for(new i=0; i<MAX_PLAYERS; i++)
  65. {
  66. if(jEvent[i] == 1) continue;
  67. TogglePlayerControllable(i,1);
  68. SetPlayerCheckpoint(i,1159.2834,-929.9013,43.23885,8); //Startlinie
  69. }
  70. return 1;
  71. }
  72. /* #define RacelinieLS 1159.2834,-929.9013,43.23885
  73. #define RacepointLS1 1104.4375,-949.0429,42.8388
  74. #define RacepointLS2 936.9182,-968.8925,38.5286
  75. #define RacePointLS3 804.7927,-1047.2712,25.1715*/
  76.  
  77.  
  78. forward Race(playerid);
  79. public Race(playerid)
  80. {
  81. if(LSRACE[playerid] == 1)
  82. {
  83. SetPlayerCheckpoint(playerid,936.4375,-968.8925,38.5286,8); //Startlinie
  84. LSRACE[playerid] = 2;
  85. }
  86. if(LSRACE[playerid] == 2)
  87. {
  88. SetPlayerCheckpoint(playerid,804.7927,-1047.2712,25.1715,8);
  89. LSRACE[playerid] = 3;
  90. }
  91. if(LSRACE[playerid] == 3)
  92. {
  93. SetPlayerCheckpoint(playerid,804.7927,-1047.2712,25.1715,8);
  94. LSRACE[playerid] = 4;
  95. }
  96. if(LSRACE[playerid] == 4)
  97. {
  98.  
  99. LSRACE[playerid] = 5;
  100. }
  101. if(LSRACE[playerid] == 5)
  102. {
  103.  
  104. LSRACE[playerid] = 6;
  105. }
  106.  
  107. //RaceLS[playerid];// = RaceLS[playerid] +1;
  108. //printf("%s = %i",SpielerName(playerid,RaceLS[playerid]);
  109. return 1;
  110. }
  111. public OnPlayerEnterCheckpoint(playerid)
  112. {
  113. /* #define RacelinieLS 1159.2834,-929.9013,43.23885
  114. #define RacepointLS1 1104.4375,-949.0429,42.8388
  115. #define RacepointLS2 936.9182,-968.8925,38.5286
  116. #define RacePointLS3 804.7927,-1047.2712,25.1715*/
  117.  
  118.  
  119. if(jEvent[playerid] == 1)
  120. {
  121. new string[256];
  122. if(LSRACE[playerid] == 1)
  123. {
  124. DisablePlayerCheckpoint(playerid);
  125. format(string,sizeof(string),"%s erreichte Checkpoint 1",SpielerName(playerid));
  126.  
  127. SetTimerEx("Race",200,false, "d", playerid);
  128. SCMTOADMIN(string);
  129. return 1;
  130. }
  131. if(LSRACE[playerid] == 2)
  132. {
  133. DisablePlayerCheckpoint(playerid);
  134.  
  135. format(string,sizeof(string),"%s erreichte Checkpoint 2",SpielerName(playerid));
  136. SetTimerEx("RaceLS",200,false, "d", playerid);
  137. SCMTOADMIN(string);
  138. return 1;
  139. }
  140.  
  141.  
  142. if(LSRACE[playerid] == 3)
  143. {
  144. //new string[128];
  145. DisablePlayerCheckpoint(playerid);
  146.  
  147. format(string,sizeof(string),"%s hat das Ziel erreicht!",SpielerName(playerid));
  148. SendClientMessageToAll(RED,string);
  149. LSRACE[playerid] = -1;
  150. return 1;
  151. }
  152. }
Advertisement
Add Comment
Please, Sign In to add comment