/*
Name: StickyNades v1.0.003a
Author: JoeyT2007
Description: Makes grenades stick to players and walls.
Notes: 1. To make a grenade stick to yourself, aim down and throw a grenade, it will then stick to your feet.
2. The model for the nade is from TF2, no credit goes to me whatsoever.
Credits: Creator JoeyT2007
Idea JoeyT2007
Help k4r1m
WhiteWolf
Testing JoeyT2007
Nade Model Valve
*/
#include <sourcemod>
#define VERSION "v1.0.003a"
new Handle:Switch;
new Handle:stickynades = INVALID_HANDLE;
new Handle:stickynades_fragsticky = INVALID_HANDLE;
new Handle:stickynades_flashsticky = INVALID_HANDLE;
new Handle:stickynades_sticktowalls = INVALID_HANDLE;
new Handle:stickynades_sticktoplayers = INVALID_HANDLE;
new stickynades_nadetype = 0
new stickynades_userid = 0
public Plugin:myinfo =
{
name = "StickyNades",
author = "JoeyT2007",
description = "Makes grenades stick to players and walls.",
version = VERSION,
url = "http://www.mattie.info/cs/"
};
public OnPluginStart()
{
// Start on? This can be toggled in-game to turn StickyNades on or off. 1=ON, 0=OFF
Switch = CreateConVar("stickynades","1","Turns the plugin on and off 1/0",FCVAR_NOTIFY);
// Make frag grenades stick to walls? 1=YES, 0=NO
CreateConVar("stickynades_fragsticky","1","",FCVAR_NOTIFY);
// Make flashbags stick to walls? 1=YES, 0=NO
CreateConVar("stickynades_flashsticky","1","",FCVAR_NOTIFY);
// Make grenades stick to walls? 1=YES, 0=NO
CreateConVar("stickynades_sticktowalls","1","",FCVAR_NOTIFY);
// Make grenades stick to players? 1=YES, 0=NO
CreateConVar("stickynades_sticktoplayers","1","",FCVAR_NOTIFY);
HookEvent("round_start",RoundEvent);
HookEvent("player_hurt",DamageEvent);
HookEvent("player_death",DeathEvent);
HookEvent("grenade_bounce",BounceEvent);
Precache()
}
public Precache()
{
PrecacheModel("sounds/stickynades/muhahaha.wav")
PrecacheModel("sounds/stickynades/scream.wav")
PrecacheModel("models/stickynades/stickynades_red.dx80.vtx")
PrecacheModel("models/stickynades/stickynades_red.dx90.vtx")
PrecacheModel("models/stickynades/stickynades_red.mdl")
PrecacheModel("models/stickynades/stickynades_red.phy")
PrecacheModel("models/stickynades/stickynades_red.sw.vtx")
PrecacheModel("models/stickynades/stickynades_red.sw.vvd")
PrecacheModel("models/stickynades/stickynades_blue.dx80.vtx")
PrecacheModel("models/stickynades/stickynades_blue.dx90.vtx")
PrecacheModel("models/stickynades/stickynades_blue.mdl")
PrecacheModel("models/stickynades/stickynades_blue.phy")
PrecacheModel("models/stickynades/stickynades_blue.sw.vtx")
PrecacheModel("models/stickynades/stickynades_blue.sw.vvd")
PrecacheModel("materials/models/stickynades/stickynades_blue.vtf")
PrecacheModel("materials/models/stickynades/stickynades_blue.vmt")
PrecacheModel("materials/models/stickynades/stickynades_red.vtf")
PrecacheModel("materials/models/stickynades/stickynades_red.vmt")
}
public RoundEvent(Handle:event, const string:name[],bool:dontBroadcast)
{
PrintToChatAll("[StickyNades] Created by JoeyT2007.")
if(stickynades_fragsticky == 1)
{
if(stickynades_sticktowalls == 1)
{
PrintToChatAll("[WARNING] Frag Grenades stick to walls and people.")
}
else
{
PrintToChatAll("[WARNING] Frag Grenades stick to walls only.")
}
else
{
if(stickynades_sticktoplayers == 1)
{
PrintToChatAll("[WARNING] Frag Grenades stick to players.")
}
}
if(stickynades_flashsticky == 1)
{
if(stickynades_sticktowalls == 1)
{
PrintToChatAll("[WARNING] Flashbangs stick to walls and people.")
}
else
{
PrintToChatAll("[WARNING] Flashbangs stick to walls only.")
}
else
{
if(stickynades_sticktoplayers == 1)
{
PrintToChatAll("[WARNING] Flashbangs stick to players.")
}
}
}
public WeaponFire(Handle:event,const String:name[],bool:dontBroadcast)
{
if(stickynades_fragsticky == 1)
{
if(StrEqual(Weapon,"hegrenade") == true)
{
new stickynades_nadetype = 1
new stickynades_userid = client
CreateTimer(0.15, GrenadeThrow)
}
}
if(stickynades_flashsticky == 1)
{
if(StrEqual(Weapon,"flashbang") == true)
{
new stickynades_nadetype = 2
new stickynades_userid = client
CreateTimer(0.15, GrenadeThrow)
}
}
}
public Action:GrenadeThrow(Handle:timer)
{
PrintToChatAll("Grenade Thrown!")
}
public BounceEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
PrintToChatAll("Grenade Bounced!")
}