Advertisement
Guest User

Christmas wars 2 by Kitten

a guest
Dec 9th, 2012
600
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.36 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new gTeam[MAX_PLAYERS];
  4. new Text:S_Kills;
  5. new SKill;
  6. new RKill;
  7.  
  8. #define ServerName "Future Christmas Wars (2)"
  9. #define TOWIN 25
  10. #define D_SELECT 1337
  11. #define T_SANTA 0
  12. #define T_ROBBER 1
  13.  
  14. forward SpawnEx(playerid);
  15.  
  16. main()
  17. {
  18. print("\n----------------------------------");
  19. print(""ServerName" Loaded!");
  20. print("----------------------------------\n");
  21. }
  22.  
  23. public OnGameModeInit()
  24. {
  25. SetGameModeText("CW By Kitten");
  26. SendRconCommand("hostname "ServerName"");
  27.  
  28. CreateMapObjects();
  29. CreateTextdraws();
  30. SetWorldTime(0);
  31. SetWeather(2);
  32.  
  33. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  34. return 1;
  35. }
  36.  
  37. public OnGameModeExit()
  38. {
  39. TextDrawHideForAll(S_Kills);
  40. TextDrawDestroy(S_Kills);
  41. return 1;
  42. }
  43.  
  44. public OnPlayerRequestClass(playerid, classid)
  45. {
  46. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  47. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  48. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  49. return 1;
  50. }
  51.  
  52. public OnPlayerConnect(playerid)
  53. {
  54. ShowPlayerDialog(playerid,D_SELECT,DIALOG_STYLE_MSGBOX,"Select your team!","Select between Santa team or Robber Team!","Santa","Robber");
  55. return 1;
  56. }
  57.  
  58. public OnPlayerDisconnect(playerid, reason)
  59. {
  60. return 1;
  61. }
  62.  
  63. public OnPlayerSpawn(playerid)
  64. {
  65. RemovePlayerAttachedObject(playerid,5);
  66. SetPlayerAttachedObject(playerid, 5, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
  67. if(gTeam[playerid] == T_SANTA)
  68. {
  69. SetPlayerPos(playerid,-1968.8000488281,1617.8000488281,66.699996948242);
  70. GivePlayerWeapon(playerid,24,35);
  71. GivePlayerWeapon(playerid,29,150);
  72. SetPlayerColor(playerid,0xAA333355);
  73. SetPlayerTeam(playerid,T_SANTA);
  74. SetPlayerSkin(playerid,264);
  75. SendClientMessage(playerid,-1,"[SERVER] Protect the presents, terminate the robbers!");
  76. }
  77.  
  78. if(gTeam[playerid] == T_ROBBER)
  79. {
  80. SetPlayerPos(playerid,-1778.3000488281,1618.3000488281,68.599998474121);
  81. GivePlayerWeapon(playerid,24,35);
  82. GivePlayerWeapon(playerid,28,150);
  83. SetPlayerColor(playerid,0x0000BB55);
  84. SetPlayerTeam(playerid,T_ROBBER);
  85. SetPlayerSkin(playerid,24);
  86. SendClientMessage(playerid,-1,"[SERVER] Terminate santa, steal presents!");
  87. }
  88. return 1;
  89. }
  90.  
  91. public OnPlayerDeath(playerid, killerid, reason)
  92. {
  93. if(gTeam[killerid] == T_SANTA) SKill++;
  94. if(gTeam[killerid] == T_SANTA) RKill++;
  95.  
  96. new str[64];
  97. format(str,sizeof(str),"~r~Evil Santa Kills~w~: %i~n~~g~Stealer Kills~w~: %i",SKill,RKill);
  98. TextDrawSetString(S_Kills,str);
  99.  
  100. if(SKill >= TOWIN)
  101. {
  102. SendClientMessage(playerid,-1,"[SERVER] Santa have saved christmas!");
  103. SendClientMessage(playerid,-1,"[SERVER] New round starting!");
  104. SKill = 0;
  105. RKill = 0;
  106.  
  107. for(new i = 0; i < MAX_PLAYERS; i++)
  108. {
  109. SetPlayerHealth(i,0.0);
  110. }
  111. }
  112.  
  113. if(RKill >= TOWIN)
  114. {
  115. SendClientMessage(playerid,-1,"[SERVER] Christmas has been ruined presents were stolen!");
  116. SendClientMessage(playerid,-1,"[SERVER] New round starting!");
  117. SKill = 0;
  118. RKill = 0;
  119.  
  120. for(new i = 0; i < MAX_PLAYERS; i++)
  121. {
  122. SetPlayerHealth(i,0.0);
  123. }
  124. }
  125.  
  126. if(SKill == TOWIN)
  127. {
  128. SendClientMessage(playerid,-1,"[SERVER] Half of the presents were stolen still christmas isn't ruined!");
  129. SendClientMessage(playerid,-1,"[SERVER] New round starting!");
  130. SKill = 0;
  131. RKill = 0;
  132.  
  133. for(new i = 0; i < MAX_PLAYERS; i++)
  134. {
  135. SetPlayerHealth(i,0.0);
  136. }
  137. }
  138. return 1;
  139. }
  140.  
  141. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  142. {
  143. switch(dialogid)
  144. {
  145. case D_SELECT:
  146. {
  147. if(response) gTeam[playerid] = T_SANTA,SetTimerEx("SpawnEx", 400, false, "playerid", playerid),TextDrawShowForPlayer(playerid,S_Kills);
  148. if(!response) gTeam[playerid] = T_ROBBER,SetTimerEx("SpawnEx", 400, false, "playerid", playerid),TextDrawShowForPlayer(playerid,S_Kills);
  149. }
  150. }
  151. return 1;
  152. }
  153.  
  154. public SpawnEx(playerid) return SpawnPlayer(playerid);
  155.  
  156. public OnPlayerUpdate(playerid)
  157. {
  158. switch(GetPlayerWeapon(playerid))
  159. {
  160. case 1,2,3,9,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46:
  161. {
  162. SendClientMessage(playerid,-1,"[KICKED] We do not allow cheating in this server!");
  163. Kick(playerid);
  164. }
  165. }
  166.  
  167. if(IsPlayerInWater(playerid))
  168. {
  169. SetPlayerHealth(playerid,0.0);
  170. }
  171. return 1;
  172. }
  173.  
  174. stock CreateTextdraws()
  175. {
  176. S_Kills = TextDrawCreate(496.000000, 122.000000, "~r~Santa Kills~w~: 0~n~~g~Stealer Kills~w~: 0");
  177. TextDrawBackgroundColor(S_Kills, 255);
  178. TextDrawFont(S_Kills, 1);
  179. TextDrawLetterSize(S_Kills, 0.490000, 2.300000);
  180. TextDrawColor(S_Kills, -1);
  181. TextDrawSetOutline(S_Kills, 0);
  182. TextDrawSetProportional(S_Kills, 1);
  183. TextDrawSetShadow(S_Kills, 1);
  184. return 1;
  185. }
  186.  
  187. stock CreateMapObjects()
  188. {
  189. CreateObject(18753,-1871.89,1626.09,69.50,0.00,0.00,0.00);
  190. CreateObject(18784,-1944.09,1620.19,67.59,0.00,0.00,0.00);
  191. CreateObject(18783,-1964.00,1620.19,62.70,0.00,0.00,0.00);
  192. CreateObject(18783,-1779.90,1618.90,62.90,0.00,0.00,0.00);
  193. CreateObject(18784,-1799.59,1619.00,67.69,0.00,0.00,180.00);
  194. CreateObject(18774,-1810.40,1613.90,72.80,0.00,0.00,270.00);
  195. CreateObject(18774,-1810.40,1623.90,72.69,0.00,0.00,270.00);
  196. CreateObject(18774,-1933.00,1625.30,72.59,0.00,0.00,270.00);
  197. CreateObject(18774,-1933.00,1615.30,72.59,0.00,0.00,270.00);
  198. CreateObject(18750,-1870.69,1620.79,117.80,87.17,314.97,132.97);
  199. CreateObject(18728,-1807.09,1628.39,68.80,0.00,0.00,90.00);
  200. CreateObject(18728,-1807.00,1609.30,69.90,0.00,0.00,90.00);
  201. CreateObject(18728,-1936.30,1610.59,69.80,0.00,0.00,90.00);
  202. CreateObject(18728,-1936.40,1630.80,69.30,0.00,0.00,90.00);
  203. CreateObject(18691,-1935.89,1610.69,69.69,0.00,0.00,0.00);
  204. CreateObject(18691,-1935.50,1631.50,69.30,0.00,0.00,0.00);
  205. CreateObject(18691,-1807.80,1608.90,67.80,0.00,0.00,0.00);
  206. CreateObject(18691,-1808.00,1628.09,68.09,0.00,0.00,0.00);
  207. CreateObject(18652,-1809.09,1618.90,75.30,0.00,0.00,0.00);
  208. CreateObject(18650,-1936.40,1620.00,75.30,0.00,0.00,0.00);
  209. CreateObject(18864,-1846.00,1619.09,56.90,0.00,0.00,0.00);
  210. CreateObject(18864,-1947.59,1611.00,88.40,0.00,0.00,0.00);
  211. CreateObject(18864,-1811.00,1646.69,70.90,0.00,0.00,0.00);
  212. CreateObject(19076,-1773.00,1613.69,65.40,0.00,0.00,0.00);
  213. CreateObject(19056,-1772.59,1616.30,66.09,0.00,0.00,0.00);
  214. CreateObject(19057,-1775.59,1613.59,66.09,0.00,0.00,0.00);
  215. CreateObject(19055,-1775.00,1615.90,66.09,0.00,0.00,0.00);
  216. CreateObject(19076,-1969.09,1627.59,65.19,0.00,0.00,0.00);
  217. CreateObject(19057,-1967.40,1627.50,65.90,0.00,0.00,0.00);
  218. CreateObject(19056,-1967.80,1625.90,65.90,0.00,0.00,0.00);
  219. CreateObject(19055,-1969.50,1625.80,65.90,0.00,0.00,0.00);
  220. CreateObject(18766,-1960.19,1629.50,67.69,0.00,0.00,0.00);
  221. CreateObject(19173,-1963.39,1629.00,67.19,0.00,0.00,0.00);
  222. CreateObject(19174,-1960.00,1629.00,68.90,0.00,0.00,0.00);
  223. CreateObject(19175,-1963.19,1629.00,68.80,0.00,0.00,0.00);
  224. CreateObject(19172,-1956.79,1629.00,66.19,0.00,0.00,0.00);
  225. CreateObject(19164,-1956.89,1628.79,68.40,83.99,0.00,0.00);
  226. CreateObject(19168,-1960.19,1628.79,66.59,90.00,179.99,179.99);
  227. CreateObject(19275,-1960.19,1629.19,67.50,0.00,0.00,0.00);
  228. CreateObject(3308,-1824.19,1582.19,71.59,0.00,0.00,90.00);
  229. CreateObject(3308,-1849.00,1582.19,71.59,0.00,0.00,90.00);
  230. CreateObject(3309,-1874.09,1582.50,71.40,0.00,0.00,90.00);
  231. CreateObject(3309,-1899.00,1582.09,71.59,0.00,0.00,90.00);
  232. CreateObject(3309,-1923.69,1582.09,71.59,0.00,0.00,90.00);
  233. CreateObject(3312,-1899.29,1618.50,73.09,0.00,0.00,87.99);
  234. CreateObject(3312,-1874.50,1617.40,73.19,0.00,0.00,87.99);
  235. CreateObject(3315,-1845.40,1623.69,71.00,0.00,0.00,358.00);
  236. CreateObject(3315,-1877.59,1648.09,71.40,0.00,0.00,177.99);
  237. CreateObject(3316,-1898.50,1649.00,73.40,0.00,0.00,178.00);
  238. CreateObject(3353,-1818.79,1669.09,71.40,0.00,0.00,0.00);
  239. CreateObject(3445,-1924.89,1669.69,73.40,0.00,0.00,0.00);
  240. CreateObject(19129,-1779.69,1619.09,65.50,0.00,0.00,0.00);
  241. CreateObject(18846,-1785.50,1627.39,70.50,0.00,0.00,29.99);
  242. return 1;
  243. }
  244.  
  245. stock IsPlayerInWater(playerid)
  246. {
  247. new animlib[32],tmp[32];
  248. GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,tmp,32);
  249. if(!strcmp(animlib, "SWIM") && !IsPlayerInAnyVehicle(playerid) ) return true;
  250. return false;
  251. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement