PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
public Plugin myinfo =
{
name = "Slay on Auto-Sniper pickup",
author = "Cruze",
description = "",
version = "1.0",
url = ""
};
public void OnPluginStart()
{
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i))
{
OnClientPutInServer(i);
}
}
}
public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_WeaponCanUse, Event_WeaponCanUse);
}
public Action Event_WeaponCanUse(int client, int weapon)
{
if(!IsClientInGame(client))
return Plugin_Continue;
if(!IsValidEdict(weapon))
{
return Plugin_Continue;
}
char classname[64];
GetEdictClassname(weapon, classname, sizeof(classname));
if(classname[0] == '\0')
{
return Plugin_Continue;
}
if(StrContains(classname, "scar20", false) != -1 || StrContains(classname, "g3sg1", false) != -1)
{
ForcePlayerSuicide(client); //Really stupid to slay instead of just blocking pickup.
return Plugin_Handled;
}
return Plugin_Continue;
}
__________________