Advertisement
Inshal

iRanks + K.S system

Mar 3rd, 2014
747
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.74 KB | None | 0 0
  1. //=========================iRANKS and Killing Spree System======================
  2. //======================Please donot remove credits=============================
  3. //========================Filterscript is made by inshal========================
  4.  
  5.  
  6. #include <a_samp>
  7. #include <dini>
  8.  
  9. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  10.  
  11. new Text:iRank[MAX_PLAYERS],Text:Stats[MAX_PLAYERS];
  12. new PlayerTotalKills[MAX_PLAYERS] = 0;
  13. new string[128];
  14.  
  15. #define COLOR_YELLOW            0xFFFF00AA
  16. #define COLOR_PINK              0xFF66FFAA
  17. #define COLOR_AQUA              0x7CFC00AA
  18. #define COLOR_WHITE             0xFFFFFFAA
  19. #define COLOR_RED 0xFF0000AA
  20. #define Ranks                   353
  21. new Kills[MAX_PLAYERS],Deaths[MAX_PLAYERS];
  22.  
  23. public OnFilterScriptInit()
  24. {
  25.     print("\n--------------------------------------");
  26.     print("--iRanks and Killing spree system v1.0--");
  27.     print("--------made by inshal - loaded---------");
  28.     print("--------------------------------------\n");
  29.  
  30.     if(!dini_Exists("Deaths.cfg"))
  31.     {
  32.       dini_Create("Deaths.cfg");
  33.     }
  34.  
  35.     if(!dini_Exists("Kills.cfg"))
  36.     {
  37.       dini_Create("Kills.cfg");
  38.     }
  39.  
  40.  
  41.     return 1;
  42. }
  43.  
  44. public OnFilterScriptExit()
  45. {
  46.     printf("*** Rank System Unloaded *** ");
  47.  
  48.     return 1;
  49. }
  50.  
  51.  
  52.  
  53.  
  54. public OnPlayerRequestClass(playerid, classid)
  55. {
  56.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  57.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  58.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  59.     return 1;
  60. }
  61.  
  62. public OnPlayerConnect(playerid)
  63. {
  64.  
  65.     new Pname[MAX_PLAYER_NAME];
  66.     GetPlayerName(playerid, Pname, MAX_PLAYER_NAME);
  67.     Deaths[playerid] = dini_Int("Deaths.cfg", Pname);
  68.     Kills[playerid] = dini_Int("Kills.cfg", Pname);
  69.     new Name[MAX_PLAYER_NAME];
  70.     GetPlayerName(playerid,Name,sizeof(Name));
  71.     SendClientMessage(playerid,COLOR_AQUA,"Welcome to the server! iRank and Killing Spree System by inshal is being used!");
  72.     iRank[playerid] = TextDrawCreate(498.000000, 100.000000, " ");
  73.     TextDrawBackgroundColor(iRank[playerid], 255);
  74.     TextDrawFont(iRank[playerid], 2);
  75.     TextDrawLetterSize(iRank[playerid], 0.250000, 0.899999);
  76.     TextDrawColor(iRank[playerid], -1);
  77.     TextDrawSetOutline(iRank[playerid], 0);
  78.     TextDrawSetProportional(iRank[playerid], 1);
  79.     TextDrawSetShadow(iRank[playerid], 1);
  80.  
  81.     Stats[playerid] = TextDrawCreate(499.000000, 110.000000, "~r~Kills: ~w~0 ~g~Deaths: ~w~0");
  82.     TextDrawBackgroundColor(Stats[playerid], 255);
  83.     TextDrawFont(Stats[playerid], 2);
  84.     TextDrawLetterSize(Stats[playerid], 0.159999, 1.000000);
  85.     TextDrawColor(Stats[playerid], -1);
  86.     TextDrawSetOutline(Stats[playerid], 0);
  87.     TextDrawSetProportional(Stats[playerid], 1);
  88.     TextDrawSetShadow(Stats[playerid], 1);
  89.  
  90.  
  91.  
  92.     return 1;
  93. }
  94.  
  95. public OnPlayerDisconnect(playerid, reason)
  96. {
  97.  
  98.     new Pname[MAX_PLAYER_NAME];
  99.     GetPlayerName(playerid, Pname, MAX_PLAYER_NAME);
  100.     dini_IntSet("Deaths.cfg", Pname, Deaths[playerid]);
  101.     dini_IntSet("Kills.cfg", Pname, Kills[playerid]);
  102.     return 1;
  103. }
  104.  
  105. public OnPlayerSpawn(playerid)
  106. {
  107.     TextDrawShowForPlayer(playerid,Text:Stats[playerid]);
  108.     TextDrawShowForPlayer(playerid,Text:iRank[playerid]);
  109.     return 1;
  110. }
  111.  
  112. public OnPlayerDeath(playerid, killerid, reason)
  113. {
  114.     Kills[killerid]++;
  115.     Deaths[playerid]++;
  116.     new Name[128];
  117.     GetPlayerName(killerid, Name, sizeof(Name));
  118.     PlayerTotalKills[killerid]++;
  119.     PlayerTotalKills[playerid] = 0;
  120.     if(PlayerTotalKills[killerid] == 1) {
  121.         PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/firstblood.mp3");
  122.         format(string,sizeof(string),"%s has killed 1 player (FIRST BLOOD)",Name);
  123.         SendClientMessageToAll(COLOR_RED,string);
  124.     }
  125.     if(PlayerTotalKills[killerid] == 2) {
  126.         PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/doublekill.mp3");
  127.         format(string,sizeof(string),"%s has killed 2 players without getting killed (DOUBLE KILL)",Name);
  128.         SendClientMessageToAll(COLOR_RED,string);
  129.         return 1;
  130.     }
  131.     if(PlayerTotalKills[killerid] == 3) {
  132.         PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/triplekill.mp3");
  133.         format(string,sizeof(string),"%s has killed 3 players without getting killed (TRIPLE KILL)",Name);
  134.         SendClientMessageToAll(COLOR_RED,string);
  135.         return 1;
  136.     }
  137.     if(PlayerTotalKills[killerid] == 4) {
  138.         PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/dominating.mp3");
  139.         format(string,sizeof(string),"%s has killed 4 players without getting killed (DOMINATING)",Name);
  140.         SendClientMessageToAll(COLOR_RED,string);
  141.         return 1;
  142.     }
  143.     if(PlayerTotalKills[killerid] == 5) {
  144.         PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/killingspree.mp3");
  145.         format(string,sizeof(string),"%s has killed 5 players without getting killed (KILLING SPREE)",Name);
  146.         SendClientMessageToAll(COLOR_RED,string);
  147.         return 1;
  148.     }
  149.     if(PlayerTotalKills[killerid] == 7) {
  150.         PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/monsterkill.mp3");
  151.         format(string,sizeof(string),"%s has killed 7 players without getting killed (MONSTER KILL)",Name);
  152.         SendClientMessageToAll(COLOR_RED,string);
  153.         return 1;
  154.     }
  155.     if(PlayerTotalKills[killerid] == 9) {
  156.         PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/wickedsick.mp3");
  157.         format(string,sizeof(string),"%s has killed 9 players without getting killed (WICKED SICK)",Name);
  158.         SendClientMessageToAll(COLOR_RED,string);
  159.         return 1;
  160.     }
  161.     if(PlayerTotalKills[killerid] == 11) {
  162.         PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/ludicrouskill.mp3");
  163.         format(string,sizeof(string),"%s has killed 11 players without getting killed (LUDICROUS KILL)",Name);
  164.         SendClientMessageToAll(COLOR_RED,string);
  165.         return 1;
  166.     }
  167.     if(PlayerTotalKills[killerid] == 13) {
  168.         PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/ultrakill.mp3");
  169.         format(string,sizeof(string),"%s has killed 13 players without getting kiled (ULTRA KILL)",Name);
  170.         SendClientMessageToAll(COLOR_RED,string);
  171.         return 1;
  172.     }
  173.     if(PlayerTotalKills[killerid] == 15) {
  174.         PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/unstoppable.mp3");
  175.         format(string,sizeof(string),"%s has killed 15 players without getting killed (UNSTOPPABLE)",Name);
  176.         SendClientMessageToAll(COLOR_RED,string);
  177.         return 1;
  178.     }
  179.     return 1;
  180. }
  181.  
  182. dcmd_ranks( playerid, params[])
  183. {
  184.     #pragma unused params
  185.     ShowPlayerDialog(playerid, 35, DIALOG_STYLE_LIST, "iRANKS", "Newbie\nSurvivor\nKill Streaker\nDeath Tech\nRambo\nKill Machine", "okay", "Cancel");
  186.     return 1;
  187. }
  188.  
  189. dcmd_icredits( playerid, params[])
  190. {
  191.     #pragma unused params
  192.     SendClientMessage(playerid, COLOR_AQUA, "iRanks v1.0 made by inshal");
  193.     return 1;
  194. }
  195.  
  196. public OnPlayerText(playerid, text[])
  197. {
  198.     return 1;
  199. }
  200.  
  201. public OnPlayerCommandText(playerid, cmdtext[])
  202. {
  203.     dcmd(ranks,5,cmdtext);
  204.     dcmd(icredits,8,cmdtext);
  205.  
  206.     return 0;
  207. }
  208.  
  209.  
  210. GetPlayerRank(playerid)
  211. {
  212.     if(Kills[playerid]<20)
  213.     {
  214.     TextDrawSetString(Text:iRank[playerid],"~r~RANK:~w~Newbie");
  215.     new Float:x,Float:y,Float:z;
  216.     new Text3D:label1 = Create3DTextLabel("RANK : Newbie", COLOR_RED,x,y,z, 40.0, 0, 0);
  217.     GetPlayerPos(playerid,x,y,z);
  218.     Attach3DTextLabelToPlayer(label1,playerid,0.0, 0.0, 0.7);
  219.     }
  220.     else if(Kills[playerid]<50 && Kills[playerid]>=20)
  221.     {
  222.     TextDrawSetString(Text:iRank[playerid],"~r~RANK:~w~Survivor");
  223.     new Float:x,Float:y,Float:z;
  224.     new Text3D:label2 = Create3DTextLabel("RANK : Survivor", COLOR_RED,x,y,z, 40.0, 0, 0);
  225.     GetPlayerPos(playerid,x,y,z);
  226.     Attach3DTextLabelToPlayer(label2,playerid,0.0, 0.0, 0.7);
  227.     }
  228.     else if(Kills[playerid]<100 && Kills[playerid]>=50)
  229.     {
  230.     TextDrawSetString(Text:iRank[playerid],"~r~RANK:~w~Kill Streaker");
  231.     new Float:x,Float:y,Float:z;
  232.     new Text3D:label3 = Create3DTextLabel("RANK : Kill Streaker", COLOR_RED,x,y,z, 40.0, 0, 0);
  233.     GetPlayerPos(playerid,x,y,z);
  234.     Attach3DTextLabelToPlayer(label3,playerid,0.0, 0.0, 0.7);
  235.     }
  236.     else if(Kills[playerid]<300 && Kills[playerid]>=100)
  237.     {
  238.     TextDrawSetString(Text:iRank[playerid],"~r~RANK:~w~Death Tech");
  239.     new Float:x,Float:y,Float:z;
  240.     new Text3D:label4 = Create3DTextLabel("RANK : Death Tech", COLOR_RED,x,y,z, 40.0, 0, 0);
  241.     GetPlayerPos(playerid,x,y,z);
  242.     Attach3DTextLabelToPlayer(label4,playerid,0.0, 0.0, 0.7);
  243.     }
  244.     else if(Kills[playerid]<600 && Kills[playerid]>=300)
  245.     {
  246.     TextDrawSetString(Text:iRank[playerid],"~r~RANK:~w~Rambo");
  247.     new Float:x,Float:y,Float:z;
  248.     new Text3D:label5 = Create3DTextLabel("RANK : Rambo", COLOR_RED,x,y,z, 40.0, 0, 0);
  249.     GetPlayerPos(playerid,x,y,z);
  250.     Attach3DTextLabelToPlayer(label5,playerid,0.0, 0.0, 0.7);
  251.     }
  252.     else if(Kills[playerid]>= 600)
  253.     {
  254.     TextDrawSetString(Text:iRank[playerid],"~r~RANK:~w~Kill Machine");
  255.     new Float:x,Float:y,Float:z;
  256.     new Text3D:label6 = Create3DTextLabel("RANK : Kill Machine", COLOR_RED,x,y,z, 40.0, 0, 0);
  257.     GetPlayerPos(playerid,x,y,z);
  258.     Attach3DTextLabelToPlayer(label6,playerid,0.0, 0.0, 0.7);
  259.     }
  260.     return 1;
  261. }
  262.  
  263. stock GetPlayerKills(playerid)
  264. {
  265.     return Kills[playerid];
  266. }
  267. stock GetPlayerDeaths(playerid)
  268. {
  269.     return Deaths[playerid];
  270. }
  271. public OnPlayerUpdate(playerid)
  272. {
  273.     new str[256];
  274.     format(str,sizeof(str),"~r~Kills: ~w~%d ~g~Deaths: ~w~%d",Kills[playerid],Deaths[playerid]);
  275.     TextDrawSetString(Text:Stats[playerid],str);
  276.     GetPlayerRank(playerid);
  277.     return 1;
  278. }
  279.  
  280. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  281. {
  282. if(response)
  283.     {
  284.     switch(dialogid)
  285.         {
  286.         case 35:
  287.             {
  288.             switch(listitem)// Checking which listitem was selected
  289.             {
  290.                 case 0:
  291.                 {
  292.                 SendClientMessage(playerid,COLOR_AQUA,"Newbie : For less than 20 kills.");
  293.                 }
  294.                 case 1: // The second item listed
  295.                 {
  296.                 SendClientMessage(playerid,COLOR_AQUA,"Survivor : For more than 20 kills and less than 50 kills. ");
  297.                 }
  298.                 case 2: // The third item listed
  299.                 {
  300.                 SendClientMessage(playerid,COLOR_AQUA,"Kill Streaker : For more than 50 kills and less than 100 kills. ");
  301.                 }
  302.                 case 3: // The third item listed
  303.                 {
  304.                 SendClientMessage(playerid,COLOR_AQUA,"Death Tech : For more than 100 kills and less than 300 kills. ");
  305.                 }
  306.                 case 4: // The fourth item listed
  307.                 {
  308.                 SendClientMessage(playerid,COLOR_AQUA,"Rambo : For more than 300 kills and less than 600 kills. ");
  309.                 }
  310.                 case 5: // The fifht item listed
  311.                 {
  312.                 SendClientMessage(playerid,COLOR_AQUA,"Kill Machine : For more than 600 kills. ");
  313.                 }
  314.             }
  315.             }
  316.     }
  317.     }
  318. return 1;
  319. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement