HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <cstrike>
  6. #include <fakemeta>
  7. #include <csstats>
  8. #include <csx>
  9.  
  10. #define PLUGIN "Show Rank"
  11. #define VERSION "1.0"
  12. #define AUTHOR "Driss (Go Svoi)"
  13.  
  14. #define ID_SHOWHUD (taskid - TASK_SHOWHUD)
  15.  
  16. enum {
  17. INT_STATS_KILLS = 0,
  18. INT_STATS_DEATHS
  19. };
  20.  
  21. enum (+= 100)
  22. {
  23. TASK_SHOWHUD
  24. };
  25.  
  26. const PEV_SPEC_TARGET = pev_iuser2 // Nézõként
  27. new g_player_name
  28.  
  29. public plugin_init()
  30. {
  31. register_plugin(PLUGIN, VERSION, AUTHOR)
  32.  
  33. g_player_name = register_cvar("ds_player_name", "1") // ki/be kapcsolás
  34.  
  35. // A chatbe való írás /rank
  36. register_clcmd( "say", "Chat_Player_Rank" );
  37. register_clcmd( "say_team", "Chat_Player_Rank" );
  38.  
  39. // HUD játékos név + rank
  40. register_event("StatusValue","show_status_player","be","1=2","2!0")
  41.  
  42. // Nyelvi fájl
  43. register_dictionary("Driss_rank.txt")
  44. }
  45.  
  46. public Chat_Player_Rank(id)
  47. {
  48. static STRING_ARGUMENT[ 11 ];
  49. read_argv( 1, STRING_ARGUMENT, charsmax( STRING_ARGUMENT ) );
  50.  
  51. if( equali( STRING_ARGUMENT, "rank" ) || equali( STRING_ARGUMENT, "/rank" ) )
  52. {
  53. new INT_RANK_POS, STRING_STATS[ 8 ], STRING_BODY[ 8 ], STRING_NAME[ 32 ];
  54. INT_RANK_POS = get_user_stats( id, STRING_STATS, STRING_BODY );
  55.  
  56. get_user_name( id, STRING_NAME, charsmax( STRING_NAME ) );
  57.  
  58. print_chatColor(0, "%L",LANG_PLAYER, "CHAT_INFO" ,STRING_NAME, INT_RANK_POS, get_statsnum( ) , STRING_STATS[ INT_STATS_KILLS ], STRING_STATS[ INT_STATS_DEATHS ],
  59. float( STRING_STATS[ INT_STATS_KILLS ] ) * 1.002 / float( STRING_STATS[ INT_STATS_DEATHS ] ) * 1.002 * 30.346647 );
  60.  
  61. client_cmd( id, "spk items/medshotno1.wav" );
  62.  
  63. }
  64. }
  65.  
  66. public client_putinserver(id)
  67. {
  68. if (!is_user_bot(id))
  69. {
  70. // Állíts be egyéni hudot
  71. set_task(1.0, "ShowHUD", id+TASK_SHOWHUD, _, _, "b")
  72. }
  73. }
  74.  
  75. public ShowHUD(taskid)
  76. {
  77. static id
  78. new INT_RANK_POS, STRING_STATS[ 8 ], STRING_BODY[ 8 ], STRING_NAME[ 32 ];
  79. INT_RANK_POS = get_user_stats( id, STRING_STATS, STRING_BODY );
  80.  
  81. get_user_name( id, STRING_NAME, charsmax( STRING_NAME ) );
  82.  
  83. id = ID_SHOWHUD;
  84. // Játékos meghalt?
  85. if (!is_user_alive(id))
  86. {
  87. // Nézõként cél
  88. id = pev(id, PEV_SPEC_TARGET)
  89.  
  90. // Nem él
  91. if (!is_user_alive(id))return;
  92. }
  93.  
  94. static red, green, blue
  95.  
  96. if (cs_get_user_team(id) == CS_TEAM_T) // Terrorista
  97. {
  98. red = 255
  99. green = 0
  100. blue = 0
  101. }
  102. else // CT
  103. {
  104. red = 0
  105. green = 255
  106. blue = 0
  107. }
  108.  
  109. if (id != ID_SHOWHUD)
  110. {
  111. set_hudmessage(255, 0, 255, -1.0, 0.80, 0, 7.0, 1.2)
  112. show_hudmessage(ID_SHOWHUD,"%L",LANG_PLAYER, "SPECTATING_PLAYER", STRING_NAME, INT_RANK_POS, get_statsnum( ) , STRING_STATS[ INT_STATS_KILLS ], STRING_STATS[ INT_STATS_DEATHS ],
  113. float( STRING_STATS[ INT_STATS_KILLS ] ) * 1.002 / float( STRING_STATS[ INT_STATS_DEATHS ] ) * 1.002 * 30.346647 );
  114. }
  115. else
  116. {
  117. set_hudmessage(red, green, blue, -1.0, 0.91, 0, 7.0, 1.2)
  118. show_hudmessage(ID_SHOWHUD,"%L",LANG_PLAYER,"ON_PLAYER", INT_RANK_POS, get_statsnum( ), STRING_STATS[ INT_STATS_KILLS ], STRING_STATS[ INT_STATS_DEATHS ],
  119. float( STRING_STATS[ INT_STATS_KILLS ] ) * 1.002 / float( STRING_STATS[ INT_STATS_DEATHS ] ) * 1.002 * 30.346647 );
  120. }
  121. }
  122.  
  123. public show_status_player(id)
  124. {
  125. new name[32],pid = read_data(2)
  126. get_user_name(pid,name,31)
  127.  
  128. new INT_RANK_POS, STRING_STATS[ 8 ], STRING_BODY[ 8 ], STRING_NAME[ 32 ];
  129. INT_RANK_POS = get_user_stats( pid, STRING_STATS, STRING_BODY );
  130.  
  131. get_user_name( pid, STRING_NAME, charsmax( STRING_NAME ) );
  132.  
  133.  
  134. if (!(cs_get_user_team(pid) == CS_TEAM_T) && !(cs_get_user_team(id) == CS_TEAM_T) && (get_pcvar_num(g_player_name) == 1) )
  135. {
  136. set_hudmessage(153,50,204, -1.0, 0.60, 2, 0.05, 0.1, 0.01, 01.0, -1);
  137. show_hudmessage(id, "%L",LANG_PLAYER, "INFO_DRISS_PLAYER", name, INT_RANK_POS, get_statsnum( ) , STRING_STATS[ INT_STATS_KILLS ], STRING_STATS[ INT_STATS_DEATHS ],
  138. float( STRING_STATS[ INT_STATS_KILLS ] ) * 1.002 / float( STRING_STATS[ INT_STATS_DEATHS ] ) * 1.002 * 30.346647 );
  139. }
  140. if((cs_get_user_team(id) == CS_TEAM_T) && (cs_get_user_team(pid) == CS_TEAM_T) && (get_pcvar_num(g_player_name) == 1))
  141. {
  142. set_hudmessage(255,0,0,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, -1);
  143. show_hudmessage(id, "%L",LANG_PLAYER,"INFO_DRISS_PLAYER", name, INT_RANK_POS, get_statsnum( ) , STRING_STATS[ INT_STATS_KILLS ], STRING_STATS[ INT_STATS_DEATHS ],
  144. float( STRING_STATS[ INT_STATS_KILLS ] ) * 1.002 / float( STRING_STATS[ INT_STATS_DEATHS ] ) * 1.002 * 30.346647 );
  145. }
  146. }
  147.  
  148.  
  149. stock print_chatColor(const id,const input[], any:...)
  150. {
  151. new msg[191], players[32], count = 1;
  152. vformat(msg,190,input,3);
  153. replace_all(msg,190,"!g","^x04");// green
  154. replace_all(msg,190,"!n","^x01");// normal
  155. replace_all(msg,190,"!t","^x03");// team
  156.  
  157. if (id) players[0] = id; else get_players(players,count,"ch");
  158. for (new i=0;i<count;i++)
  159. if (is_user_connected(players[i]))
  160. {
  161. message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
  162. write_byte(players[i]);
  163. write_string(msg);
  164. message_end();
  165. }
  166. }
  167.