Advertisement
Hyuna

Terrorist Rank System By RegonizE [Hyuna Edit]

Nov 16th, 2012
517
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.04 KB | None | 0 0
  1. /*
  2.     Plugin built by RegonizE, Credit takers are lame.
  3.     P.s. Lykra or w/e is a noob faker thinks he is PRO.
  4.  
  5.     Hyuna [NorToN] Edit
  6.     Fixed
  7. */
  8.  
  9.  
  10. #include <amxmodx>
  11. #include <amxmisc>
  12. #include <fvault>
  13. #include <cstrike>
  14.  
  15. new const g_szVault [] = "TerrorRankSys";
  16. new KillsCount[33];
  17.  
  18. public plugin_init() {
  19.     register_plugin("Terrorist Rank System [Hyuna Edit]","1.0","RegonizE");
  20.  
  21.     register_clcmd("say", "HandleSay");
  22.     register_clcmd("say_team", "HandleSay");
  23.  
  24.     register_event("DeathMsg", "onClientDeath", "a");
  25. }
  26.  
  27. public client_putinserver(id) LoadKills(id);
  28. public client_disconnect(id) SaveKills(id);
  29.  
  30. public onClientDeath(){
  31.     new killer = read_data(1);
  32.     new victim = read_data(2);
  33.    
  34.     if(cs_get_user_team(killer) == CS_TEAM_T && cs_get_user_team(victim) == CS_TEAM_CT && !is_user_bot(killer) && !is_user_bot(victim))
  35.     {
  36.         KillsCount[killer]++;
  37.         ColorChat(killer, "You gained a^3 TPoint^1 for killing a CT. (^3 %d^1 kills)", KillsCount[killer]);
  38.     }
  39. }
  40.  
  41. public HandleSay(client){
  42.     new szMsg[128], Val[38], Val2[38];
  43.     read_argv(1, szMsg, charsmax(szMsg));
  44.     parse(szMsg, Val, charsmax(Val), Val2, charsmax(Val2));
  45.     new Rank[33];
  46.  
  47.     if(KillsCount[client] == 0)
  48.         formatex(Rank, charsmax(Rank), "Training Terroist");
  49.  
  50.     else if(KillsCount[client] >= 50)
  51.         formatex(Rank, charsmax(Rank), "Begginer Terroist");
  52.  
  53.     else if(KillsCount[client] >= 100)
  54.         formatex(Rank, charsmax(Rank), "Rage Terrorist");
  55.  
  56.     if(equali("/tsystem", Val))
  57.         ColorChat(client, "You have^3 %d^1 kills and your rank is:^3 %s", KillsCount[client], Rank[client]);
  58.  
  59.     else if(equali("/rank", Val))
  60.     {
  61.         new target = cmd_target(client, Val2, !CMDTARGET_ALLOW_SELF)
  62.         if(target)
  63.         {
  64.             new szName[33];
  65.             get_user_name(target, szName, charsmax(szName))
  66.             ColorChat(client, ">>^3 %s^1 own: Kills Count:^3 %d^1 Rank:^3 %s", szName, KillsCount[target], Rank[target])
  67.         }
  68.  
  69.         return 1;
  70.     }
  71.  
  72.     return 0;
  73.  
  74. }
  75.        
  76. public SaveKills(id){
  77.     if (!is_user_connected(id) || is_user_bot(id) || is_user_hltv(id))
  78.         return;
  79.    
  80.     new SteamID[35];
  81.     get_user_authid(id,SteamID,34);
  82.    
  83.     new szData[16];
  84.     num_to_str(KillsCount[id],szData,charsmax(szData));
  85.     fvault_set_data(g_szVault,SteamID,szData);
  86. }
  87.  
  88. public LoadKills(id){
  89.     if (!is_user_connected(id) || is_user_bot(id) || is_user_hltv(id))
  90.         return;
  91.    
  92.     new SteamID[35];
  93.     get_user_authid(id, SteamID, 34);
  94.    
  95.     new szData[16];
  96.     if(fvault_get_data(g_szVault,SteamID,szData,charsmax(szData)))
  97.         KillsCount[id] = str_to_num(szData);
  98.        
  99.     else
  100.         KillsCount[id] = 0;
  101. }
  102.  
  103. stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...) {
  104.     new msg[191], players[32], count = 1;
  105.    
  106.     static len;
  107.     len = formatex(msg, charsmax(msg), "^4[ TSystem ]^1 ");
  108.     vformat(msg[len], charsmax(msg) - len, string, 3)
  109.    
  110.     if(id)    players[0] = id;
  111.     else    get_players(players,count,"ch");
  112.    
  113.     for (new i = 0; i < count; i++)
  114.     {
  115.         if(is_user_connected(players[i]))
  116.         {
  117.             message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i]);
  118.             write_byte(players[i]);
  119.             write_string(msg);
  120.             message_end();
  121.         }
  122.     }
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement