Advertisement
CamerDisco

Untitled

Jul 12th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #include <camer>
  2.  
  3. public void OnPluginStart()
  4. {
  5. for(int i = 1; i<=MaxClients; i++)
  6. {
  7. if(IsValidClient(i))
  8. SDKHook(i, SDKHook_WeaponEquipPost, OnPostWeaponEquip);
  9. }
  10. }
  11.  
  12. public void OnClientPutInServer(int client)
  13. {
  14. if (!IsFakeClient(client))
  15. SDKHook(client, SDKHook_WeaponEquipPost, OnPostWeaponEquip);
  16. }
  17.  
  18. public Action OnPostWeaponEquip(int client, int entity)
  19. {
  20. char sName[128];
  21. GetEntityClassname(entity, sName, sizeof(sName));
  22. CreateTimer(0.1, done, GetClientUserId(client));
  23. }
  24.  
  25. public Action done(Handle timer, any userid)
  26. {
  27. int client = GetClientOfUserId(userid);
  28. if (!IsValidClient(client))return;
  29.  
  30. int wp = GetPlayerWeaponSlot(client, 0);
  31. int wp2 = GetPlayerWeaponSlot(client, 1);
  32. if(wp != -1)
  33. SetEntPropEnt(client, Prop_Send, "m_hActiveWeapon", wp);
  34. else if(wp2 != -1)
  35. SetEntPropEnt(client, Prop_Send, "m_hActiveWeapon", wp2);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement