Advertisement
Guest User

Untitled

a guest
May 30th, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.73 KB | None | 0 0
  1. //Red Vs YEllow BY aVi.
  2.  
  3. #include <a_samp>
  4.  
  5. #define Red 1
  6. #define Yellow 2
  7.  
  8. #define DIALOG_RULES
  9. new gTeam[MAX_PLAYERS];
  10. #define RedTeamColor 0xFF0000AA
  11. #define YellowTeamColor 0xFFFF00AA
  12. #define COLOR_RED 0xFF0000AA
  13. #define COLOR_YELLOW 0xFFFF00AA
  14.  
  15. new Float:RedRandomSpawns[4][3] = {
  16. {-528.9855,-106.5116,63.2969},
  17. {-528.9855,-106.5116,63.2969},
  18. {-466.5234,-65.2756,60.0786},
  19. {-525.2863,-26.3262,60.2808}
  20. };
  21.  
  22.  
  23. new Float:YellowRandomSpawns[4][3] = {
  24. {108.0593,688.4122,5.7534},
  25. {73.7504,685.4804,5.5640},
  26. {73.7504,685.4804,5.5640},
  27. {139.1785,723.5793,6.2578}
  28. };
  29.  
  30. /// Outside all callbacks //
  31. forward SetPlayerRandomRedSpawn(playerid); // Forwarding the function
  32. public SetPlayerRandomRedSpawn(playerid) // Setting it up
  33. {
  34. new rand = random(sizeof(RedRandomSpawns)); // Making it select random options instead of a definite one
  35. SetPlayerPos(playerid, RedRandomSpawns[rand][0], RedRandomSpawns[rand][1], RedRandomSpawns[rand][2]); // [rand] tag means random, [0] = X, [1] = Y, [2] = Z
  36. return 1;
  37. }
  38.  
  39. /// Rest is same as above, just Cops replaced Criminals
  40. forward SetPlayerRandomYellowSpawn(playerid);
  41. public SetPlayerRandomYellowSpawn(playerid)
  42. {
  43. new rand = random(sizeof(YellowRandomSpawns));
  44. SetPlayerPos(playerid, YellowRandomSpawns[rand][0], YellowRandomSpawns[rand][1], YellowRandomSpawns[rand][2]);
  45. return 1;
  46. }
  47.  
  48.  
  49. main()
  50. {
  51. print("\n----------------------------------");
  52. print(" *******Red Vs Yellow By Avi******");
  53. print("----------------------------------\n");
  54. }
  55.  
  56. public OnGameModeInit()
  57. {
  58. SetGameModeText("Team Death Match");
  59. AddPlayerClass(19,-535.9205,-179.1865,78.4047,2.8661,22,100,25,250,0,0); // redteam
  60. AddPlayerClass(287,92.4479,637.9890,7.5454,186.4675,22,100,25,250,0,0); // yellowteam
  61. return 1;
  62. }
  63.  
  64. public OnGameModeExit()
  65. {
  66. return 1;
  67. }
  68.  
  69. public OnPlayerRequestClass(playerid, classid)
  70. {
  71. switch(classid) // Switching between the classids
  72. {
  73. case 0/* The first classid is of the cops*/:
  74. {
  75. SetPlayerTeam(playerid, Red); // Setting players team
  76. GameTextForPlayer(playerid, "~r~Red Team", 3500, 6);
  77. SetPlayerRandomRedSpawn(playerid); // Screen msg for player to show what team
  78. }
  79.  
  80. case 1/* The first classid is of the cops*/:
  81. {
  82. SetPlayerTeam(playerid, Yellow); // Same as above
  83. GameTextForPlayer(playerid, "~y~Yellow Team", 3500, 6);
  84. SetPlayerRandomYellowSpawn(playerid); // Same as above
  85. }
  86. }
  87. return 1;
  88. }
  89.  
  90. public OnPlayerConnect(playerid)
  91. {
  92. return 1;
  93. }
  94.  
  95. public OnPlayerDisconnect(playerid, reason)
  96. {
  97. return 1;
  98. }
  99.  
  100. public OnPlayerSpawn(playerid)
  101. {
  102. if(GetPlayerTeam(playerid) == Red)
  103. {
  104. SetPlayerColor(playerid, RedTeamColor);
  105. SendClientMessage(playerid, COLOR_RED, "Your Now Part Of Red Team !"); // Set his color to CopsColor (BLUE)
  106. gTeam[playerid] = Red;
  107. /* Any other bonus you want for Cops team! A special gun, skin, color, attachedobject, A random spawn! */
  108. }
  109.  
  110. else if(GetPlayerTeam(playerid) == Yellow)
  111. {
  112. SetPlayerColor(playerid, YellowTeamColor);
  113. SendClientMessage(playerid, COLOR_YELLOW, "Your Now Part Of Yellow Team !"); // Same as above but in this case, CriminalsColor (RED)
  114. gTeam[playerid] = Red;
  115. }
  116. return 1;
  117. }
  118.  
  119. public OnPlayerDeath(playerid, killerid, reason)
  120. {
  121. new pScore = GetPlayerScore(killerid);
  122. SetPlayerScore(killerid, pScore + 1 ); //1 is the amount of score you want to give it to the killer
  123. GivePlayerMoney(killerid,50);//50 is the amount of money you want to give it to the killer
  124. GameTextForPlayer(killerid,"Keep Killing !",2000,4);
  125. return 1;
  126. }
  127.  
  128. public OnVehicleSpawn(vehicleid)
  129. {
  130. return 1;
  131. }
  132.  
  133. public OnVehicleDeath(vehicleid, killerid)
  134. {
  135. return 1;
  136. }
  137.  
  138. public OnPlayerText(playerid,text[])
  139. {
  140. if(text[0] == '*') // : can be changed to whatever symbol u wanna use for player to enable the teamchat.
  141. {
  142. new string[128]; GetPlayerName(playerid, string, sizeof(string)); // Making the new's
  143. format(string, sizeof(string), "[Team Radio] %s: %s", string, text[1]); // Formatted the message
  144. printf("%s", string); // Printed it BOTH ingame + the server log
  145.  
  146. for(new i = 0; i < MAX_PLAYERS; i++) // Getting the player team and color, required for formatting the msg.
  147. {
  148. if(IsPlayerConnected(i) && GetPlayerTeam(i) == GetPlayerTeam(playerid)) SendClientMessage(i, GetPlayerColor(playerid), string);
  149. }
  150. return 0;
  151. }
  152.  
  153. return 1;
  154. }
  155.  
  156. public OnPlayerCommandText(playerid, cmdtext[])
  157. {
  158.  
  159. return 1;
  160. }
  161.  
  162.  
  163. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  164. {
  165. return 1;
  166. }
  167.  
  168. public OnPlayerExitVehicle(playerid, vehicleid)
  169. {
  170. return 1;
  171. }
  172.  
  173. public OnPlayerStateChange(playerid, newstate, oldstate)
  174. {
  175. return 1;
  176. }
  177.  
  178. public OnPlayerEnterCheckpoint(playerid)
  179. {
  180. return 1;
  181. }
  182.  
  183. public OnPlayerLeaveCheckpoint(playerid)
  184. {
  185. return 1;
  186. }
  187.  
  188. public OnPlayerEnterRaceCheckpoint(playerid)
  189. {
  190. return 1;
  191. }
  192.  
  193. public OnPlayerLeaveRaceCheckpoint(playerid)
  194. {
  195. return 1;
  196. }
  197.  
  198. public OnRconCommand(cmd[])
  199. {
  200. return 1;
  201. }
  202.  
  203. public OnPlayerRequestSpawn(playerid)
  204. {
  205. return 1;
  206. }
  207.  
  208. public OnObjectMoved(objectid)
  209. {
  210. return 1;
  211. }
  212.  
  213. public OnPlayerObjectMoved(playerid, objectid)
  214. {
  215. return 1;
  216. }
  217.  
  218. public OnPlayerPickUpPickup(playerid, pickupid)
  219. {
  220. return 1;
  221. }
  222.  
  223. public OnVehicleMod(playerid, vehicleid, componentid)
  224. {
  225. return 1;
  226. }
  227.  
  228. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  229. {
  230. return 1;
  231. }
  232.  
  233. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  234. {
  235. return 1;
  236. }
  237.  
  238. public OnPlayerSelectedMenuRow(playerid, row)
  239. {
  240. return 1;
  241. }
  242.  
  243. public OnPlayerExitedMenu(playerid)
  244. {
  245. return 1;
  246. }
  247.  
  248. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  249. {
  250. return 1;
  251. }
  252.  
  253. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  254. {
  255. return 1;
  256. }
  257.  
  258. public OnRconLoginAttempt(ip[], password[], success)
  259. {
  260. return 1;
  261. }
  262.  
  263. public OnPlayerUpdate(playerid)
  264. {
  265. return 1;
  266. }
  267.  
  268. public OnPlayerStreamIn(playerid, forplayerid)
  269. {
  270. return 1;
  271. }
  272.  
  273. public OnPlayerStreamOut(playerid, forplayerid)
  274. {
  275. return 1;
  276. }
  277.  
  278. public OnVehicleStreamIn(vehicleid, forplayerid)
  279. {
  280. return 1;
  281. }
  282.  
  283. public OnVehicleStreamOut(vehicleid, forplayerid)
  284. {
  285. return 1;
  286. }
  287.  
  288. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  289. {
  290. return 1;
  291. }
  292.  
  293. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  294. {
  295. return 1;
  296. }
  297. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
  298. {
  299. if(issuerid != INVALID_PLAYER_ID)
  300. {
  301. if(gTeam[issuerid] == gTeam[playerid])
  302. {
  303. GameTextForPlayer(issuerid,"Dont Kill Team Mates !",2000,4);
  304. }
  305. }
  306. return 1;
  307. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement