FlacoBey

Untitled

Dec 27th, 2018
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.84 KB | None | 0 0
  1. #include sdktools
  2.  
  3. #define L4D2_WEPUPGFLAG_LASER  (1 << 2)
  4.  
  5. #define PLUGIN_VERSION "1.3.7"
  6.  
  7. public Plugin:myinfo=
  8. {
  9.     name = "LaseroSnimatel",
  10.     author = "BHaType",
  11.     description = "Плагин позволяет снимать и ставить лазер на оружие",
  12.     version = PLUGIN_VERSION,
  13.     url = "SteamId(null)"
  14. };
  15. static int bHasLaser[MAXPLAYERS+1] = 0;
  16.  
  17. public OnMapStart()
  18. {
  19.     for(int i = 1; i <= MaxClients; ++i)
  20.     {
  21.          bHasLaser[i] = 0;
  22.     }
  23. }
  24.  
  25. public OnPluginStart()
  26. {
  27.     RegConsoleCmd("sm_l", LaserTake);
  28. }
  29.  
  30. public Action:LaserTake(client, args)  
  31. {
  32.     new priWeapon = GetPlayerWeaponSlot(client, 0);
  33.     if (priWeapon <= 0 || !IsValidEntity(priWeapon))
  34.     return;
  35.    
  36.     new upgrades = L4D2_GetWeaponUpgrades(priWeapon);
  37.     if (upgrades & L4D2_WEPUPGFLAG_LASER)
  38.     {
  39.         if (bHasLaser[client] == 0)
  40.         {
  41.             CheatCommand(client, "upgrade_remove", "LASER_SIGHT");
  42.             PrintHintText(client,"Лазер снят");
  43.             bHasLaser[client]++;
  44.         }
  45.     }
  46.     if (upgrades != L4D2_WEPUPGFLAG_LASER)
  47.     {
  48.         if (bHasLaser[client] == 1)
  49.         {
  50.             CheatCommand(client, "upgrade_add", "LASER_SIGHT");
  51.             bHasLaser[client] = false;
  52.             PrintHintText(client,"Лазер устоновлен");
  53.         }
  54.     }
  55. }
  56. stock L4D2_GetWeaponUpgrades(weapon)
  57. {
  58.     return GetEntProp(weapon, Prop_Send, "m_upgradeBitVec");
  59. }
  60.  
  61. stock CheatCommand(client, const String:command[], const String:arguments[])
  62. {
  63.     if (!client) return;
  64.     new admindata = GetUserFlagBits(client);
  65.     SetUserFlagBits(client, ADMFLAG_ROOT);
  66.     new flags = GetCommandFlags(command);
  67.     SetCommandFlags(command, flags & ~FCVAR_CHEAT);
  68.     FakeClientCommand(client, "%s %s", command, arguments);
  69.     SetCommandFlags(command, flags);
  70.     SetUserFlagBits(client, admindata);
  71. }
Add Comment
Please, Sign In to add comment