DeathChaos25

ViewModel Stuff (survivor arms)

Mar 23rd, 2015
475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.36 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #define PLUGIN_VERSION      "1.0"
  4.  
  5. static const String:MODEL_NICK_ARMS[]       = "models/v_models/v_shotgun_spas.mdl";
  6.  
  7. public Plugin:myinfo =  
  8. {
  9.     name = "Model Index Tests",
  10.     author = "DeathChaos",
  11.     description = "Survivor arms and stuff",
  12.     version = PLUGIN_VERSION,
  13. }
  14.  
  15. public OnPluginStart()  
  16. {
  17.     RegConsoleCmd("sm_v", ViewModel, "ViewModel Test");  
  18. }
  19.  
  20. public OnMapStart()
  21. {
  22.     CheckModelPreCache(MODEL_NICK_ARMS);
  23. }
  24. public Action:ViewModel(client, args)
  25. {
  26.     if (!IsSurvivor(client))
  27.     {
  28.         return;
  29.     }
  30.     new ViewModelIndex = GetEntPropEnt(client, Prop_Send, "m_hViewModel")  ;
  31.     new String:model[PLATFORM_MAX_PATH]="";
  32.     GetEntPropString(ViewModelIndex, Prop_Data, "m_ModelName", model, sizeof(model));
  33.     new String:message[PLATFORM_MAX_PATH]="";
  34.     Format(message,sizeof(message),"Your Current View Model Index is : %i and it's model is %s", ViewModelIndex, model);
  35.    
  36.    
  37.     PrintToChat(client, message);
  38.     SetEntityModel(ViewModelIndex, MODEL_NICK_ARMS);
  39. }
  40.  
  41. stock bool:IsSurvivor(client)
  42. {
  43.     if (client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2)
  44.     {
  45.         return true;
  46.     }
  47.     return false;
  48. }
  49. stock CheckModelPreCache(const String:Modelfile[])
  50. {
  51.     if (!IsModelPrecached(Modelfile))
  52.     {
  53.         PrecacheModel(Modelfile, true);
  54.         PrintToServer("Precaching Model:%s",Modelfile);
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment