Discuz! Board

标题: [代码|Code]给Bot换模型|Set Bot Model [打印本页]

作者: Jerry小坏    时间: 2017-7-13 16:54
标题: [代码|Code]给Bot换模型|Set Bot Model

说明|Description:
[CN]
就是用实体全局控制(Full Pack)来直接更改实体的模型索引[] 这个方法对玩家同样有用[]
[EN]
This code changes the model index of entities by FullPack, the same goes for clients.

  1. #include <amxmodx>
  2. #include <fakemeta>

  3. #define PLUGIN_NAME        "Set Bot Model"
  4. #define PLUGIN_VERSION        "1.0"
  5. #define PLUGIN_AUTHOR        "ESFKAMI"
  6. //Credit goes to Starman

  7. new fatbuu// 模型索引[] Model Index
  8. new bool: NewModel[33], NewModelIndex[33]

  9. public plugin_init()
  10. {
  11.         register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
  12.         register_forward(FM_AddToFullPack, "fw_AddToFullPack", 1);

  13.         register_clcmd("tt", "test")
  14. }

  15. public test(id)
  16. {
  17.         esf_set_bot_model(5, fatbuu)
  18. }

  19. stock esf_set_bot_model(Bot, ModelIndex)
  20. {
  21.         NewModel[Bot] = true
  22.         NewModelIndex[Bot] = ModelIndex
  23. }

  24. public fw_AddToFullPack(Handle, Edict, Entity, Host, Flags, Player, Set)// FullPack是实体的全局控制[] Full Pack handles all of entities in the game.
  25. {
  26.         if(is_user_bot(Entity) && NewModel[Entity])
  27.         {
  28.                 set_es(Handle, ES_ModelIndex, NewModelIndex[Entity])// 给handle到的实体设置模型[] Set model to the entity which is handled.
  29.         }
  30. }

  31. public plugin_precache()
  32. {
  33.         fatbuu = precache_model("models/player/fatbuu/fatbuu.mdl")
  34. }
复制代码





欢迎光临 Discuz! Board (https://esfbbs.foxnyx.top/) Powered by Discuz! X3.2