Advertisement
Akc3n7

admin model

Nov 3rd, 2024
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.55 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <fakemeta>
  4. #include <hamsandwich>
  5.  
  6. new const ADMIN_MODEL_T[] = "red"
  7. new const ADMIN_MODEL_CT[] = "blue"
  8.  
  9. public plugin_init() {
  10.    
  11.     register_plugin("ADMIN MODEL", "1.0", "Akc3n7");
  12.     RegisterHam( Ham_Spawn, "player", "PlayerPostSpawn",1);  
  13. }
  14.  
  15. public plugin_precache() {
  16.  
  17.     new ModelOrSoundPath[128]
  18.     formatex(ModelOrSoundPath, sizeof (ModelOrSoundPath) -1, "models/player/%s/%s.mdl",  ADMIN_MODEL_T, ADMIN_MODEL_T)
  19.     engfunc(EngFunc_PrecacheModel, ModelOrSoundPath)
  20.  
  21.     formatex(ModelOrSoundPath, sizeof (ModelOrSoundPath) -1, "models/player/%s/%s.mdl",  ADMIN_MODEL_CT, ADMIN_MODEL_CT)
  22.     engfunc(EngFunc_PrecacheModel, ModelOrSoundPath)
  23. }
  24.  
  25. public PlayerPostSpawn(id) {
  26.    
  27.     if(!is_user_alive(id) || !is_user_steam(id) || get_user_flags(id) & ADMIN_USER)
  28.                return;
  29.  
  30.         task_set_player_model(id);    
  31. }
  32.        
  33. public player_model_t(id) {
  34.    
  35.         if(cs_get_user_team(id) == CS_TEAM_T)
  36.         {
  37.             cs_set_user_model(id, ADMIN_MODEL_T);
  38.         }
  39. }
  40.  
  41. public player_model_ct(id) {
  42.    
  43.         if(cs_get_user_team(id) == CS_TEAM_CT)
  44.         {
  45.             cs_set_user_model(id, ADMIN_MODEL_CT);
  46.         }
  47. }
  48. public task_set_player_model(id) {
  49.    
  50.     set_task(1.0, "player_model_t", id, _, _,"b")
  51.         set_task(1.5, "player_model_ct", id, _, _,"b")
  52. }
  53.  
  54. stock bool:is_user_steam(id)
  55. {
  56.         new auth[65]
  57.         get_user_authid(id,auth,64)
  58.         if(contain(auth, "STEAM_0:0:") != -1 || contain(auth, "STEAM_0:1:") != -1)
  59.         return true;
  60.         return false;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement