Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- static bool:BotsCanUseT1Wep=false;
- static bool:BotsCanUseT2Wep=false;
- public OnPluginStart()
- {
- HookEvent("round_end", eEnd);
- CreateTimer(1.0,TimerUpdate, _, TIMER_REPEAT);
- }
- public Action:eEnd(Handle:event, const String:name[], bool:dontBroadcast)
- {
- BotsCanUseT1Wep=false;
- BotsCanUseT2Wep=false;
- }
- public Action:TimerUpdate(Handle:timer)
- {
- for (new i=1; i<=MaxClients; i++)
- {
- if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2)
- {
- new wIndex = GetPlayerWeaponSlot(i, 0);
- if(wIndex == -1) return Plugin_Continue;
- new String:classname[128];
- GetEdictClassname(wIndex, classname, sizeof(classname));
- if (StrEqual(classname, "weapon_pumpshotgun")
- || StrEqual(classname, "weapon_shotgun_chrome")
- || StrEqual(classname, "weapon_smg")
- || StrEqual(classname, "weapon_smg_silenced")
- || StrEqual(classname, "weapon_smg_mp5"))
- {
- BotsCanUseT1Wep=true;
- //BotsCanUseT2Wep=true;
- }
- }
- }
- return Plugin_Continue;
- }
- public Action:L4D2_OnFindScavengeItem(client, &item)
- {
- if (BotsCanUseT1Wep==false && IsT1Weapon(item))
- {
- return Plugin_Handled;
- }
- else if (BotsCanUseT2Wep==false && IsT2Weapon(item))
- {
- return Plugin_Handled;
- }
- return Plugin_Continue;
- }
- stock bool:IsSMG(entity)
- {
- if (entity > 0 || entity < 2048)
- {
- new String:classname[256];
- new String:modelname[256];
- if (IsValidEntity(entity))
- {
- GetEntityClassname(entity, classname, 128);
- GetEntPropString(entity, Prop_Data, "m_ModelName", modelname, 128);
- if (StrEqual(classname, "weapon_smg")
- || StrEqual(classname, "weapon_smg_spawn")
- || StrEqual(classname, "weapon_smg_silenced")
- || StrEqual(classname, "weapon_smg_silenced_spawn")
- || StrEqual(classname, "weapon_smg_mp5")
- || StrEqual(classname, "weapon_smg_mp5_spawn")
- || StrEqual(modelname, "models/w_models/weapons/w_smg_mp5.mdl")
- || StrEqual(modelname, "models/w_models/weapons/w_smg_uzi.mdl")
- || StrEqual(modelname, "models/w_models/weapons/w_smg_a.mdl"))
- {
- return true;
- }
- }
- }
- return false;
- }
- stock bool:IsT1Shotgun(entity)
- {
- if (entity > 0 || entity < 2048)
- {
- new String:classname[256];
- new String:modelname[256];
- if (IsValidEntity(entity))
- {
- GetEntityClassname(entity, classname, 128);
- GetEntPropString(entity, Prop_Data, "m_ModelName", modelname, 128);
- if (StrEqual(classname, "weapon_pumpshotgun")
- || StrEqual(classname, "weapon_pumpshotgun_spawn")
- || StrEqual(classname, "weapon_shotgun_chrome")
- || StrEqual(classname, "weapon_shotgun_chrome_spawn")
- || StrEqual(modelname, "models/w_models/weapons/w_shotgun.mdl")
- || StrEqual(modelname, "models/w_models/weapons/w_pumpshotgun_a.mdl"))
- {
- return true;
- }
- }
- }
- return false;
- }
- stock bool:IsT2Shotgun(entity)
- {
- if (entity > 0 || entity < 2048)
- {
- new String:classname[256];
- new String:modelname[256];
- if (IsValidEntity(entity))
- {
- GetEntityClassname(entity, classname, 128);
- GetEntPropString(entity, Prop_Data, "m_ModelName", modelname, 128);
- if (StrEqual(classname, "weapon_autoshotgun")
- || StrEqual(classname, "weapon_autoshotgun_spawn")
- || StrEqual(classname, "weapon_shotgun_spas")
- || StrEqual(classname, "weapon_shotgun_spas_spawn")
- || StrEqual(modelname, "models/w_models/weapons/w_autoshot_m4super.mdl")
- || StrEqual(modelname, "models/w_models/weapons/w_shotgun_spas.mdl"))
- {
- return true;
- }
- }
- }
- return false;
- }
- stock bool:IsAssaultRifle(entity)
- {
- if (entity > 0 || entity < 2048)
- {
- new String:classname[256];
- new String:modelname[256];
- if (IsValidEntity(entity))
- {
- GetEntityClassname(entity, classname, 128);
- GetEntPropString(entity, Prop_Data, "m_ModelName", modelname, 128);
- if (StrEqual(classname, "weapon_rifle")
- || StrEqual(classname, "weapon_rifle_spawn")
- || StrEqual(classname, "weapon_rifle_desert")
- || StrEqual(classname, "weapon_rifle_desert_spawn")
- || StrEqual(classname, "weapon_rifle_ak47")
- || StrEqual(classname, "weapon_rifle_ak47_spawn")
- || StrEqual(classname, "weapon_rifle_sg552")
- || StrEqual(classname, "weapon_rifle_sg552_spawn")
- || StrEqual(modelname, "models/w_models/weapons/w_rifle_m16a2.mdl")
- || StrEqual(modelname, "models/w_models/weapons/w_desert_rifle.mdl")
- || StrEqual(modelname, "models/w_models/weapons/w_rifle_ak47.mdl")
- || StrEqual(modelname, "models/w_models/weapons/w_rifle_sg552.mdl"))
- {
- return true;
- }
- }
- }
- return false;
- }
- stock bool:IsSniper(entity)
- {
- if (entity > 0 || entity < 2048)
- {
- new String:classname[256];
- new String:modelname[256];
- if (IsValidEntity(entity))
- {
- GetEntityClassname(entity, classname, 128);
- GetEntPropString(entity, Prop_Data, "m_ModelName", modelname, 128);
- if (StrEqual(classname, "weapon_hunting_rifle")
- || StrEqual(classname, "weapon_hunting_rifle_spawn")
- || StrEqual(classname, "weapon_sniper_military")
- || StrEqual(classname, "weapon_sniper_military_spawn")
- || StrEqual(classname, "weapon_sniper_awp")
- || StrEqual(classname, "weapon_sniper_awp_spawn")
- || StrEqual(classname, "weapon_sniper_scout")
- || StrEqual(classname, "weapon_sniper_scout_spawn")
- || StrEqual(modelname, "models/w_models/weapons/w_sniper_mini14.mdl")
- || StrEqual(modelname, "models/w_models/weapons/w_sniper_military.mdl")
- || StrEqual(modelname, "models/w_models/weapons/w_sniper_awp.mdl")
- || StrEqual(modelname, "models/w_models/weapons/w_sniper_scout.mdl"))
- {
- return true;
- }
- }
- }
- return false;
- }
- stock bool:IsT1Weapon(Primary)
- {
- if (IsValidEdict(Primary) || IsValidEntity(Primary))
- {
- if (IsT1Shotgun(Primary) || IsSMG(Primary))
- {
- return true;
- }
- }
- return false;
- }
- stock bool:IsT2Weapon(Primary)
- {
- if (IsValidEdict(Primary) || IsValidEntity(Primary))
- {
- if (IsT2Shotgun(Primary) || IsAssaultRifle(Primary) || IsSniper(Primary))
- {
- return true;
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement