找回密码
 立即注册

QQ登录

只需一步,快速开始

楼主: Hun_Ter

【已解决】 K 求助

[复制链接]

该用户从未签到

 楼主| 发表于 2010-10-19 08:28:37 | 显示全部楼层
回复 6# Jc.ppx


    一直没钱!穷的很  能借到钱,那就太好了!

该用户从未签到

发表于 2010-10-19 09:45:05 | 显示全部楼层
回复 8# lovehuai


   
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <hamsandwich>
  4. #include <cstrike>

  5. new const ZOMBIE_MODEL[] = "zombie" // 模型的名称
  6. #define MODELSET_TASK 100 // an offset for our models task设置模型的任务ID = id + MODELSET_TASK
  7. #define MODELCHANGE_DELAY 0.5 // 更换模型延迟的时间
  8. new Float:g_models_targettime // target time for the last model change(最后一人模型更换的时间点)
  9. new Float:g_roundstarttime // last round start time(获取每一局开局的时间点)

  10. new g_has_custom_model[33] // whether the player is using a custom model(玩家是否采用自定义模型)
  11. new g_player_model[33][32] // player's model name (string)(玩家模型的名字)
  12. new g_zombie[33] // whether the player is a zombie(玩家是否为僵尸)

  13. /*================================================================================
  14. [Plugin Start](插件开始)
  15. =================================================================================*/

  16. public plugin_precache()//必要的模型,当月客户端没有时强制下载
  17. {
  18. new modelpath[100]
  19. formatex( modelpath, charsmax( modelpath ), "models/player/%s/%s.mdl", ZOMBIE_MODEL, ZOMBIE_MODEL )
  20. engfunc( EngFunc_PrecacheModel, modelpath )
  21. }

  22. public plugin_init()
  23. {
  24. register_plugin( "Player Model Changer Example", "0.3", "MeRcyLeZZ" )

  25. register_event( "HLTV", "event_round_start", "a", "1=0", "2=0" )//注入开局的函数
  26. RegisterHam( Ham_Spawn, "player", "fw_PlayerSpawn", 1 )//注入玩家出生的函数

  27. register_forward( FM_SetClientKeyValue, "fw_SetClientKeyValue" )//设置客户端的键值
  28. register_forward( FM_ClientUserInfoChanged, "fw_ClientUserInfoChanged" )//当客户端的信息修改时,自动勾起这个函数
  29. }

  30. /*================================================================================
  31. [Round Start Event](开始事件)
  32. =================================================================================*/

  33. public event_round_start()
  34. {
  35. g_roundstarttime = get_gametime()
  36. }

  37. /*================================================================================
  38. [Player Spawn Event](玩家出生事件)
  39. =================================================================================*/

  40. public fw_PlayerSpawn( id )
  41. {
  42. // Not alive or didn't join a team yet(如果是死亡或都观察者,自动返回)
  43. if ( !is_user_alive( id ) || !cs_get_user_team( id ) )
  44. return;

  45. // Set to zombie if on Terrorist team(如果玩家队伍为TE,设置玩家为僵尸)
  46. g_zombie[id] = cs_get_user_team( id ) == CS_TEAM_T ? true : false;

  47. // Remove previous tasks (if any)(删除ID为id + MODELSET_TASK的一个任务,补充:尽管没有,不过为了保险起见,有备无患嘛)
  48. remove_task( id + MODELSET_TASK )

  49. // Check whether the player is a zombie(检测玩家是否为僵尸)
  50. if ( g_zombie[id] )
  51. {
  52. // Store our custom model in g_player_model[id](把模型的名称存进g_player_model[id]这个变量里)
  53. copy( g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL )

  54. // Get current model(获取当前玩家的模型)
  55. new currentmodel[32]
  56. fm_get_user_model( id, currentmodel, charsmax( currentmodel ) )

  57. // Check whether it matches the custom model(检测当前模型是否与g_player_model[id]这个模型相符,不相符则执行以下程序)
  58. if ( !equal( currentmodel, g_player_model[id] ) )
  59. {
  60. // An additional delay is offset at round start
  61. // since SVC_BAD is more likely to be triggered there
  62. if ( get_gametime() - g_roundstarttime < 5.0 )//检测当前更换模型的时间点与开局时间点之前的时间间隔,如果不于5秒,就延迟5秒再进行模型更新
  63. set_task( 5.0 * MODELCHANGE_DELAY, "fm_user_model_update", id + MODELSET_TASK )
  64. else//否则立刻更新模型
  65. fm_user_model_update( id + MODELSET_TASK )
  66. }
  67. }
  68. // Not a zombie, but still has a custom model(如果不是僵尸,则不更新玩家模型)
  69. else if ( g_has_custom_model[id] )
  70. {
  71. // Reset it back to the default one
  72. fm_reset_user_model( id )
  73. }
  74. }

  75. /*================================================================================
  76. [Forwards]
  77. =================================================================================*/

  78. public fw_SetClientKeyValue( id, const infobuffer[], const key[] )
  79. {
  80. // Block CS model changes(破坏CS更换模型的键值,以在接下的代码中重新建立一下更换模型的函数)
  81. if ( g_has_custom_model[id] && equal( key, "model" ) )
  82. return FMRES_SUPERCEDE;//这个返回值的意思是返回你想设置的东西

  83. return FMRES_IGNORED;
  84. }

  85. public fw_ClientUserInfoChanged( id )
  86. {
  87. // Player doesn't have a custom model(玩家没有自定义模型)
  88. if ( !g_has_custom_model[id] )
  89. return FMRES_IGNORED;

  90. // Get current model(获取当前玩家模型)
  91. static currentmodel[32]
  92. fm_get_user_model( id, currentmodel, charsmax( currentmodel ) )

  93. // Check whether it matches the custom model - if not, set it again(检测当前模型是否与更换后的模型相符,如果不是,再更换一次)
  94. if ( !equal( currentmodel, g_player_model[id] ) && !task_exists( id + MODELSET_TASK ) )
  95. fm_set_user_model( id + MODELSET_TASK )

  96. return FMRES_IGNORED;
  97. }

  98. /*================================================================================
  99. [Tasks](执行任务)
  100. =================================================================================*/

  101. public fm_user_model_update( taskid )
  102. {
  103. static Float:current_time
  104. current_time = get_gametime()

  105. // Do we need a delay?是否需要延迟
  106. if ( current_time - g_models_targettime >= MODELCHANGE_DELAY )//如果当前时间与最后一个更换模型的时间相隔大于这个延迟时间,则不延迟
  107. {
  108. fm_set_user_model( taskid )
  109. g_models_targettime = current_time
  110. }
  111. else//否则延迟更换模型的时间
  112. {
  113. set_task( (g_models_targettime + MODELCHANGE_DELAY) - current_time, "fm_set_user_model", taskid )
  114. g_models_targettime = g_models_targettime + MODELCHANGE_DELAY
  115. }
  116. }

  117. public fm_set_user_model( player )//设置玩家模型
  118. {
  119. // Get actual player id获取玩家ID
  120. player -= MODELSET_TASK

  121. // Set new model更换玩家模型
  122. engfunc( EngFunc_SetClientKeyValue, player, engfunc( EngFunc_GetInfoKeyBuffer, player ), "model", g_player_model[player] )

  123. // Remember this player has a custom model玩家更换模型成功后,自定义模型为真
  124. g_has_custom_model[player] = true
  125. }

  126. /*================================================================================
  127. [Stocks]
  128. =================================================================================*/

  129. stock fm_get_user_model( player, model[], len )
  130. {
  131. // Retrieve current model检测当前模型
  132. engfunc( EngFunc_InfoKeyValue, engfunc( EngFunc_GetInfoKeyBuffer, player ), "model", model, len )
  133. }

  134. stock fm_reset_user_model( player )
  135. {
  136. // Player doesn't have a custom model any longer玩家不再有自定义模型
  137. g_has_custom_model[player] = false

  138. dllfunc( DLLFunc_ClientUserInfoChanged, player, engfunc( EngFunc_GetInfoKeyBuffer, player ) )
  139. }
