hlmod.hu
https://hlmod.hu/

Deathrun csapat csere
https://hlmod.hu/viewtopic.php?f=9&t=21269
Oldal: 1 / 1

Szerző:  laci512 [ 2015.06.29. 12:15 ]
Hozzászólás témája:  Deathrun csapat csere

[kozep]sziasztok[/kozep] probléma a következő
ugye bár van ez bot DR-ben nem szeretném kivenni 1 problémám van vele
hogy ha csapat csere van akkor őt is át rakja ct be vagy csak egyedül magát a bot ott t be és senki mást
mit kell be álltani hol ?


 
SMA Forráskód: [ Mindet kijelol ]
  1. DeathRun Team Ratio is free software;
  2. you can redistribute it and/or modify it under the terms of the
  3. GNU General Public License as published by the Free Software Foundation.
  4.  
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9.  
  10. You should have received a copy of the GNU General Public License
  11. along with DeathRun Team Ratio; if not, write to the
  12. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  13. Boston, MA 02111-1307, USA.
  14. */
  15.  
  16. #include <amxmodx>
  17. #include <fakemeta>
  18.  
  19. #define PLUGIN "DeathRun Team Ratio"
  20. #define AUTHOR "ConnorMcLeod"
  21. #define VERSION "0.1.0"
  22.  
  23. #define MAX_PLAYERS 32
  24.  
  25. #define TEAM_T 1
  26. #define TEAM_CT 2
  27. #define CS_OFFSET_TEAM 114
  28. #define cs_get_user_team(%1) get_pdata_int(%1, CS_OFFSET_TEAM)
  29. #define cs_set_user_team_fast(%1,%2) set_pdata_int(%1, CS_OFFSET_TEAM, %2)
  30.  
  31. new g_iMaxPlayers
  32. new g_pCvarRatio
  33. new sv_restart
  34.  
  35. new g_bIsConnected[MAX_PLAYERS+1]
  36.  
  37. public plugin_init()
  38. {
  39. register_plugin(PLUGIN, VERSION, AUTHOR)
  40.  
  41. register_event("HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0")
  42.  
  43. g_pCvarRatio = register_cvar("dr_terrorists_ratio", "0.25")
  44.  
  45. g_iMaxPlayers = get_maxplayers()
  46. sv_restart = get_cvar_pointer("sv_restart")
  47. }
  48.  
  49. public client_putinserver( id )
  50. {
  51. g_bIsConnected[id] = true
  52. }
  53.  
  54. public client_disconnect( id )
  55. {
  56. g_bIsConnected[id] = false
  57. }
  58.  
  59. public Event_HLTV_New_Round()
  60. {
  61. new iPlayers[MAX_PLAYERS], iNum, id, iTeam
  62. for(id=1; id<=g_iMaxPlayers; id++)
  63. {
  64. if( g_bIsConnected[id] && ( TEAM_T <= cs_get_user_team(id) <= TEAM_CT ) )
  65. {
  66. iPlayers[iNum++] = id
  67. }
  68. }
  69.  
  70. if( iNum < 2 )
  71. {
  72. return
  73. }
  74.  
  75. new iTerroristsNum = max(1, floatround( get_pcvar_float(g_pCvarRatio) * iNum , floatround_floor ))
  76. new iRand
  77. new szName[32]
  78.  
  79. while( iTerroristsNum )
  80. {
  81. iRand = random_num(0, iNum)
  82. if( (id = iPlayers[iRand]) )
  83. {
  84. cs_set_user_team_fast(id, TEAM_T)
  85. if( iNum-1 > iRand )
  86. {
  87. iPlayers[iRand] = iPlayers[iNum-1]
  88. }
  89.  
  90. --iNum
  91. --iTerroristsNum
  92.  
  93. get_user_name(id, szName, charsmax(szName))
  94. client_print(0, print_chat, "[Dr] %s has be choosen to be a terrorist.", szName)
  95. }
  96. }
  97.  
  98. for(new i; i<iNum; i++)
  99. {
  100. if( (id = iPlayers[i]) )
  101. {
  102. cs_set_user_team_fast(id, TEAM_CT)
  103. }
  104. }
  105. }

Szerző:  SmaCk [ 2015.06.29. 12:33 ]
Hozzászólás témája:  Re: Deathrun csapat csere

Ez mi ?
Érthetőbben is fogalmazhatnál.

Szerző:  laci512 [ 2015.06.29. 12:40 ]
Hozzászólás témája:  Re: Deathrun csapat csere

SmaCk írta:
Ez mi ?
Érthetőbben is fogalmazhatnál.

Bocs a fogalmazás ért.
Problémát már meg oldottam.

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