Guest User

The Murderer

a guest
Sep 15th, 2015
531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 11.50 KB | None | 0 0
  1. /*
  2. * *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
  3. *                                   CREDITS :                       *
  4. *              ARRETDEFIL -   MRTOINOU -   I-ZCMD (YASHAS)          *
  5. *                                                                   *
  6. * *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *                                                                  *
  7. */
  8. #include <a_samp>
  9. #include <zcmd>
  10. #include <sscanf2>
  11. #define COLOR_GREY 0xAFAFAFAA
  12. #define COLOR_RED 0xAA3333AA
  13. #define COLOR_YELLOW 0xFFFF00AA
  14. #define COLOR_BLUE 0x0000BBAA
  15. #define COLOR_LIGHTBLUE 0x33CCFFAA
  16. #define COLOR_ORANGE 0xFF9900AA
  17. #define COLOR_RED 0xAA3333AA
  18.  
  19.  
  20. #define TEAM_MURDER     0
  21. #define TEAM_GUN        1
  22. #define TEAM_INNOCENT   2
  23.  
  24. #define PRESSED(%0) \
  25.     (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  26.    
  27. // <> <> <> <> <> <> <> <> <> TEXTDRAWS <> <> <> <> <> <> <> <>
  28. new Text:Textdraw0;
  29. new Text:Textdraw1;
  30. new Text:Textdraw2;
  31. new Text:Textdraw3;
  32. new Text:Textdraw4;
  33. new Text:Textdraw5;
  34. new PlayerText:Textdraw00[MAX_PLAYERS];
  35. new id;
  36. // <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <>
  37.  
  38. new points[MAX_PLAYERS];
  39. new Actor[MAX_ACTORS];
  40. new gPlayerTeam[MAX_PLAYERS];
  41. new Float:RandomSpawns[][] =
  42. {
  43.     {1278.6624,-813.8312,1085.6328},
  44.     {1294.1095,-827.7710,1085.6328},
  45.     {1247.9601,-820.7675,1084.0078},
  46.     {1234.9125,-824.3225,1083.1563},
  47.     {1234.9871,-809.2429,1084.0078},
  48.     {1267.0770,-813.1758,1084.0078},
  49.     {1272.4529,-813.3427,1084.0078},
  50.     {1284.8055,-801.5486,1084.0078},
  51.     {1284.4454,-787.0720,1084.0078},
  52.     {1267.0936,-795.9094,1084.0078},
  53.     {1240.1737,-780.3179,1084.0149},
  54.     {1249.0775,-765.6386,1084.0156},
  55.     {1266.4635,-782.5561,1084.0078},
  56.     {1262.3259,-782.5859,1084.0078},
  57.     {1290.5151,-766.2123,1084.0078},
  58.     {1280.5310,-783.5627,1084.0078}
  59. };
  60. new RandomTeams[][] =
  61. {
  62.     {TEAM_MURDER},
  63.     {TEAM_GUN},
  64.     {TEAM_INNOCENT}
  65. };
  66.  
  67.  
  68. main()
  69. {
  70.     print("\n<> <> <> <> <> <> <> <> <> <> <> <> ");
  71.     print(" <> <> <>  The Murderer <> <> <> <> ");
  72.     print("<> <> <> <> <> <> <> <> <> <> <> <> \n");
  73. }
  74.  
  75. // <> <> <> <> <> <> <> <> <> <> ZCMD COMMANDS  <> <> <> <> <> <> <> <> <> <> <> <> <>
  76. CMD:kill(playerid,params[]) { SetPlayerHealth(playerid,0.0); return 1; }
  77.  
  78. CMD:givecred(playerid,params[])
  79. {
  80.     SendClientMessage(playerid,COLOR_YELLOW,"+10 free points !");
  81.     points[playerid]+=10;
  82.     new getpoints[16]; format(getpoints,sizeof(getpoints),"%d",points[playerid]);
  83.     PlayerTextDrawSetString(playerid, Textdraw00[playerid], getpoints);
  84.     return 1;
  85. }
  86.    
  87.    
  88. CMD:qg(playerid,params[])
  89. {
  90.     SetPlayerInterior(playerid,5);
  91.     SetPlayerPos(playerid,1267.663208,-781.323242,1091.906250);
  92.     return 1;
  93. }
  94. CMD:team(playerid,params[])
  95. {
  96.     if(gPlayerTeam[playerid] == 0) { SendClientMessage(playerid,-1,"Team MURDER"); }
  97.     if(gPlayerTeam[playerid] == 1) { SendClientMessage(playerid,-1,"Team GUN"); }
  98.     if(gPlayerTeam[playerid] == 2) { SendClientMessage(playerid,-1,"Team INNOCENT"); }
  99.     return 1;
  100. }
  101.  
  102.  
  103. public OnGameModeInit()
  104. {
  105.     ShowPlayerMarkers(0);
  106.    
  107.     Textdraw0 = TextDrawCreate(560.399000, 7.874948, "The Murderer");
  108.     TextDrawLetterSize(Textdraw0, 0.309999, 1.454168);
  109.     TextDrawTextSize(Textdraw0, 639.375000, 17.499996);
  110.     TextDrawAlignment(Textdraw0, 1);
  111.     TextDrawColor(Textdraw0, -1);
  112.     TextDrawSetShadow(Textdraw0, 0);
  113.     TextDrawSetOutline(Textdraw0, 1);
  114.     TextDrawBackgroundColor(Textdraw0, 51);
  115.     TextDrawFont(Textdraw0, 1);
  116.     TextDrawSetProportional(Textdraw0, 1);
  117.  
  118.     Textdraw1 = TextDrawCreate(10.625000, 428.749969, "Murderer:");
  119.     TextDrawLetterSize(Textdraw1, 0.343749, 1.570833);
  120.     TextDrawAlignment(Textdraw1, 1);
  121.     TextDrawColor(Textdraw1, -1);
  122.     TextDrawSetShadow(Textdraw1, 0);
  123.     TextDrawSetOutline(Textdraw1, 1);
  124.     TextDrawBackgroundColor(Textdraw1, 51);
  125.     TextDrawFont(Textdraw1, 1);
  126.     TextDrawSetProportional(Textdraw1, 1);
  127.  
  128.     Textdraw2 = TextDrawCreate(71.875000, 429.333465, "-");
  129.     TextDrawLetterSize(Textdraw2, 0.381249, 1.512499);
  130.     TextDrawAlignment(Textdraw2, 1);
  131.     TextDrawColor(Textdraw2, 16711935);
  132.     TextDrawSetShadow(Textdraw2, 0);
  133.     TextDrawSetOutline(Textdraw2, 1);
  134.     TextDrawBackgroundColor(Textdraw2, 51);
  135.     TextDrawFont(Textdraw2, 1);
  136.     TextDrawSetProportional(Textdraw2, 1);
  137.  
  138.     Textdraw3 = TextDrawCreate(120.625000, 428.750030, "Deagle:");
  139.     TextDrawLetterSize(Textdraw3, 0.343749, 1.541666);
  140.     TextDrawAlignment(Textdraw3, 1);
  141.     TextDrawColor(Textdraw3, -1);
  142.     TextDrawSetShadow(Textdraw3, 0);
  143.     TextDrawSetOutline(Textdraw3, 1);
  144.     TextDrawBackgroundColor(Textdraw3, 51);
  145.     TextDrawFont(Textdraw3, 1);
  146.     TextDrawSetProportional(Textdraw3, 1);
  147.  
  148.     Textdraw4 = TextDrawCreate(170.000000, 431.083343, "-");
  149.     TextDrawLetterSize(Textdraw4, 0.399998, 1.395833);
  150.     TextDrawAlignment(Textdraw4, 1);
  151.     TextDrawColor(Textdraw4, 16711935);
  152.     TextDrawSetShadow(Textdraw4, 0);
  153.     TextDrawSetOutline(Textdraw4, 1);
  154.     TextDrawBackgroundColor(Textdraw4, 51);
  155.     TextDrawFont(Textdraw4, 1);
  156.     TextDrawSetProportional(Textdraw4, 1);
  157.  
  158.     Textdraw5 = TextDrawCreate(476.250000, 428.166625, "POINTS:");
  159.     TextDrawLetterSize(Textdraw5, 0.449999, 1.600000);
  160.     TextDrawAlignment(Textdraw5, 1);
  161.     TextDrawColor(Textdraw5, -1);
  162.     TextDrawSetShadow(Textdraw5, 0);
  163.     TextDrawSetOutline(Textdraw5, 1);
  164.     TextDrawBackgroundColor(Textdraw5, 51);
  165.     TextDrawFont(Textdraw5, 3);
  166.     TextDrawSetProportional(Textdraw5, 1);
  167.  
  168.     TextDrawShowForAll(Textdraw0);
  169.     TextDrawShowForAll(Textdraw1);
  170.     TextDrawShowForAll(Textdraw2);
  171.     TextDrawShowForAll(Textdraw3);
  172.     TextDrawShowForAll(Textdraw4);
  173.     TextDrawShowForAll(Textdraw5);
  174.    
  175.    
  176.     ShowNameTags(0);
  177.     SetGameModeText("The Murderer");
  178.     AddPlayerClass(160, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  179.     return 1;
  180. }
  181.  
  182. public OnGameModeExit()
  183. {
  184.     return 1;
  185. }
  186.  
  187. public OnPlayerRequestClass(playerid, classid)
  188. {
  189.     SetPlayerPos(playerid, 1281.0375,-829+20,1090.5938);
  190.     SetPlayerCameraPos(playerid, 1281.0375,-829.7905,1090.5938);
  191.     SetPlayerCameraLookAt(playerid, 1269.5922,-835.7245,1085.6328);
  192.     SetPlayerInterior(playerid,5);
  193.     return 1;
  194. }
  195.  
  196. public OnPlayerConnect(playerid)
  197. {
  198.     SetPlayerTime(playerid, 0, 0);
  199.     points[playerid] = 0;
  200.  
  201.     new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
  202.     GetPlayerName(playerid, name, sizeof(name));
  203.     format(string, sizeof(string), "%s has joined the server.", name);
  204.     SendClientMessageToAll(COLOR_GREY, string);
  205.    
  206.     Textdraw00[playerid] = CreatePlayerTextDraw(playerid, 541.875000, 429.916778, "0");
  207.     PlayerTextDrawLetterSize(playerid, Textdraw00[playerid], 0.449999, 1.600000);
  208.     PlayerTextDrawAlignment(playerid, Textdraw00[playerid], 2);
  209.     PlayerTextDrawColor(playerid, Textdraw00[playerid], -5963521);
  210.     PlayerTextDrawSetShadow(playerid, Textdraw00[playerid], 0);
  211.     PlayerTextDrawSetOutline(playerid, Textdraw00[playerid], 1);
  212.     PlayerTextDrawBackgroundColor(playerid, Textdraw00[playerid], 51);
  213.     PlayerTextDrawFont(playerid, Textdraw00[playerid], 1);
  214.     PlayerTextDrawSetProportional(playerid, Textdraw00[playerid], 1);
  215.     PlayerTextDrawShow(playerid, Textdraw00[playerid]);
  216.     return 1;
  217. }
  218.  
  219. public OnPlayerDisconnect(playerid, reason)
  220. {
  221.     new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
  222.     GetPlayerName(playerid, name, sizeof(name));
  223.     format(string, sizeof(string), "%s has left.", name);
  224.     SendClientMessageToAll(COLOR_GREY, string);
  225.     if(gPlayerTeam[playerid] == 0) // If Murderer disconnect
  226.     {
  227.     TextDrawSetString(Textdraw2, "-");
  228.     }
  229.         if(gPlayerTeam[playerid] == 1) // If Deagle disconnect
  230.     {
  231.     TextDrawSetString(Textdraw4, "-");
  232.     }
  233.     return 1;
  234. }
  235.  
  236. public OnPlayerSpawn(playerid)
  237. {
  238.     new Random = random(sizeof(RandomSpawns));
  239.     SetPlayerInterior(playerid,5);
  240.     SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
  241.     new RandomTeam = random(3);
  242.     gPlayerTeam[playerid] = RandomTeams[RandomTeam][0];
  243.    
  244.     if(gPlayerTeam[playerid] == 0)
  245.     {
  246.         TextDrawSetString(Textdraw2, "Alive");
  247.         SendClientMessage(playerid,COLOR_RED,"You're the murderer, be quiet and kill the other players ! Try to not be spotted by the Deagle");
  248.         GivePlayerWeapon(playerid,4,1);
  249.     }
  250.    
  251.     if(gPlayerTeam[playerid] == 1)
  252.     {
  253.         TextDrawSetString(Textdraw4, "Alive");
  254.         SendClientMessage(playerid,COLOR_YELLOW,"You're the Deagle, find the murderer and kill him !");
  255.         GivePlayerWeapon(playerid,24,200);
  256.     }
  257.    
  258.     if(gPlayerTeam[playerid] == 2)
  259.     {
  260.         SendClientMessage(playerid,-1,"You're the civilian, get away from the murderer ");
  261.     }
  262.     return 1;
  263. }
  264.  
  265. public OnPlayerDeath(playerid, killerid, reason)
  266. {
  267.  
  268.     if(gPlayerTeam[playerid] == 0) // If Murderer died
  269.     {
  270.         TextDrawSetString(Textdraw2, "-");
  271.     }
  272.    
  273.     if(gPlayerTeam[killerid] == 0) // If Murdered someone
  274.     {
  275.         SendClientMessage(killerid,COLOR_RED,"+1 point");
  276.         points[killerid]+=1;
  277.         new getpoints[16]; format(getpoints,sizeof(getpoints),"%d",points[killerid]);
  278.         PlayerTextDrawSetString(killerid, Textdraw00[killerid], getpoints);
  279.     }
  280.    
  281.     if(gPlayerTeam[killerid] == 0 && gPlayerTeam[playerid] == 1) // If Murderer killed Deagle
  282.     {
  283.         SendClientMessage(killerid,COLOR_RED,"+2 points, for killing the Deagle !");
  284.         points[killerid]+=2;
  285.         new getpoints[16]; format(getpoints,sizeof(getpoints),"%d",points[killerid]);
  286.         PlayerTextDrawSetString(killerid, Textdraw00[killerid], getpoints);
  287.         TextDrawSetString(Textdraw4, "-");
  288.         }
  289.    
  290.    
  291.     if(gPlayerTeam[playerid] == 1) // If Deagle died
  292.     {
  293.         SendClientMessage(playerid,-1,"You're not a Deagle anymore");
  294.         TextDrawSetString(Textdraw4, "-");
  295.     }
  296.    
  297.     if(gPlayerTeam[playerid] == 0 && gPlayerTeam[killerid] == 1) // If Deagle kill Murderer
  298.     {
  299.         SendClientMessage(playerid,-1,"You killed the murderer ! +2 points");
  300.         points[playerid]+=2;
  301.         new getpoints[16]; format(getpoints,sizeof(getpoints),"%d",points[playerid]);
  302.         PlayerTextDrawSetString(playerid, Textdraw00[playerid], getpoints);
  303.         TextDrawSetString(Textdraw2, "-");
  304.         if(points[playerid] >=8) { SendClientMessage(playerid,-1,"You can now create a clone by pressing N"); }
  305.  
  306.     }
  307.    
  308.     return 1;
  309. }
  310. public OnPlayerRequestSpawn(playerid)
  311. {
  312.     SpawnPlayer(playerid);
  313.     return 1;
  314. }
  315. public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float: amount, weaponid, bodypart)
  316. {
  317. /*
  318.     if(gPlayerTeam[playerid] == 0) {
  319.     SendClientMessage(playerid,COLOR_RED,"It is a clone .. ");
  320.     SetActorHealth(damaged_actorid,0);
  321.     }
  322.     else { SendClientMessage(playerid,COLOR_YELLOW,"It's a clone, let it alone !"); SetActorHealth(damaged_actorid,100); } */
  323.     return 1;
  324. }
  325. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  326. {
  327.     if(gPlayerTeam[playerid] == 1 && gPlayerTeam[hitid] == 2)
  328.     {
  329.         SendClientMessage(playerid,COLOR_ORANGE,"Oops ! You didn't shoot the murderer, you died !");
  330.         SetPlayerHealth(playerid,0);
  331.         SetPlayerHealth(hitid,100);
  332.     }
  333.  
  334.     return 1;
  335. }
  336.  
  337. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
  338. {
  339.  
  340.     return 1;
  341. }
  342. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  343. {
  344.     if(PRESSED(KEY_NO))
  345.     {
  346.         if(gPlayerTeam[playerid] == 1)
  347.         {
  348.             if(points[playerid]>=8)
  349.             {
  350.                 SendClientMessage(playerid,COLOR_RED,"You've just created a clone !");
  351.                 new Float:angle; GetPlayerFacingAngle(playerid, angle);
  352.                 new Float:x,Float:y,Float:z; GetPlayerPos(playerid,x,y,z);
  353.                 new skin; skin = GetPlayerSkin(playerid);
  354.                 id = playerid;
  355.                 Actor[id] = CreateActor(skin, x, y+2, z, angle);
  356.                 points[playerid]=points[playerid]-8;
  357.                 new getpoints[16]; format(getpoints,sizeof(getpoints),"%d",points[playerid]);
  358.                 PlayerTextDrawSetString(playerid, Textdraw00[playerid], getpoints);
  359.             }
  360.         }
  361.     }
  362.     return 1;
  363. }
  364.  
  365. public OnPlayerUpdate(playerid)
  366. {
  367.     return 1;
  368. }
Advertisement
Add Comment
Please, Sign In to add comment