Sorinel

Player model changer 1.0.1

Jan 9th, 2021
1,074
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include < amxmodx >
  2. #include < cstrike >
  3. #include < fakemeta >
  4. #include < hamsandwich >
  5.  
  6. #define FLAG ADMIN_LEVEL_H
  7.  
  8. #define PLUGIN   "PLAYER MODEL CHANGER"
  9. #define VERSION  "1.0.1"
  10. #define AUTHOR   "Sorinel"
  11.  
  12. new const VIP_MODEL[ ] = {
  13.    
  14.     "vip1",
  15.     "vip2",
  16.     "vip3",
  17.     "vip4"
  18. }
  19.  
  20. public plugin_init() {
  21.    
  22.     register_plugin( PLUGIN, VERSION, AUTHOR )
  23.     RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
  24. }
  25.  
  26. public plugin_precache() {
  27.    
  28.     new ModelOrSoundPath[128]
  29.    
  30.     formatex(  ModelOrSoundPath,  sizeof  (  ModelOrSoundPath  )  -1, "models/player/%s/%s.mdl",  VIP_MODEL, VIP_MODEL )
  31.     engfunc( EngFunc_PrecacheModel, ModelOrSoundPath)
  32. }
  33.  
  34. public fwHamPlayerSpawnPost(id) {
  35.    
  36.     if(!is_user_alive(id) && get_user_flags(id) & FLAG ) {
  37.        
  38.         if(random_num(0, 4))
  39.         {
  40.             if(cs_get_user_team(id) == CS_TEAM_CT)
  41.             {
  42.                 cs_set_user_model(id, VIP_MODEL)
  43.             }
  44.         }
  45.     }
  46. }
RAW Paste Data