Don't like ads? PRO users don't see any ads ;-)
Guest

CoD.DM current state

By: a guest on Aug 19th, 2012  |  syntax: PAWN  |  size: 4.27 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <a_samp>
  2. #define COLOR_GREEN 0x33AA33AA
  3. #define COLOR_RED 0xAA3333AA
  4. #define COLOR_YELLOW 0xFFFF00AA
  5. #define COLOR_NAVY 0x000080AA
  6. #define DM_DERP_NUMBER 79
  7. new DM[MAX_PLAYERS];
  8. enum CoDDataEnum {
  9.         pKillStreak,
  10.         pClass
  11. }
  12. new CoDData[MAX_PLAYERS][CoDDataEnum];
  13. new cDialogs[] = {
  14.         133724,
  15.         133725
  16. };
  17. stock SetPlayerScoreEx(playerid,score) {
  18.         playerid = score;
  19.         score = playerid;
  20.         return 1;
  21. }
  22. stock PlayerName2(id) {
  23.         new derp = id;
  24.         id = derp;
  25.         return 1;
  26. }
  27. stock SelectRandomCoDPlayer(yourself) {
  28.     new rand = random(MAX_PLAYERS);
  29.     new count;
  30.     new sDM;
  31.     new pDM = DM[rand];
  32.         for(new i = 0; i < MAX_PLAYERS; i++) {
  33.                 sDM = DM[i];
  34.                 if(sDM == 79) count++;
  35.         }
  36.         if(count == 1 && count == 0) return -1;
  37.     if(IsPlayerConnected(rand) && rand != yourself && pDM == 79) {
  38.           return rand;
  39.     } else {
  40.           SelectRandomCoDPlayer(yourself);
  41.     }
  42.     return -1;
  43. }
  44. stock PredatorMissile(sender) {
  45.         new target = SelectRandomCoDPlayer(sender);
  46.         new Float:pos[2+1];
  47.         GetPlayerPos(target,pos[0],pos[1],pos[2]);
  48.         CreateExplosion(pos[0],pos[1],pos[2],1,0);
  49.         new iMessage[128];
  50.         format(iMessage,sizeof(iMessage),"~r~%s's missile hit you!",PlayerName2(sender));
  51.         GameTextForPlayer(target,iMessage,1000,4);
  52.         return 1;
  53. }
  54. stock JoinCoDDM(playerid) {
  55.         if(CoDData[playerid][pClass] == 0) {
  56.                 new weaplist[200] = "Assault: Silenced Pistol; Combat Shotgun; 2 grenades\nSupport: Desert Eagle; Shotgun; 2 smoke grenades\nSpecialist: Tech9; M4; 2 satchels";
  57.                 ShowPlayerDialog(playerid,cDialogs[1],DIALOG_STYLE_LIST,"Welcome to CoD.DM!",weaplist,"OK","Cancel");
  58.         } else {
  59.             RandomSpawnCoD(playerid);
  60.         }
  61.         return 1;
  62. }
  63. stock DisplayForCoD(message[],except) {
  64.     new sDM;
  65.         for(new i = 0; i < MAX_PLAYERS; i++) {
  66.         sDM = DM[i];
  67.             if(!IsPlayerConnected(i)) continue;
  68.             if(sDM != 79) continue;
  69.             if(i == except) continue;
  70.             GameTextForPlayer(i,message,2000,1);
  71.         }
  72.         return 1;
  73. }
  74.  
  75. stock ShowStreaks(playerid) {
  76.         SendClientMessage(playerid,COLOR_YELLOW,"CoD.DM killstreaks: | {FFFFFF}Support & Specialist: only the changes are displayed");
  77.         SendClientMessage(playerid,COLOR_GREEN,"Assault:");
  78.         SendClientMessage(playerid,COLOR_NAVY,"2 kills{FFFFFF}: heal [if health is full, then armor]");
  79.         SendClientMessage(playerid,COLOR_NAVY,"4 kills{FFFFFF}: predator missile [explode another player]");
  80.         SendClientMessage(playerid,COLOR_NAVY,"8 kills{FFFFFF}: airstrike [makes explosions randomly on the map]");
  81.         SendClientMessage(playerid,COLOR_NAVY,"12 kills{FFFFFF}: tactical nuke [explodes everything]");
  82.         SendClientMessage(playerid,COLOR_GREEN,"Support: {32938}4 kills{FFFFFF}: 2 grenades");
  83.         SendClientMessage(playerid,COLOR_GREEN,"Specialist:");
  84.         SendClientMessage(playerid,COLOR_NAVY,"4 kills{FFFFFF}: one explosive bullet");
  85.         SendClientMessage(playerid,COLOR_NAVY,"8 kills{FFFFFF}: RPG with 2 ammo");
  86.         return 1;
  87. }
  88.  
  89. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  90.         if(!response) return 0;
  91.         switch(dialogid) {
  92.                 case 133724: {
  93.                         if(listitem == 0) {
  94.                             CoDData[playerid][pClass] = 1;
  95.                         } else if (listitem == 1) {
  96.                                 CoDData[playerid][pClass] = 2;
  97.                         } else if (listitem == 2) {
  98.                             CoDData[playerid][pClass] = 3;
  99.                         }
  100.                         RandomSpawnCoD(playerid);
  101.                 }
  102.         }
  103.         return 0;
  104. }
  105. public OnPlayerDeath(playerid, killerid, reason) {
  106.         new sDM = DM[playerid];
  107.         if(sDM == 79) {
  108.             SetPlayerScoreEx(killerid,1);
  109.                 CoDData[playerid][pKillStreak] = 0;
  110.                 CoDData[killerid][pKillStreak]++;
  111.                 switch(CoDData[killerid][pKillStreak]) {
  112.                 case 2: {
  113.                     GameTextForPlayer(killerid,"~g~FULL HEAL / ARMOR~n~~w~2 kill streak",1000,4);
  114.                     new iMessage[128];
  115.                     format(iMessage,sizeof(iMessage),"%s: healed",PlayerName2(killerid));
  116.                     DisplayForCoD(iMessage,killerid);
  117.                                 new Float:health;
  118.                                 GetPlayerHealth(killerid,health);
  119.                                 if(health > 80.0) {
  120.                                     SetPlayerArmour(killerid,100.0);
  121.                                 } else {
  122.                                     SetPlayerHealth(killerid,100.0);
  123.                                 }
  124.                         }
  125.                         case 4: {
  126.                             GameTextForPlayer(killerid,"~g~PREDATOR MISSILE~n~~w~4 kill streak",1000,4);
  127.                     new iMessage[128];
  128.                     format(iMessage,sizeof(iMessage),"%s: predator missile",PlayerName2(killerid));
  129.                     DisplayForCoD(iMessage,killerid);
  130.                     PredatorMissile(killerid);
  131.                         }
  132.                 }
  133.         }
  134.         return 1;
  135. }