Advertisement
Seregamil

CTF System

May 9th, 2013
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 KB | None | 0 0
  1. /*
  2.  
  3. CTF round for Tactics v0.5 BETA
  4.  
  5. started = 2 - CTF
  6.  
  7.  
  8. file setting's
  9.  
  10. SpawnT1 = position
  11. SpawnT2 = position
  12. Interior = interior
  13. FlagPos = position
  14.  
  15.  
  16. */
  17. #include <a_samp>
  18.  
  19. main()
  20. {
  21. print("\n----------------------------------");
  22. print(" Blank Gamemode by your name here");
  23. print("----------------------------------\n");
  24. }
  25.  
  26. #define MAX_CTF 30
  27.  
  28. enum cl
  29. {
  30. Float:apos[3],
  31. Float:dpos[3],
  32. inter,
  33. Float:fpos[3],
  34. flag,
  35. ach,
  36. dch
  37. };
  38. new cload[cl];
  39.  
  40. /*
  41.  
  42. PVar's:
  43.  
  44. TM = Team
  45. inround = inround
  46. used
  47.  
  48. */
  49.  
  50. public OnGameModeInit()
  51. {
  52. return 1;
  53. }
  54.  
  55. public OnGameModeExit()
  56. {
  57. endCTF();
  58. return 1;
  59. }
  60.  
  61. public OnPlayerDisconnect(playerid, reason)
  62. {
  63. //if(started == 2)
  64. //{
  65. if(GetPVarInt(playerid,"used") == 1)
  66. {
  67. RemovePlayerAttachedObject(playerid,0);
  68. new Float:sad[3];
  69. GetPlayerPos(playerid,sad[0],sad[1],sad[2]);
  70. cload[flag] = CreatePickup(1277,23,sad[0],sad[1],sad[2]);//spawn flag
  71. DestroyPickup(cload[ach]);
  72. DestroyPickup(cload[dch]);
  73. SetPVarInt(playerid,"used",0);
  74. }
  75. //}
  76. return 1;
  77. }
  78.  
  79. public OnPlayerSpawn(playerid)
  80. {
  81. //if(started == 2)
  82. //{
  83. SetPVarInt(playerid,"inround",1);
  84. switch(GetPVarInt(playerid,"TM"))
  85. {
  86. case 1:{//att
  87. SetPlayerPos(playerid,cload[apos][0],cload[apos][1],cload[apos][2]);
  88. SetPlayerInterior(playerid,cload[inter]);
  89. }
  90. case 2:{//def
  91. SetPlayerPos(playerid,cload[dpos][0],cload[dpos][1],cload[dpos][2]);
  92. SetPlayerInterior(playerid,cload[inter]);
  93. }
  94. }
  95. //}
  96. return 1;
  97. }
  98.  
  99. public OnPlayerDeath(playerid, killerid, reason)
  100. {
  101. //if(started == 2)
  102. //{
  103. if(GetPVarInt(playerid,"used") == 1)
  104. {
  105. RemovePlayerAttachedObject(playerid,0);
  106. new Float:sad[3];
  107. GetPlayerPos(playerid,sad[0],sad[1],sad[2]);
  108. cload[flag] = CreatePickup(1277,23,sad[0],sad[1],sad[2]);//spawn flag
  109. DestroyPickup(cload[ach]);
  110. DestroyPickup(cload[dch]);
  111. SetPVarInt(playerid,"used",0);
  112. }
  113. //}
  114. return 1;
  115. }
  116.  
  117. public OnPlayerPickUpPickup(playerid, pickupid)
  118. {
  119. //if(started == 2)
  120. //{
  121. if(pickupid == cload[flag])
  122. {//flag pickup
  123. if(GetPVarInt(playerid,"used") == 0)
  124. {
  125. switch(GetPVarInt(playerid,"TM"))
  126. {
  127. case 1:{//att
  128. //addobj
  129. SetPVarInt(playerid,"used",1);
  130. SendClientMessageToAll(-1,"флаг стащили атакеры");
  131. cload[ach] = CreatePickup(1277,23,cload[dpos][0],cload[dpos][1],cload[dpos][2]);//spawn in def zone
  132. SetPlayerAttachedObject( playerid, 0, 2914, 15, 0.014013, 0.077415, -0.424313, 354.422760, 358.421966, 92.942932, 1.000000, 1.000000, 1.000000 );
  133. }
  134. case 2:{//def
  135. //addobj
  136. SetPVarInt(playerid,"used",1);
  137. SendClientMessageToAll(-1,"флаг стащили дефендеры");
  138. cload[dch] = CreatePickup(1277,23,cload[apos][0],cload[apos][1],cload[apos][2]);//spawn in att zone
  139. SetPlayerAttachedObject( playerid, 0, 2914, 15, 0.014013, 0.077415, -0.424313, 354.422760, 358.421966, 92.942932, 1.000000, 1.000000, 1.000000 );
  140. }
  141. }
  142. }
  143. DestroyPickup(cload[flag]);
  144. }
  145. if(pickupid == cload[ach])
  146. {
  147. if(GetPVarInt(playerid,"used") == 1)//used obj
  148. {
  149. if(GetPVarInt(playerid,"TM") == 2)//def player
  150. {
  151. //add score ++def
  152. SetPVarInt(playerid,"used",0);
  153. SendClientMessageToAll(-1,"дефы донесли таки флаг с зоны");
  154. cload[flag] = CreatePickup(1277,23,cload[fpos][0],cload[fpos][1],cload[fpos][2]);//spawn flag
  155. RemovePlayerAttachedObject(playerid,0);
  156. }
  157. }
  158. DestroyPickup(cload[ach]);
  159. }
  160. if(pickupid == cload[dch])
  161. {
  162. if(GetPVarInt(playerid,"used") == 1)//used obj
  163. {
  164. if(GetPVarInt(playerid,"TM") == 1)//att player
  165. {
  166. //add score ++att
  167. SetPVarInt(playerid,"used",0);
  168. SendClientMessageToAll(-1,"аттакеры донесли таки флаг с зоны");
  169. cload[flag] = CreatePickup(1277,23,cload[fpos][0],cload[fpos][1],cload[fpos][2]);//spawn flag
  170. RemovePlayerAttachedObject(playerid,0);
  171. }
  172. }
  173. DestroyPickup(cload[dch]);
  174. }
  175. //}
  176. return 1;
  177. }
  178.  
  179. endCTF()
  180. {
  181. for(new x;x!=GetMaxPlayers();x++)
  182. {
  183. if(GetPVarInt(x,"used") == 1)
  184. {
  185. SetPVarInt(x,"used",0);
  186. RemovePlayerAttachedObject(x,0);
  187. }
  188. }
  189. DestroyPickup(cload[flag]);
  190. DestroyPickup(cload[ach]);
  191. DestroyPickup(cload[dch]);
  192. infoLeaders();
  193. }
  194.  
  195. infoLeaders()
  196. {
  197. /*
  198. if(attflag > defflag) return setWin(att);
  199. else if(attflag < defflag) return setWin(def);
  200. else if(attflag == defflag) return setWin(nobody);
  201. */
  202. return true;
  203. }
  204.  
  205. /*
  206. setWin(id)
  207. {
  208. //ляляля
  209. attflag = 0;
  210. defflag = 0;
  211. }
  212. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement