Guest User

Starter TDM by Kitten

a guest
Sep 11th, 2011
522
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.04 KB | None | 0 0
  1. /*
  2. //--Start Team deathmatch--//
  3. //--Do what ever you want to this script i don't care if you change credits--//
  4. _________ __ __ ___________________ _____
  5. / _____// |______ ________/ |_ ___________ \__ ___/\______ \ / \
  6. \_____ \\ __\__ \\_ __ \ __\/ __ \_ __ \ | | | | \ / \ / \
  7. / \| | / __ \| | \/| | \ ___/| | \/ | | | ` \/ Y \
  8. /_______ /|__| (____ /__| |__| \___ >__| |____| /_______ /\____|__ /
  9. \/ \/ \/ \/ \/
  10. */
  11.  
  12. #include <a_samp>
  13. #include <zcmd>
  14.  
  15. //---Variables---//
  16. new bool:HasPlayerSpawned[MAX_PLAYERS];
  17. new Text3D:labelone[MAX_PLAYERS];
  18. new Text3D:labeltwo[MAX_PLAYERS];
  19. new Text3D:labelthree[MAX_PLAYERS];
  20. new PlayerKills[MAX_PLAYERS] = 0;
  21. new Dominating[MAX_PLAYERS] = 0;
  22. new Team[MAX_PLAYERS];
  23. new Text:STDM;
  24. new PickSkin[MAX_PLAYERS];
  25. new string[128];
  26.  
  27. //---Defines---//
  28. #define TEAM_1 0
  29. #define TEAM_2 1
  30. #define TEAM_3 2 // add more like TEAM_4 3 if you want to add more teams.
  31. #define RULESD 4000 // dialog
  32. #define HELPD 4010 // dialog
  33. #define CMDD 4020 // dialog
  34. #define CREDITSD 4030 // dialog
  35. #define ChooseSkin 4040 // dialog
  36.  
  37. //---Colors---//
  38. #define COLOR_BLUE 0x0259EAAA
  39. #define COLOR_RED 0xFF0000AA
  40. #define COLOR_GREEN 0x16EB43FF
  41. #define COLOR_PURPLE 0xB360FDFF
  42. #define COLOR_PINK 0xCCFF00FF
  43. #define COLOR_YELLOW 0xFFFF00FF
  44. #define COLOR_GREY 0xC0C0C0FF
  45. #define COLOR_ORANGE 0xFFA500FF
  46. #define COLOR_BROWN 0x800000FF
  47. #define COLOR_WHITE 0xFFFFFFAA
  48. #define ADMIN_RED 0xFF0000AA
  49. #define COLOR_LIGHTRED 0xFF8080FF
  50. #define COLOR_LIGHTBLUE 0x00C2ECFF
  51.  
  52. //---Team Balancer---//
  53. stock GetPlayersInTeamFromMaxPlayers(teamid)
  54. {
  55. new playercount = 0;
  56. for(new i = 0; i < MAX_PLAYERS; i++)
  57. {
  58. if(HasPlayerSpawned[i] == false) continue;
  59. if(GetPlayerState(i) == PLAYER_STATE_NONE) continue;
  60. if(Team[i] != teamid) continue;
  61. playercount++;
  62. }
  63. return playercount;
  64. }
  65.  
  66.  
  67. main()
  68. {
  69. print("\n----------------------------------");
  70. print(" Starter Team Deathmatch by Kitten <3");
  71. print("----------------------------------\n");
  72. }
  73.  
  74.  
  75. CMD:rules(playerid,params[]) {
  76. new Rules[1024];
  77. Rules[0]='\0';
  78. strcat(Rules, "{FFFFFF}Rule 1:{FFAF00} Rule here\n", 1024 );
  79. strcat(Rules, "{FFFFFF}Rule 2:{FFAF00} Rule here\n", 1024 );
  80. strcat(Rules, "{FFFFFF}Rule 3:{FFAF00} Rule here\n", 1024 );
  81. strcat(Rules, "{FFFFFF}Rule 4:{FFAF00} Rule here\n", 1024 );
  82. strcat(Rules, "{FFFFFF}Rule 5:{FFAF00} Rule heres\n", 1024 );
  83. strcat(Rules, "{FFFFFF}Rule 6:{FFAF00} Rule here\n", 1024 );
  84. strcat(Rules, "{FFFFFF}Rule 7:{FFAF00} Rule here\n", 1024 );
  85. strcat(Rules, "{FFFFFF}Rule 8:{FFAF00} Rule here\n", 1024 );
  86. strcat(Rules, "{FFFFFF}Rule 9:{FFAF00} Rule here\n", 1024 );
  87. ShowPlayerDialog(playerid,RULESD,DIALOG_STYLE_MSGBOX,"{FFFFFF}Server Rules",Rules,"Accept","Deny");
  88. PlayerPlaySound(playerid,1056,0.0,0.0,0.0);
  89. return 1;
  90. }
  91.  
  92. CMD:help(playerid,params[]) {
  93. new Help[1024];
  94. Help[0]='\0';
  95. strcat(Help, "{FFFFFF} Welcome to My Server Name\n", 1024 );
  96. strcat(Help, "{6EF83C} blah blah blah blah\n", 1024 );
  97. strcat(Help, "{FFFFFF} always check the rules at /rules\n", 1024 );
  98. strcat(Help, "{6EF83C} blah blah blah blah? /cmds\n", 1024 );
  99. strcat(Help, "{FFFFFF} blah blah blah blah\n", 1024 );
  100. ShowPlayerDialog(playerid,HELPD,DIALOG_STYLE_MSGBOX,"{6EF83C}Server Help",Help,"Ok","Close");
  101. PlayerPlaySound(playerid,1056,0.0,0.0,0.0);
  102. return 1;
  103. }
  104.  
  105. CMD:cmds(playerid,params[]) {
  106. new CommandsD[1024];
  107. CommandsD[0]='\0';
  108. strcat(CommandsD, "{FFAF00}Server Commands add here \n", 1024 );
  109. strcat(CommandsD, "{FFAF00}Server Commands add here \n", 1024 );
  110. ShowPlayerDialog( playerid, CMDD, DIALOG_STYLE_MSGBOX , " {00FF19}Server Public Commands " , CommandsD , "Ok" , "Close " ) ;
  111. PlayerPlaySound(playerid,1056,0.0,0.0,0.0);
  112. return 1;
  113. }
  114.  
  115. CMD:credits(playerid,params[]) {
  116. new Credits[1024];
  117. Credits[0]='\0';
  118. strcat(Credits, "{FFFFFF}Kitten{FFAF00} Starter TDM Script\n", 1024 );
  119. ShowPlayerDialog( playerid, CREDITSD, DIALOG_STYLE_MSGBOX , " {00FF19}Server official credits " , Credits , "Ok" , "Close " ) ;
  120. PlayerPlaySound(playerid,1056,0.0,0.0,0.0);
  121. return 1;
  122. }
  123.  
  124.  
  125. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  126. if(dialogid == 4000) { // Rules
  127. if(response) {
  128. SendClientMessage(playerid,COLOR_WHITE,"SERVER: thanks for accepting the rules.");
  129. PlayerPlaySound(playerid,1056,0.0,0.0,0.0);
  130. }
  131. else if(response == 0) {
  132. SendClientMessage(playerid,COLOR_WHITE,"SERVER: You been kicked for denying our rules bye.");
  133. new name[MAX_PLAYER_NAME];
  134. GetPlayerName(playerid, name, sizeof(name));
  135. format(string, sizeof(string), "%s has been kicked for denying the rules.", name);
  136. SendClientMessageToAll(COLOR_GREEN, string);
  137. PlayerPlaySound(playerid,1056,0.0,0.0,0.0);
  138. Kick(playerid);
  139. }
  140. }
  141. if(dialogid == ChooseSkin) { // Choosing skin
  142. if(response) {
  143. new skinid, message[64];
  144. skinid = strval(inputtext);
  145. if(skinid < 0 || skinid > 299) {
  146. SendClientMessage(playerid, COLOR_GREEN, "SERVER: Skin id may be between 0 and 299.");
  147. ShowPlayerDialog(playerid, ChooseSkin, DIALOG_STYLE_INPUT, "{6EF83C} Please enter a skin id to contiune", "{FFFFFF}Enter the skin id you wish to have below", "Confirm", "Cancel");
  148. }
  149. else {
  150. SetPlayerSkin(playerid, skinid);
  151. format(message, sizeof(message), "SERVER: You have changed your skin id to %d.", skinid);
  152. SendClientMessage(playerid, COLOR_GREEN, message);
  153. PickSkin[playerid] = 0;
  154. }
  155. }
  156. }
  157. return 0;
  158. }
  159.  
  160. public OnGameModeInit() {
  161. SetGameModeText("STDM 1.0");
  162. AddPlayerClass(0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0); // Team 1
  163. AddPlayerClass(1, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0); // Team 2
  164. AddPlayerClass(2, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0); // Team 3
  165.  
  166. //---Textdraws---//
  167. STDM = TextDrawCreate(500.000000, 10.000000, "Starter~r~ TDM");
  168. TextDrawBackgroundColor(STDM, 255);
  169. TextDrawFont(STDM, 1);
  170. TextDrawLetterSize(STDM, 0.500000, 1.000000);
  171. TextDrawColor(STDM, -1);
  172. TextDrawSetOutline(STDM, 0);
  173. TextDrawSetProportional(STDM, 1);
  174. TextDrawSetShadow(STDM, 1);
  175. return 1;
  176. }
  177.  
  178. public OnGameModeExit()
  179. {
  180. TextDrawDestroy(STDM);
  181. TextDrawHideForAll(STDM);
  182. return 1;
  183. }
  184.  
  185. public OnPlayerRequestClass(playerid, classid) {
  186. SetPlayerPos(playerid, -1959.4025,700.4174,46.5625);
  187. SetPlayerCameraPos(playerid, -1958.2029,711.0995,53.6375);
  188. SetPlayerCameraLookAt(playerid, -1959.4025,700.4174,46.5625);
  189. SetPlayerFacingAngle(playerid,357.4232);
  190. if(classid == 0) {
  191. GameTextForPlayer(playerid,"~r~ Team 1~n~~w~ Objective:~r~ Troll :)",1000,4);
  192. Team[playerid] = TEAM_1;
  193. }
  194. if(classid == 1) {
  195. GameTextForPlayer(playerid,"~g~ Teal 2~n~~w~ Objective:~g~ Troll (:",1000,4);
  196. Team[playerid] = TEAM_2;
  197. }
  198. if(classid == 2) {
  199. GameTextForPlayer(playerid,"~r~ Team 3~n~~w~ Objective:~r~ Troll =D",1000,4);
  200. Team[playerid] = TEAM_3;
  201. }
  202. return 1;
  203. }
  204.  
  205. public OnPlayerRequestSpawn(playerid) {
  206. new team1 = GetPlayersInTeamFromMaxPlayers(TEAM_1);
  207. new team2 = GetPlayersInTeamFromMaxPlayers(TEAM_2);
  208. new team3 = GetPlayersInTeamFromMaxPlayers(TEAM_3);
  209. if(team1 > team2 && Team[playerid] == TEAM_1) {
  210. GameTextForPlayer(playerid, "~r~Team Full!~n~~w~Choose Another Team!", 3000, 5);
  211. return 0;
  212. }
  213. else if(team2 > team1 && Team[playerid] == TEAM_2) {
  214. GameTextForPlayer(playerid, "~r~Team Full!~n~~w~Choose Another Team!", 3000, 5);
  215. return 0;
  216. }
  217. else if(team3 > team2 && Team[playerid] == TEAM_3) {
  218. GameTextForPlayer(playerid, "~r~Team Full!~n~~w~Choose Another Team!", 3000, 5);
  219. return 0;
  220. }
  221. return 1;
  222. }
  223.  
  224. public OnPlayerConnect(playerid)
  225. {
  226. PickSkin[playerid] = 1;
  227. HasPlayerSpawned[playerid] = false;
  228. return 1;
  229. }
  230.  
  231. public OnPlayerDisconnect(playerid, reason)
  232. {
  233. PickSkin[playerid] = 0;
  234. return 1;
  235. }
  236.  
  237. public OnPlayerSpawn(playerid) {
  238. if(Team[playerid] == TEAM_1) {
  239. SetPlayerPos(playerid,-2458.2000,134.5419,35.1719);
  240. SetPlayerFacingAngle(playerid,303.9446);
  241. GivePlayerWeapon(playerid,24,100); // deagle
  242. GivePlayerWeapon(playerid,31,1000); // M4-Carbine
  243. SetPlayerColor(playerid,COLOR_RED); // team color = red
  244. labelone[playerid] = Create3DTextLabel("TEAM_1",COLOR_RED, 30.0, 40.0, 50.0, 40.0, 0);
  245. Attach3DTextLabelToPlayer(labelone[playerid],playerid,0.0, 0.0, 0.7);
  246. }
  247. if(Team[playerid] == TEAM_2) {
  248. SetPlayerPos(playerid,-2796.6589,219.5733,7.1875);
  249. SetPlayerFacingAngle(playerid,88.8288);
  250. GivePlayerWeapon(playerid,24,100); // deagle
  251. GivePlayerWeapon(playerid,30,1000); // AK47
  252. SetPlayerColor(playerid,COLOR_WHITE); // team color = white
  253. labeltwo[playerid] = Create3DTextLabel("TEAM_2",COLOR_WHITE, 30.0, 40.0, 50.0, 40.0, 0);
  254. Attach3DTextLabelToPlayer(labeltwo[playerid],playerid,0.0, 0.0, 0.7);
  255. }
  256. if(Team[playerid] == TEAM_3) {
  257. SetPlayerPos(playerid,-2706.5261,397.7129,4.3672);
  258. SetPlayerFacingAngle(playerid,179.8611);
  259. GivePlayerWeapon(playerid,24,100); // deagle
  260. GivePlayerWeapon(playerid,25,1000); // Shotgun
  261. SetPlayerColor(playerid,COLOR_BLUE); // team color = blue
  262. labelthree[playerid] = Create3DTextLabel("TEAM_3",COLOR_BLUE, 30.0, 40.0, 50.0, 40.0, 0);
  263. Attach3DTextLabelToPlayer(labelthree[playerid],playerid,0.0, 0.0, 0.7);
  264. }
  265.  
  266.  
  267. //---Choosing your skin---//
  268. if(PickSkin[playerid] == 1) {
  269. ShowPlayerDialog(playerid, ChooseSkin, DIALOG_STYLE_INPUT, "{6EF83C} Please enter a skin id to contiune", "{FFFFFF}Enter the skin id you wish to have below", "Confirm", "Cancel");
  270. PlayerPlaySound(playerid,1056,0.0,0.0,0.0);
  271. }
  272.  
  273. return 1;
  274. }
  275.  
  276. public OnPlayerDeath(playerid, killerid, reason)
  277. {
  278. SetPlayerScore(killerid,GetPlayerScore(killerid) +1);
  279. SendDeathMessage(killerid,playerid,reason);
  280. GivePlayerMoney(killerid,5000);
  281. new kName[128];
  282. GetPlayerName(killerid, kName, sizeof(kName));
  283. PlayerKills[killerid] = PlayerKills[killerid] + 1;
  284. PlayerKills[playerid] = 0;
  285. if (PlayerKills[killerid] == 4 && Dominating[killerid] == 1) {
  286. format(string, sizeof(string), "~r~%s is dominating!", kName);
  287. GivePlayerMoney(playerid,5000);
  288. GameTextForAll(string, 1000, 1);
  289. return 1;
  290. }
  291. if (PlayerKills[killerid] == 6) {
  292. format(string, sizeof(string), "~r~%s is on rampage!", kName);
  293. GameTextForAll(string, 1000, 1);
  294. GivePlayerMoney(playerid,5000);
  295. return 1;
  296. }
  297. if (PlayerKills[killerid] == 8) {
  298. format(string, sizeof(string), "~r~%s is on killing spree!", kName);
  299. GameTextForAll(string, 1000, 1);
  300. return 1;
  301. }
  302. if (PlayerKills[killerid] == 10) {
  303. format(string, sizeof(string), "~r~monster kill %s!", kName);
  304. GameTextForAll(string, 1000, 1);
  305. GivePlayerMoney(playerid,5000);
  306. return 1;
  307. }
  308. if (PlayerKills[killerid] == 12) {
  309. format(string, sizeof(string), "~r~%s is unstoppable!", kName);
  310. GameTextForAll(string, 1000, 1);
  311. return 1;
  312. }
  313. if (PlayerKills[killerid] == 14) {
  314. format(string, sizeof(string), "~r~ultra kill %s!", kName);
  315. GameTextForAll(string, 1000, 1);
  316. return 1;
  317. }
  318. if (PlayerKills[killerid] == 16) {
  319. format(string, sizeof(string), "~r~%s is godlike!", kName);
  320. GameTextForAll(string, 1000, 1);
  321. return 1;
  322. }
  323. if (PlayerKills[killerid] == 18) {
  324. format(string, sizeof(string), "~r~wicked sick %s!", kName);
  325. GameTextForAll(string, 1000, 1);
  326. return 1;
  327. }
  328. if (PlayerKills[killerid] == 20) {
  329. format(string, sizeof(string), "~r~ludicrous kill %s!", kName);
  330. GameTextForAll(string, 1000, 1);
  331. GivePlayerMoney(playerid,50000);
  332. return 1;
  333. }
  334. if (PlayerKills[killerid] == 24) {
  335. format(string, sizeof(string), "~r~holy shit %s!", kName);
  336. GameTextForAll(string, 1000, 1);
  337. return 1;
  338. }
  339. return 1;
  340. }
Advertisement
Add Comment
Please, Sign In to add comment