Advertisement
Guest User

Untitled

a guest
Feb 11th, 2021
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. const char* sPlayerModelFiles[] =
  2. {
  3. "models/player.mdl",
  4. "models/player/leet/leet.mdl",
  5. "models/player/gign/gign.mdl",
  6. "models/player/vip/vip.mdl",
  7. "models/player/gsg9/gsg9.mdl",
  8. "models/player/guerilla/guerilla.mdl",
  9. "models/player/arctic/arctic.mdl",
  10. "models/player/sas/sas.mdl",
  11. "models/player/terror/terror.mdl",
  12. "models/player/urban/urban.mdl",
  13. "models/player/spetsnaz/spetsnaz.mdl", // CZ
  14. "models/player/militia/militia.mdl" // CZ
  15. };
  16.  
  17. enum ModelType_e
  18. {
  19. CS_DEFAULT,
  20. CS_LEET,
  21. CS_GIGN,
  22. CS_VIP,
  23. CS_GSG9,
  24. CS_GUERILLA,
  25. CS_ARCTIC,
  26. CS_SAS,
  27. CS_TERROR,
  28. CS_URBAN,
  29. CS_SPETSNAZ,
  30. CS_MILITIA,
  31. };
  32.  
  33. bool IsValidCTModelIndex(int modelType)
  34. {
  35. switch (static_cast<ModelType_e>(modelType))
  36. {
  37. case CS_GIGN:
  38. case CS_GSG9:
  39. case CS_SAS:
  40. case CS_URBAN:
  41. case CS_SPETSNAZ:
  42. return true;
  43. default:
  44. break;
  45. }
  46.  
  47. return false;
  48. }
  49.  
  50. bool IsValidTModelIndex(int modelType)
  51. {
  52. switch (static_cast<ModelType_e>(modelType))
  53. {
  54. case CS_LEET:
  55. case CS_GUERILLA:
  56. case CS_ARCTIC:
  57. case CS_TERROR:
  58. case CS_MILITIA:
  59. return true;
  60. default:
  61. break;
  62. }
  63.  
  64. return false;
  65. }
  66.  
  67. static cvar_t* cl_minmodels = g_Engine.pfnGetCvarPointer("cl_minmodels");
  68. static cvar_t* cl_min_t = g_Engine.pfnGetCvarPointer("cl_min_t");
  69. static cvar_t* cl_min_ct = g_Engine.pfnGetCvarPointer("cl_min_ct");
  70.  
  71. model_t* m_pRenderModel;
  72.  
  73. if (cl_minmodels && cl_minmodels->value)
  74. {
  75. if (g_Player[ent->index].iTeam == 1)
  76. {
  77. int modelindex = (cl_min_t && IsValidTModelIndex(cl_min_t->value)) ? cl_min_t->value : CS_LEET;
  78. m_pRenderModel = g_Engine.CL_LoadModel(sPlayerModelFiles[modelindex], nullptr);
  79. }
  80. else if (g_Player[ent->index].iTeam == 2)
  81. {
  82. if (g_Player[ent->index].bVip)
  83. {
  84. m_pRenderModel = g_Engine.CL_LoadModel(sPlayerModelFiles[CS_VIP], nullptr);
  85. }
  86. else
  87. {
  88. int modelindex = (cl_min_ct && IsValidCTModelIndex(cl_min_ct->value)) ? cl_min_ct->value : CS_GIGN;
  89. m_pRenderModel = g_Engine.CL_LoadModel(sPlayerModelFiles[modelindex], nullptr);
  90. }
  91. }
  92. }
  93. else
  94. m_pRenderModel = g_Studio.SetupPlayerModel(ent->index - 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement