Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include sdktools
- #define L4D2_WEPUPGFLAG_LASER (1 << 2)
- #define PLUGIN_VERSION "1.3.7"
- public Plugin:myinfo=
- {
- name = "LaseroSnimatel",
- author = "BHaType",
- description = "Плагин позволяет снимать и ставить лазер на оружие",
- version = PLUGIN_VERSION,
- url = "SteamId(null)"
- };
- static int bHasLaser[MAXPLAYERS+1] = 0;
- public OnMapStart()
- {
- for(int i = 1; i <= MaxClients; ++i)
- {
- bHasLaser[i] = 0;
- }
- }
- public OnPluginStart()
- {
- RegConsoleCmd("sm_l", LaserTake);
- }
- public Action:LaserTake(client, args)
- {
- new priWeapon = GetPlayerWeaponSlot(client, 0);
- if (priWeapon <= 0 || !IsValidEntity(priWeapon))
- return;
- new upgrades = L4D2_GetWeaponUpgrades(priWeapon);
- if (upgrades & L4D2_WEPUPGFLAG_LASER)
- {
- if (bHasLaser[client] == 0)
- {
- CheatCommand(client, "upgrade_remove", "LASER_SIGHT");
- PrintHintText(client,"Лазер снят");
- bHasLaser[client]++;
- }
- }
- if (upgrades != L4D2_WEPUPGFLAG_LASER)
- {
- if (bHasLaser[client] == 1)
- {
- CheatCommand(client, "upgrade_add", "LASER_SIGHT");
- bHasLaser[client] = false;
- PrintHintText(client,"Лазер устоновлен");
- }
- }
- }
- stock L4D2_GetWeaponUpgrades(weapon)
- {
- return GetEntProp(weapon, Prop_Send, "m_upgradeBitVec");
- }
- stock CheatCommand(client, const String:command[], const String:arguments[])
- {
- if (!client) return;
- new admindata = GetUserFlagBits(client);
- SetUserFlagBits(client, ADMFLAG_ROOT);
- new flags = GetCommandFlags(command);
- SetCommandFlags(command, flags & ~FCVAR_CHEAT);
- FakeClientCommand(client, "%s %s", command, arguments);
- SetCommandFlags(command, flags);
- SetUserFlagBits(client, admindata);
- }
Add Comment
Please, Sign In to add comment