复制代码

该用户从未签到

 楼主| 发表于 2010-10-19 09:47:46 | 显示全部楼层
好强大,可惜 对插件理解的太差劲了! 会努力的

该用户从未签到

发表于 2010-10-19 09:48:03 | 显示全部楼层
回复 9# fantasist


      服装插件容易引起群踢的原因分析
  实际经验表明,当有大量玩家同时改变模型时,很容易出现群踢。CS在每次开局时,都会检查玩家模型是否为默认的模型,如果不是,则会将玩家模型恢复成默认模型。而服装插件(或cstrike模块)又马上将其模型设置成需要的模型,这样,有服装的玩家(指有自定义模型的玩家,下同),在开局时就会改变两次模型。当有服装的玩家较多时,就极易引起群踢
  所以,要想减少或消除由于服装插件引起的群踢,就需要阻止CS将有服装的玩家的模型恢复为默认模型,这样玩家在开局时就不需要再改变模型了,也就大大减少或消除由于服装插件引起的群踢

  为了增加通用性,通过修改cstrike_amxx.dll模块来实现阻止CS恢复玩家模型为默认模型。 来自R版

该用户从未签到

发表于 2010-10-19 10:12:36 | 显示全部楼层
酷客没投票换图哦
还有刷的TOP显示不了
还是显示以前跳的

该用户从未签到

 楼主| 发表于 2010-10-19 10:27:13 | 显示全部楼层
回复 15# K!tteN


    那个服务器的 没投票功能?

该用户从未签到

发表于 2010-10-19 10:34:28 | 显示全部楼层
回复 16# Hun_Ter


   攀岩跟连跳都木有

该用户从未签到

 楼主| 发表于 2010-10-19 10:41:18 | 显示全部楼层
回复 17# K!tteN


表示木有问题, 插件更新过了

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

该用户从未签到

发表于 2010-10-20 10:27:04 | 显示全部楼层
AMXX收下了
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表