hlmod.hu
https://hlmod.hu/

legjob a korbe
https://hlmod.hu/viewtopic.php?f=29&t=12753
Oldal: 1 / 1

Szerző:  Milkywaye [2013.11.20. 13:36 ]
Hozzászólás témája:  legjob a korbe

Nekem ojan plugin kellene hogy kor vegin kiirja chetbe a kor legjobjat es menyit lovot le es abbol menyit fejesel . :)

Szerző:  Telapo11 [2013.11.20. 13:52 ]
Hozzászólás témája:  Re: legjob a korbe

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <hamsandwich>
  4. #include <cstrike>
  5.  
  6. #define PLUGIN "Kor Legjobbja"
  7. #define AUTHOR "[J]aGuAr"
  8. #define VERSION "1.0"
  9.  
  10. new g_iKills[32], g_iDmg[32]
  11.  
  12. public plugin_init()
  13. {
  14. register_plugin(PLUGIN, VERSION, AUTHOR)
  15. RegisterHam(Ham_TakeDamage, "player", "hamTakeDamage")
  16. register_event("DeathMsg", "EventDeathMsg", "a")
  17. register_logevent("RoundEnd", 2, "1=Round_End")
  18. }
  19.  
  20. public client_disconnect(id)
  21. {
  22. g_iDmg[id] = 0;
  23. g_iKills[id] = 0;
  24. }
  25. public hamTakeDamage(victim, inflictor, attacker, Float:damage, DamageBits)
  26. {
  27. if( 1 <= attacker <= 32)
  28. {
  29. if(cs_get_user_team(victim) != cs_get_user_team(attacker))
  30. g_iDmg[attacker] += floatround(damage)
  31. else
  32. g_iDmg[attacker] -= floatround(damage)
  33. }
  34. }
  35.  
  36. public EventDeathMsg()
  37. {
  38. new killer = read_data(1)
  39. new victim = read_data(2)
  40.  
  41. if(killer != victim && killer && cs_get_user_team(killer) != cs_get_user_team(victim))
  42. {
  43. g_iKills[killer]++;
  44. }
  45. else
  46. g_iKills[killer]--;
  47. }
  48.  
  49. public RoundEnd()
  50. {
  51. new iBestPlayer = get_best_player()
  52. new szName[32]
  53. get_user_name(iBestPlayer, szName, charsmax(szName))
  54.  
  55. set_hudmessage(255, 0, 179, -1.0, -1.0)
  56. show_hudmessage(0, "A legjobb játékos ebben a körben,^x04 %s^x03 volt!^n Megölt^x04 %i^x03 játékost!", szName, g_iKills[iBestPlayer])
  57.  
  58. for(new i; i < 31; i++)
  59. {
  60. g_iDmg[i] = 0;
  61. g_iKills[i] = 0;
  62. }
  63. }
  64.  
  65. get_best_player()
  66. {
  67. new players[32], num;
  68. get_players(players, num);
  69. SortCustom1D(players, num, "sort_bestplayer")
  70. return players[0]
  71. }
  72.  
  73. public sort_bestplayer(id1, id2)
  74. {
  75. if(g_iKills[id1] > g_iKills[id2])
  76. return -1;
  77. else if(g_iKills[id1] < g_iKills[id2])
  78. return 1;
  79. else
  80. {
  81. if(g_iDmg[id1] > g_iDmg[id2])
  82. return -1;
  83. else if(g_iDmg[id1] < g_iDmg[id2])
  84. return 1;
  85. else
  86. return 0;
  87. }
  88. return 0;
  89. }
  90.  

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/