Advertisement
Guest User

SERVER Script

a guest
May 30th, 2012
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.12 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.  
  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. /* Any other bonus you want for Cops team! A special gun, skin, color, attachedobject, A random spawn! */
  107. }
  108.  
  109. else if(GetPlayerTeam(playerid) == Yellow)
  110. {
  111. SetPlayerColor(playerid, YellowTeamColor);
  112. SendClientMessage(playerid, COLOR_YELLOW, "Your Now Part Of Yellow Team !"); // Same as above but in this case, CriminalsColor (RED)
  113. }
  114. return 1;
  115. }
  116.  
  117. public OnPlayerDeath(playerid, killerid, reason)
  118. {
  119. return 1;
  120. }
  121.  
  122. public OnVehicleSpawn(vehicleid)
  123. {
  124. return 1;
  125. }
  126.  
  127. public OnVehicleDeath(vehicleid, killerid)
  128. {
  129. return 1;
  130. }
  131.  
  132. public OnPlayerText(playerid,text[])
  133. {
  134. if(text[0] == '*') // : can be changed to whatever symbol u wanna use for player to enable the teamchat.
  135. {
  136. new string[128]; GetPlayerName(playerid, string, sizeof(string)); // Making the new's
  137. format(string, sizeof(string), "[Team Radio] %s: %s", string, text[1]); // Formatted the message
  138. printf("%s", string); // Printed it BOTH ingame + the server log
  139.  
  140. for(new i = 0; i < MAX_PLAYERS; i++) // Getting the player team and color, required for formatting the msg.
  141. {
  142. if(IsPlayerConnected(i) && GetPlayerTeam(i) == GetPlayerTeam(playerid)) SendClientMessage(i, GetPlayerColor(playerid), string);
  143. }
  144. return 0;
  145. }
  146.  
  147. return 1;
  148. }
  149.  
  150. public OnPlayerCommandText(playerid, cmdtext[])
  151. {
  152.  
  153. return 1;
  154. }
  155.  
  156.  
  157. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  158. {
  159. return 1;
  160. }
  161.  
  162. public OnPlayerExitVehicle(playerid, vehicleid)
  163. {
  164. return 1;
  165. }
  166.  
  167. public OnPlayerStateChange(playerid, newstate, oldstate)
  168. {
  169. return 1;
  170. }
  171.  
  172. public OnPlayerEnterCheckpoint(playerid)
  173. {
  174. return 1;
  175. }
  176.  
  177. public OnPlayerLeaveCheckpoint(playerid)
  178. {
  179. return 1;
  180. }
  181.  
  182. public OnPlayerEnterRaceCheckpoint(playerid)
  183. {
  184. return 1;
  185. }
  186.  
  187. public OnPlayerLeaveRaceCheckpoint(playerid)
  188. {
  189. return 1;
  190. }
  191.  
  192. public OnRconCommand(cmd[])
  193. {
  194. return 1;
  195. }
  196.  
  197. public OnPlayerRequestSpawn(playerid)
  198. {
  199. return 1;
  200. }
  201.  
  202. public OnObjectMoved(objectid)
  203. {
  204. return 1;
  205. }
  206.  
  207. public OnPlayerObjectMoved(playerid, objectid)
  208. {
  209. return 1;
  210. }
  211.  
  212. public OnPlayerPickUpPickup(playerid, pickupid)
  213. {
  214. return 1;
  215. }
  216.  
  217. public OnVehicleMod(playerid, vehicleid, componentid)
  218. {
  219. return 1;
  220. }
  221.  
  222. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  223. {
  224. return 1;
  225. }
  226.  
  227. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  228. {
  229. return 1;
  230. }
  231.  
  232. public OnPlayerSelectedMenuRow(playerid, row)
  233. {
  234. return 1;
  235. }
  236.  
  237. public OnPlayerExitedMenu(playerid)
  238. {
  239. return 1;
  240. }
  241.  
  242. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  243. {
  244. return 1;
  245. }
  246.  
  247. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  248. {
  249. return 1;
  250. }
  251.  
  252. public OnRconLoginAttempt(ip[], password[], success)
  253. {
  254. return 1;
  255. }
  256.  
  257. public OnPlayerUpdate(playerid)
  258. {
  259. return 1;
  260. }
  261.  
  262. public OnPlayerStreamIn(playerid, forplayerid)
  263. {
  264. return 1;
  265. }
  266.  
  267. public OnPlayerStreamOut(playerid, forplayerid)
  268. {
  269. return 1;
  270. }
  271.  
  272. public OnVehicleStreamIn(vehicleid, forplayerid)
  273. {
  274. return 1;
  275. }
  276.  
  277. public OnVehicleStreamOut(vehicleid, forplayerid)
  278. {
  279. return 1;
  280. }
  281.  
  282. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  283. {
  284. return 1;
  285. }
  286.  
  287. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  288. {
  289. return 1;
  290. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement