Advertisement
Guest User

Untitled

a guest
Dec 7th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 14.47 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <cstrike>
  4. #include <engine>
  5. #include <fun>
  6. #include <colorchat>
  7.  
  8. #define PLUGIN "Diko Csoro Awp Mode"
  9. #define VERSION "1.0.0.0.0.0.0.0.0"
  10. #define AUTHOR "fasz"
  11.  
  12. new filename[128];
  13.  
  14. #define xCS_TEAM_CT 2
  15. #define xCS_TEAM_T 1
  16.  
  17. #define MAX 28
  18.  
  19. enum PlayerCases{
  20.     Common,
  21.     Limited,
  22.     Legendary,
  23.     Regular
  24.     //Giant,
  25.     //Super_Giant,
  26.     //Super_Body,
  27.     //Super_Part
  28. }
  29. new const Skins[MAX][]={
  30.     {"AWP | Abstract"},     //1
  31.     {"AWP | American"},     //2
  32.     {"AWP | Arany"},        //3
  33.     {"AWP | Asiimov"},      //4
  34.     {"AWP | Bloody"},       //5
  35.     {"AWP | Choijiyoonpaint"},      //6
  36.     {"AWP | Dragon"},       //7
  37.     {"AWP | Eagle"},        //8
  38.     {"AWP | Elitebuild"},       //9
  39.     {"AWP | Europa"},       //10
  40.     {"AWP | Feverdream"},       //11
  41.     {"AWP | Galaxy"},       //12
  42.     {"AWP | Grafit"},       //13
  43.     {"AWP | Hawking"},      //14
  44.     {"AWP | Hexo"},     //15
  45.     {"AWP | Magmaa"},       //16
  46.     {"AWP | Malaysia"},     //17
  47.     {"AWP | Medusa"},       //18
  48.     {"AWP | Metal"},        //19
  49.     {"AWP | Phoboss"},      //20
  50.     {"AWP | Pulzus"},       //21
  51.     {"AWP | Raptor"},       //22
  52.     {"AWP | Smoke"},        //23
  53.     {"AWP | Snow"},     //24
  54.     {"AWP | Star"},     //25
  55.     {"AWP | Tiger"},        //26
  56.     {"AWP | Tuz"},      //27
  57.     {"AWP | Wormgod"}       //28
  58. }
  59. new Osszesskin[MAX][33]
  60. new message[192]
  61. new nev[32]
  62. static color[10]
  63. new PlayersInventory[33][PlayerCases]
  64. new Kills[33 char][33 char]
  65. new KillStreak[33 char]
  66. new Kill_Skin[33],Exp[33],Level[33 char]
  67. new Temp[192]
  68.  
  69. new const RANKS_NAME[][]={
  70.     "Rusty",
  71.     "Wooden",
  72.     "Bronze",
  73.     "Silver",
  74.     "Gold",
  75.     "Emerald",
  76.     "Diamond",
  77.     "Nether",
  78.     "-"
  79. }
  80. new const RANKS_XP[]={
  81.     0,
  82.     500,
  83.     1200,
  84.     1500,
  85.     2999,
  86.     4000,
  87.     6000,
  88.     17000,
  89.     9999999999
  90. }
  91. public plugin_init() {
  92.     register_plugin(PLUGIN, VERSION, AUTHOR)
  93.    
  94.     get_localinfo("amxx_configsdir", filename, charsmax(filename))
  95.     format(filename, charsmax(filename), "%s/awp_mentes.ini", filename)
  96.    
  97.     //set_task(20.0,"hirdetes")
  98.    
  99.     register_impulse(100, "main_menu")
  100.    
  101.     register_clcmd("say", "sayhook")
  102.     register_clcmd("say_team", "tshook")
  103.     register_clcmd("say /drop","drop")
  104.     register_clcmd("say /nyitas","nyitas")
  105.     register_clcmd("say /rankom","rankod")
  106.    
  107.     register_event("DeathMsg", "OnPlayerKilled", "a")
  108.     register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")
  109.     register_event("HLTV", "on_new_round", "a", "1=0", "2=0")
  110. }
  111. public client_PreThink(id){
  112.     if(is_user_alive(id)){
  113.         if(Exp[id]>=17000){
  114.             set_hudmessage(0, 255, 85, -1.0, 0.86, 0, 6.0, 1.0)
  115.             show_hudmessage(id, "TP: %d | 17000 (MAX)",Exp[id])
  116.         }
  117.         else{
  118.             set_hudmessage(0, 255, 85, -1.0, 0.86, 0, 6.0, 1.0)
  119.             show_hudmessage(id, "TP: %d | %d",Exp[id],RANKS_XP[Level[id]+1])
  120.         }
  121.     }
  122. }
  123. public sayhook(id)
  124. {
  125.    
  126.     read_args (message, 191)
  127.     remove_quotes (message)
  128.     if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, ""))
  129.     {
  130.         return PLUGIN_CONTINUE
  131.     }
  132.     get_user_name(id, nev, 31)
  133.     if(is_user_alive(id)) {
  134.         get_user_team(id, color, 9)
  135.         formatex(Temp, 191, "^x04«^x01%s^x04» ^x03%s^x01: %s", RANKS_NAME[Level[id]], nev, message)
  136.        
  137.     }
  138.     else {
  139.         get_user_team(id, color, 9)
  140.         formatex(Temp, 191, "^x01*HALOTT* ^x04«^x01%s^x04» ^x03%s^x01: %s",RANKS_NAME[Level[id]], nev, message)
  141.     }
  142.     sendmessage(color)
  143.     return PLUGIN_HANDLED
  144. }
  145. public tshook(id)
  146. {
  147.     read_args (message, 191)
  148.     remove_quotes (message)
  149.     if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, ""))
  150.     {
  151.         return PLUGIN_CONTINUE
  152.     }
  153.     get_user_name(id, nev, 31)
  154.     new playerTeam = get_user_team(id)
  155.     new playerTeamName[19]
  156.     switch (playerTeam)
  157.     {
  158.         case 1: {
  159.             copy (playerTeamName, 11, "*T*")
  160.            
  161.         }
  162.         case 2: {
  163.             copy (playerTeamName, 18, "*CT*")
  164.            
  165.         }
  166.         default:
  167.         copy (playerTeamName, 9, "*SPEC*")
  168.     }
  169.     if(is_user_alive(id))
  170.     {
  171.         get_user_team(id, color, 9)
  172.         formatex(Temp, 191, "^x03(%s) ^x04«^x01%s^x04» ^x03%s^x01: %s",playerTeamName,RANKS_NAME[Level[id]], nev, message)
  173.        
  174.     }
  175.     else
  176.     {
  177.         get_user_team(id, color, 9)
  178.         formatex(Temp, 191, "^x04*HALOTT*^x03(%s) ^x04«^x01%s^x04» ^x04[%s] ^x03%s^x01: %s",playerTeamName,RANKS_NAME[Level[id]], nev, message)
  179.     }
  180.     sendtmessage(color, playerTeam)
  181.     return PLUGIN_HANDLED
  182. }
  183. public sendmessage(color[])
  184. {
  185.     new teamName[10]
  186.     for(new player = 1; player < get_maxplayers(); player++)
  187.     {
  188.         get_user_team (player, teamName, 9)
  189.         teamf (player, color)
  190.         elkuldes(player, Temp)
  191.         teamf(player, teamName)
  192.     }
  193. }
  194. public sendtmessage(color[], playerTeam)
  195. {
  196.     new teamName[10]
  197.     for (new player = 1; player < get_maxplayers(); player++)
  198.     {
  199.         if(get_user_team(player) == playerTeam)
  200.         {
  201.             get_user_team (player, teamName, 9)
  202.             elkuldes(player, Temp)
  203.             teamf (player, teamName)
  204.             teamf (player, color)
  205.         }
  206.     }
  207. }
  208. public teamf(player, team[])
  209. {
  210.     message_begin(MSG_ONE, get_user_msgid("TeamInfo"), _, player)
  211.     write_byte(player)
  212.     write_string(team)
  213.     message_end()
  214. }
  215. public elkuldes(player, Temp[])
  216. {
  217.    
  218.     message_begin( MSG_ONE, get_user_msgid( "SayText" ), _, player)
  219.     write_byte( player )
  220.     write_string( Temp )
  221.     message_end()
  222.    
  223. }
  224. public on_new_round(id){
  225.     new y32[32], x
  226.     get_players(y32,x,"c")
  227.     for(new a = 0; a < x; a++)
  228.         set_task(1.0,"Check",y32[a])
  229. }
  230. public on_damage(id){
  231.     static damage; damage = read_data(2)
  232.     new att=get_user_attacker(id)
  233.     Exp[att]+=damage
  234.     Exp[id]-=damage/2
  235. }
  236.  
  237. public rankod(id){
  238.     client_print(id,print_chat,"^Rankod: ^3%s ^1| TP: ^3%i",RANKS_NAME[Level[id]],Exp[id])
  239. }
  240. public Check(id){
  241.     //client_print(id,print_chat,"XP: ^3%d %i",Exp[id],Exp[id])
  242.     if(Exp[id]<=0)
  243.         Exp[id]=0
  244.     if(Exp[id] >= RANKS_XP[Level[id]+1]){
  245.         Level[id]+=1
  246.         //client_print(id,print_chat,"Fejlődtél! Új rankod: ^3%s",RANKS_NAME[Level[id]])
  247.         ColorChat(id,GREEN,"Fejlődtél!^1 Új rankod:^3 %s",RANKS_NAME[Level[id]])
  248.     }
  249.     else if(Exp[id] <= RANKS_XP[Level[id]-1]){
  250.         Level[id]-=1
  251.         ColorChat(id,GREEN,"VISSZAESTÉL!^1 Új rankod:^3 %s",RANKS_NAME[Level[id]])
  252.     }
  253. }
  254. public OnPlayerKilled(){
  255.     new att=read_data(1),vic=read_data(2)
  256.     Kills[att][vic]++
  257.     Kills[vic][att]=0
  258.     KillStreak[vic]=0
  259.     KillStreak[att]+=1
  260.     new at_name[32],vic_name[32]
  261.     get_user_name(att,at_name,31)
  262.     get_user_name(vic,vic_name,31)
  263.     Check_Streak(att)
  264.     if(Kills[att][vic]==3){
  265.        
  266.         PlayersInventory[att][Common]++
  267.         //client_print(0,print_chat,"^4 %s^1 alázza^4 %s^1-t, ajándéka: ^3Super Box!",at_name,vic_name)
  268.         //print_color(0,"!g %s!y alázza !g%s!y-t, ajándéka: ^3Super Box!",at_name,vic_name)
  269.         ColorChat(0,GREEN,"^3 %s ^1 alázza^3 %s ^1-t, ajándéka: ^3Common Box!",at_name,vic_name)
  270.     }
  271. }
  272. public Check_Streak(id){
  273.     new nev[32];get_user_name(id,nev,31)
  274.     if(KillStreak[id]==6){
  275.         KillStreak[id]=0
  276.         set_hudmessage(255, 0, 0, 0.41, 0.08, 0, 6.0, 12.0)
  277.         show_hudmessage(0, "%s 6-os szintű KillStreak!!",nev)
  278.         give_item(id,"weapon_usp")
  279.         cs_set_user_bpammo(id,CSW_USP,120)
  280.     }
  281.     else if(KillStreak[id]==4){
  282.         set_hudmessage(255, 0, 0, 0.41, 0.08, 0, 6.0, 12.0)
  283.         show_hudmessage(0, "%s 4-es szintű KillStreak!!",nev)
  284.         set_user_health(id,get_user_health(id)+100)
  285.     }
  286.     else if(KillStreak[id]==2){
  287.         set_hudmessage(255, 0, 0, 0.41, 0.08, 0, 6.0, 12.0)
  288.         show_hudmessage(0, "%s 2-es szintű KillStreak!!",nev)
  289.         give_item(id,"weapon_hegrenade")
  290.     }
  291. }
  292. public main_menu(id){
  293.     new menu=menu_create("\d-[\rEndLeSS\d]- \w| \yAWP Szerver System^n\www.endlesscs.hu","main_handler")
  294.     menu_additem(menu,"\rLádák nyitása")
  295.     menu_additem(menu,"\yBolt")
  296.     menu_additem(menu,"\rSkinek")
  297.     menu_additem(menu,"\dProfilom")
  298.     menu_display(id,menu,0)
  299.     return PLUGIN_HANDLED
  300. }
  301. public main_handler(id,menu,item){
  302.     if(item==MENU_EXIT){
  303.         menu_destroy(menu)
  304.         return PLUGIN_HANDLED
  305.     }
  306.     switch(item){
  307.         case 0:
  308.             nyitas(id)
  309.         case 1:
  310.             client_print(id,print_chat,"Hamarosan")
  311.         case 2:
  312.             client_print(id,print_chat,"Hamarosan")
  313.         case 3:
  314.             profilom(id)
  315.     }
  316.     return PLUGIN_CONTINUE
  317. }
  318. public profilom(id){
  319.     new lofasz[120]
  320.     formatex(lofasz,119,"Rankod: %s (%i/%i)^nExp: %d (%d következő szint)^nÖléseid: %d",RANKS_NAME[Level[id]],Exp[id],RANKS_XP[Level[id]+1],Kill_Skin[id])
  321.     new menu=menu_create(lofasz,"prof_hand")
  322.     menu_additem(menu,"Teszt")
  323.     menu_display(id,menu,0)
  324. }
  325. public prof_hand(id,menu,item){
  326.     if(item==MENU_EXIT){
  327.         menu_destroy(menu)
  328.         return PLUGIN_HANDLED
  329.     }
  330.     if(item == 0){
  331.         menu_destroy(menu)
  332.     }
  333.     return PLUGIN_CONTINUE
  334. }
  335. public nyitas(id){
  336.     new ding[23]
  337.     new menu=menu_create("\rendlesscs.hu \w| \rLáda rendszer \RDarab^n","case_hand")
  338.     /*Regular*/
  339.     if(PlayersInventory[id][Common]>=1){
  340.         formatex(ding,22,"Common Box\R\r%d",PlayersInventory[id][Common])
  341.         menu_additem(menu,ding)
  342.         //formatex(ding,14,"")
  343.     }
  344.     else
  345.         menu_additem(menu,"\dCommon Box\R\r0")
  346.     /*Super*/
  347.     if(PlayersInventory[id][Limited]>=1){
  348.         formatex(ding,22,"Limited\R\r%d",PlayersInventory[id][Limited])
  349.         menu_additem(menu,ding)
  350.         //formatex(ding,14,"")
  351.     }
  352.     else
  353.         menu_additem(menu,"\dLimited Box\R\r0")
  354.     /*Legendary*/
  355.     if(PlayersInventory[id][Limited]>=1){
  356.         formatex(ding,22,"Legendary Box\R\r%d",PlayersInventory[id][Legendary])
  357.         menu_additem(menu,ding)
  358.         //formatex(ding,14,"")
  359.     }
  360.     else
  361.         menu_additem(menu,"\dLegendary Box\R\r0")
  362.     /*Xmas*/
  363.     if(PlayersInventory[id][Regular]>=1){
  364.         formatex(ding,22,"Regular Box\R\r%d",PlayersInventory[id][Regular])
  365.         menu_additem(menu,ding)
  366.         //formatex(ding,14,"")
  367.     }
  368.     else
  369.         menu_additem(menu,"\dRegular Box\R\r0")
  370.     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
  371.     menu_display(id,menu,0)
  372.     return PLUGIN_HANDLED
  373. }
  374. public case_hand(id,menu,item){
  375.     if(item == MENU_EXIT){
  376.         menu_destroy(menu)
  377.         return PLUGIN_HANDLED
  378.     }
  379.     switch(item){
  380.         case 0:
  381.             PlayersInventory[id][Common]>0?Common_Open(id):Error(id)
  382.         case 1:
  383.             PlayersInventory[id][Limited]>0?Limited_Open(id):Error(id)
  384.         case 2:
  385.             PlayersInventory[id][Legendary]>0?Legendary_Open(id):Error(id)
  386.         case 3:
  387.             PlayersInventory[id][Regular]>0?Xmas_Open(id):Error(id)
  388.     }
  389.     return PLUGIN_CONTINUE
  390. }
  391. public Common_Open(id){
  392.     PlayersInventory[id][Common]--
  393.     new rand=random_num(60,200)
  394.     new nev[32];get_user_name(id,nev,31)
  395.     ColorChat(0,GREEN,"%s^x01 nyitott egy Common Boxot: ^3%d TP ^1| ^3%d$",nev,rand,rand)
  396.     Exp[id]+=rand
  397. }
  398. public Limited_Open(id){
  399.     PlayersInventory[id][Limited]--
  400.     client_print(id,print_chat,"Kinyitottad a ^3Super ládát^1!")
  401. }
  402. public Legendary_Open(id){
  403.     PlayersInventory[id][Legendary]--
  404.     client_print(id,print_chat,"Kinyitottad az ^3Legendary ládát^1!")
  405. }
  406. public Xmas_Open(id){
  407.     PlayersInventory[id][Regular]--
  408.     new rand=random_num(1,20)
  409.     switch(rand){
  410.        
  411.     }
  412. }
  413. public drop(id){
  414.     for(new i;i<8;i++)
  415.         PlayersInventory[id][i]++
  416.     client_print(id,print_chat,"Dikafijudegazdaghe ^4 TESZT")
  417.     return PLUGIN_HANDLED
  418. }
  419. public Error(id){
  420.     client_print(id,print_chat,"Nem rendelkezel ^3elegendő mennyiséggel^1!")
  421.     nyitas(id)
  422. }
  423.  
  424. stock callf(id, fgv_name[],plug_name[])
  425. {
  426.     if( callfunc_begin(fgv_name,plug_name) == 1 )
  427.     {
  428.         callfunc_push_int(id)
  429.         //callfunc_push_str(name)
  430.         callfunc_end()
  431.     }
  432. }
  433. public client_disconnect(id) {
  434.     if(!is_user_bot(id) && !is_user_hltv(id)) {
  435.         save(id);
  436.     }
  437. }
  438. public client_authorized(id) {
  439.     if(!is_user_bot(id) && !is_user_hltv(id)) {
  440.         load(id);
  441.     }
  442. }
  443.  
  444. public load(id) {
  445.     new szData[128];
  446.     new steamid[32]; get_user_authid(id, steamid, charsmax(steamid));
  447.     if(contain(steamid, "_ID_LAN") != -1) get_user_ip(id, steamid, charsmax(steamid), 1);
  448.    
  449.     if(get_data(steamid, szData, charsmax(szData))) {
  450.         new valami[32], valami2[32],valami3[32],valami4[32],valami5[32],valami6[32]
  451.        
  452.         parse(szData, valami, charsmax(valami), valami2, charsmax(valami2), valami3,
  453.         charsmax(valami3),
  454.         valami4, charsmax(valami4), valami5, charsmax(valami5), valami6, charsmax(valami6))
  455.         Exp[id] = str_to_num(valami)
  456.         Level[id] = str_to_num(valami2)
  457.         PlayersInventory[id][Common] = str_to_num(valami3)
  458.         PlayersInventory[id][Limited] = str_to_num(valami4)
  459.         PlayersInventory[id][Legendary] = str_to_num(valami5)
  460.         PlayersInventory[id][Regular] = str_to_num(valami6)
  461.     }
  462. }
  463. public save(id) {
  464.     new szData[128];
  465.     new steamid[32]; get_user_authid(id, steamid, charsmax(steamid));
  466.     if(contain(steamid, "_ID_LAN") != -1) get_user_ip(id, steamid, charsmax(steamid), 1);
  467.    
  468.     formatex(szData, charsmax(szData), "%i %i %i %i %i %i",Exp[id],Level[id],
  469.     PlayersInventory[id][Common],
  470.     PlayersInventory[id][Limited],PlayersInventory[id][Legendary],PlayersInventory[id][Regular]);
  471.     set_data(steamid, szData)
  472. }
  473. stock get_data(const key[], data[], len) {
  474.     new vault = fopen(filename, "rt");
  475.     new _data[512], _key[64];
  476.    
  477.     while( !feof(vault) ) {
  478.         fgets(vault, _data, charsmax(_data));
  479.         parse(_data, _key, charsmax(_key), data, len);
  480.        
  481.         if( equal(_key, key) ) {
  482.             fclose(vault);
  483.             return 1;
  484.         }
  485.     }
  486.    
  487.     fclose(vault);
  488.     copy(data, len, "");
  489.    
  490.     return 0;
  491. }
  492.  
  493. stock set_data(const key[], const data[]) {
  494.     static const temp_vault_name[] = "set_data.txt";
  495.     new file = fopen(temp_vault_name, "wt");
  496.    
  497.     new vault = fopen(filename, "rt");
  498.     new _data[512], _key[64], _other[32];
  499.     new bool:replaced = false;
  500.    
  501.     while( !feof(vault) ) {
  502.         fgets(vault, _data, charsmax(_data));
  503.         parse(_data, _key, charsmax(_key), _other, charsmax(_other));
  504.        
  505.         if( equal(_key, key) && !replaced ) {
  506.             fprintf(file, "^"%s^" ^"%s^"^n", key, data);
  507.            
  508.             replaced = true;
  509.         }
  510.         else {
  511.             fputs(file, _data);
  512.         }
  513.     }
  514.    
  515.     if( !replaced ) {
  516.         fprintf(file, "^"%s^" ^"%s^"^n", key, data);
  517.     }
  518.    
  519.     fclose(file);
  520.     fclose(vault);
  521.    
  522.     delete_file(filename);
  523.    
  524.     while( !rename_file(temp_vault_name, filename, 1) ) { }
  525.    
  526.     //delete_file(temp_vault_name);
  527. }
  528. stock print_color(const id, const input[], any:...)
  529. {
  530.     new count = 1, players[32]
  531.     static msg[191]
  532.     vformat(msg, 190, input, 3)
  533.    
  534.     replace_all(msg, 190, "!g", "^4")
  535.     replace_all(msg, 190, "!y", "^1")
  536.     replace_all(msg, 190, "!t", "^3")
  537.     replace_all(msg, 190, "á", "á")
  538.     replace_all(msg, 190, "é", "é")
  539.     replace_all(msg, 190, "í", "í")
  540.     replace_all(msg, 190, "ó", "ó")
  541.     replace_all(msg, 190, "ö", "ö")
  542.     replace_all(msg, 190, "ő", "ő")
  543.     replace_all(msg, 190, "ú", "ú")
  544.     replace_all(msg, 190, "ü", "ü")
  545.     replace_all(msg, 190, "ű", "ű")
  546.     replace_all(msg, 190, "Á", "Á")
  547.     replace_all(msg, 190, "É", "É")
  548.     replace_all(msg, 190, "Í", "Í")
  549.     replace_all(msg, 190, "Ó", "Ó")
  550.     replace_all(msg, 190, "Ö", "Ö")
  551.     replace_all(msg, 190, "Ő", "Ő")
  552.     replace_all(msg, 190, "Ú", "Ú")
  553.     replace_all(msg, 190, "Ü", "Ü")
  554.     replace_all(msg, 190, "Ű", "Ű")        
  555.    
  556.     if (id) players[0] = id; else get_players(players, count, "ch")
  557. {
  558.     for (new i = 0; i < count; i++)
  559.     {
  560.         if (is_user_connected(players[i]))
  561.         {
  562.             message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  563.             write_byte(players[i])
  564.             write_string(msg)
  565.             message_end()
  566.         }
  567.     }
  568. }
  569. return PLUGIN_HANDLED
  570. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement