hlmod.hu
https://hlmod.hu/

Kör legjobbja
https://hlmod.hu/viewtopic.php?f=29&t=23224
Oldal: 1 / 1

Szerző:  Beckx [2015.12.27. 22:02 ]
Hozzászólás témája:  Kör legjobbja

Üdv!
Szeretnék kérni egy olyan plugin, hogy aki a körvégén a legjobb lesz, annak plusz 3 pont jár!
Előre is köszi!

Szerző:  lada xp [2015.12.28. 12:49 ]
Hozzászólás témája:  Re: Kör legjobbja

Esetleg a pontrendszer sma-t?

Szerző:  alfaanero [2015.12.28. 13:12 ]
Hozzászólás témája:  Re: Kör legjobbja

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


Körvégén adsz neki pont[id] +=3

Szerző:  lada xp [2015.12.28. 14:19 ]
Hozzászólás témája:  Re: Kör legjobbja

Ez az átlátásaim szerint nemfog pontot adni neki...

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