oaaron99

Untitled

Dec 5th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. An extended example (note I added custom arms in this example just to show it's possible, this thread was about hiding arms):
  2.  
  3. #include <sourcemod>
  4. #include <sdkhooks>
  5. #include <sdktools_functions>
  6.  
  7. #pragma semicolon 1
  8.  
  9. new const String:PLAYER_MODEL_DEFAULT[] = "models/player/custom_player/legacy/ctm_swat_variantd.mdl";
  10. new const String:PLAYER_MODEL_CUSTOM[] = "path/to/custom/model.mdl";
  11.  
  12. new const String:ARMS_MODEL[] = "models/weapons/ct_arms_gign.mdl";
  13.  
  14.  
  15. public OnMapStart()
  16. {
  17. PrecacheModel(PLAYER_MODEL_DEFAULT);
  18. PrecacheModel(PLAYER_MODEL_CUSTOM);
  19. PrecacheModel(ARMS_MODEL);
  20. }
  21.  
  22. public OnClientPutInServer(iClient)
  23. {
  24. SDKHook(iClient, SDKHook_SpawnPost, OnSpawnPost);
  25. }
  26.  
  27. public OnSpawnPost(iClient)
  28. {
  29. if(IsClientObserver(iClient) || !IsPlayerAlive(iClient))
  30. return;
  31.  
  32. SetEntityModel(iClient, PLAYER_MODEL_DEFAULT);
  33. SetEntPropString(iClient, Prop_Send, "m_szArmsModel", ARMS_MODEL);
  34.  
  35. CreateTimer(0.1, Timer_CustomModel, GetClientSerial(iClient));
  36. }
  37.  
  38. public Action:Timer_CustomModel(Handle:hTimer, any:iClientSerial)
  39. {
  40. new iClient = GetClientFromSerial(iClientSerial);
  41. if(!iClient)
  42. return;
  43.  
  44. SetEntityModel(iClient, PLAYER_MODEL_CUSTOM);
  45. }
Advertisement
Add Comment
Please, Sign In to add comment