Advertisement
Guest User

Chat

a guest
Apr 30th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.17 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <csstats>
  4. #include <colorchat>
  5.  
  6. #define MAXRANG 14
  7.  
  8. enum _:CHAT
  9. {
  10.     Rang[32],
  11.     Cost[8]
  12. }
  13.  
  14. new const rangok[MAXRANG][CHAT] = {
  15.     {"AmatĹ‘r", 0},
  16.     {"KezdĹ‘", 25},
  17.     {"Lelkes", 75},
  18.     {"JátĂ©kos", 150},
  19.     {"Kocka", 250},
  20.     {"FĂ©l-profi", 420},
  21.     {"Profi", 600},
  22.     {"EdzĹ‘", 850},
  23.     {"FelsĹ‘bbrendű", 1200},
  24.     {"TermĂ©szetfeletti", 1600},
  25.     {"FĂ©listen", 2000},
  26.     {"MindenhatĂł", 2500},
  27.     {"ISTEN", 3500},
  28.     {"MLG Profi", 4000}
  29. }
  30. new szint[33]
  31.  
  32. #define GetBit(%1,%2)       (%1 & (1 << (%2 & 31)))
  33. #define SetBit(%1,%2)       %1 |= (1 << (%2 & 31))
  34. #define ResetBit(%1,%2)     %1 &= ~(1 << (%2 & 31))
  35.  
  36. new bitadmin, bitelo;
  37.  
  38. public plugin_init() {
  39.     register_plugin("Chat", "1.1", "neygomon & mforce, LyleChriss edit")
  40.    
  41.     register_clcmd("say", "HandlerSay");
  42.     register_clcmd("say_team", "HandlerSayTeam");
  43.     register_clcmd("say /rang", "RangKiir");
  44.  
  45.     register_event("ResetHUD", "eResetHUD", "be");
  46.     register_event("DeathMsg", "eDeathMsg", "a", "1>0");
  47. }
  48.  
  49. public RangKiir(id)
  50. {
  51.     new szStats[8],szBHits[8];
  52.     get_user_stats(id,szStats,szBHits);
  53.    
  54.     ColorChat(id, NORMAL, "^4[West Side] ^1Jelenlegi rangod: ^4%s ^1| Ă–lĂ©seid: ^3%d ^1| KövetkezĹ‘ rang: ^4%s ^1| SzĂĽksĂ©ges ölĂ©sek: ^3%d", rangok[szint[id]][Rang], szStats[0], rangok[szint[id]+1][Rang], rangok[szint[id]+1][Cost]-szStats[0])
  55. }
  56.  
  57.  
  58. public client_putinserver(id)
  59. {
  60.     szint[id] = 0
  61.    
  62.     if(get_user_flags(id) & ADMIN_CHAT) SetBit(bitadmin, id);
  63.     else ResetBit(bitadmin, id);
  64. }
  65.  
  66. public client_disconnect(id)
  67. {
  68.     ResetBit(bitelo, id);
  69.     szint[id] = 0
  70. }
  71.  
  72. public eResetHUD(id, level, cid) {
  73.     SetBit(bitelo, id);
  74.    
  75.     new szStats[8],szBHits[8];
  76.     get_user_stats(id,szStats,szBHits);
  77.     while(szStats[0] >= rangok[szint[id]+1][Cost]&&szint[id]<MAXRANG)
  78.         szint[id]++
  79.    
  80.     return PLUGIN_CONTINUE
  81. }
  82.  
  83. public eDeathMsg()      ResetBit(bitelo, read_data(2));
  84.  
  85. public HandlerSay(id) return uzenetformazas(id, false);
  86. public HandlerSayTeam(id) return uzenetformazas(id, true);
  87.  
  88. uzenetformazas(id, bool:csapat)
  89. {
  90. #define MAX_BIT 180
  91.     static uzenet[MAX_BIT], stringkonvertalas[charsmax(uzenet) * 2 + 1];
  92.     read_args(uzenet, charsmax(uzenet));
  93.     remove_quotes(uzenet);
  94.  
  95.     if(uzenet[0] == EOS || uzenet[0] == '/' || equal(uzenet, " "))
  96.         return PLUGIN_HANDLED_MAIN;
  97.  
  98.     static fullos, tagek[MAX_BIT], team_lekeres, sTeam[16];
  99.     team_lekeres  = get_user_team(id, sTeam, charsmax(sTeam));
  100.  
  101.     switch(team_lekeres)
  102.     {
  103.         case 1: fullos = formatex(tagek, charsmax(tagek), "%s%s", GetBit(bitelo, id) ? "^1" : "^1*Halott* ", csapat ? "^1[T] " : "");
  104.         case 2: fullos = formatex(tagek, charsmax(tagek), "%s%s", GetBit(bitelo, id) ? "^1" : "^1*Halott* ", csapat ? "^1[CT] " : "");
  105.         default:fullos = formatex(tagek, charsmax(tagek), "^1*Spec* ");
  106.     }
  107.    
  108.     new stats[8], bodyhits[8]
  109.     new iRank;
  110.     iRank = get_user_stats(id, stats, bodyhits)
  111.    
  112.     if(get_user_flags(id)&ADMIN_RCON)
  113.         fullos += formatex(tagek[fullos], charsmax(tagek)-fullos, "^4[Tulaj]")
  114.     else if(get_user_flags(id)&ADMIN_CVAR)
  115.         fullos += formatex(tagek[fullos], charsmax(tagek)-fullos, "^4[FĹ‘admin]")
  116.     else if((get_user_flags(id)&ADMIN_BAN) && (get_user_flags(id)&ADMIN_LEVEL_H))
  117.         fullos += formatex(tagek[fullos], charsmax(tagek)-fullos, "^4[Admin+VIP]")
  118.     else if(get_user_flags(id)&ADMIN_BAN)
  119.         fullos += formatex(tagek[fullos], charsmax(tagek)-fullos, "^4[Admin]")
  120.     else if(get_user_flags(id)&ADMIN_LEVEL_H)
  121.         fullos += formatex(tagek[fullos], charsmax(tagek)-fullos, "^4[VIP]")
  122.     else if(iRank && iRank == 1)
  123.         fullos += formatex(tagek[fullos], charsmax(tagek)-fullos, "^4[TOP1]")
  124.    
  125.     fullos += formatex(tagek[fullos], charsmax(tagek)-fullos, "^4[%s]", rangok[szint[id]][Rang])
  126.    
  127.     if(is_user_admin(id) || (iRank && iRank == 1))  fullos += formatex(tagek[fullos], charsmax(tagek) - fullos, "^3%%s1^1 :  ^4%%s2");
  128.     else    formatex(tagek[fullos], charsmax(tagek) - fullos, "^3%%s1^1 :  %%s2");
  129.    
  130.     stringkonvertalas = uzenet;
  131.     replace_all( stringkonvertalas, charsmax( stringkonvertalas ), "", " " );
  132.     replace_all( stringkonvertalas, charsmax( stringkonvertalas ), "", " " );
  133.  
  134.     static bitlimit; bitlimit = MAX_BIT;
  135.     while(fullos + strlen(stringkonvertalas) > MAX_BIT) stringkonvertalas[bitlimit -= 10] = 0;
  136.  
  137.     static players[32], pcount; get_players(players, pcount, "c");
  138.     switch(csapat)
  139.     {
  140.         case true:
  141.         {
  142.             for(new i; i < pcount; i++)
  143.             {              
  144.                 if(GetBit(bitadmin, players[i]) || (GetBit(bitelo, id) == GetBit(bitelo, players[i]) && team_lekeres == get_user_team(players[i])))
  145.                     PrintChat(players[i], id, tagek, stringkonvertalas);
  146.             }                              
  147.         }
  148.         case false:
  149.         {  
  150.             for(new i; i < pcount; i++)
  151.                 PrintChat(players[i], id, tagek, stringkonvertalas);
  152.         }
  153.     }
  154.     static sAuthId[25], sName[32];
  155.     get_user_name(id, sName, charsmax(sName));
  156.     get_user_authid(id, sAuthId, charsmax(sAuthId));
  157.     log_message("^"%s<%d><%s><%s>^" %s ^"%s^"", sName, get_user_userid(id), sAuthId, sTeam, csapat ? "say_team" : "say" , stringkonvertalas);  
  158.     return PLUGIN_HANDLED;
  159. }
  160.  
  161. PrintChat(iReceiver, iSender, const tagek[], const uzenet[])
  162. {
  163.     message_begin(MSG_ONE, 76, .player=iReceiver);
  164.     write_byte(iSender);
  165.     write_string(tagek);
  166.     write_string("");
  167.     write_string(uzenet);
  168.     message_end();
  169. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement