/*
Name: StickyNades v1.0.003a
Author: JoeyT2007
Description: Makes grenades stick to walls and players.
Bugs: 1. Having the option to make grenades stick to thrower can cause a glitch to happen, where when people throw a grenade forward while running, the grenade sticks to the players face. (RARE)
2. When a grenade sticks to someone, it doesn't stick in the right place yet, it does stick to them though.
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, I removed the skin and added a colour to it, no credit goes to me whatsoever.
Credits: Creator JoeyT2007
Idea JoeyT2007
Help Saul
Lobe
Errant
Mattie
Superdave
Wonder
GODJonez
MBChrono
GLitched System
If you helped, and you are not on the list, please tell me...
If you didn't help, and you are on the list... then... whoops!
Testing Saul
mupet0000
Errant
Parent Code Wonder (from Venjax's emote mod)
Nade Model Valve
Colour INT's Wonder
Various CMD's Everyone on IRC
If you know how to fix any of these bugs, please tell me! I have been trying to do so for a long time :P
If I missed anything from the credits, please tell me :D
*/
#include <sourcemod>
#include <sdktools_functions>
#define VERSION "v1.0.003a"
new Handle:Switch;
new String:Weapon[30];
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);
// Play sounds when a player gets stuck? 1=YES, 0=NO
CreateConVar("stickynades_emitsounds","1","",FCVAR_NOTIFY);
// Force players to download models and sounds? 1=YES, 0=NO
CreateConVar("stickynades_downloads","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);
// Make grenades stick to the thrower? 1=YES, 0=NO (MAY CAUSE GLITCHES)
CreateConVar("stickynades_sticktothrower","0","",FCVAR_NOTIFY);
// Use a custom model for frag grenades? 1=YES, 0=NO
CreateConVar("stickynades_newmodel","1","",FCVAR_NOTIFY);
// Power of a frag grenade when not stuck to a player. (Real damage = 100)
CreateConVar("stickynades_grenadenormalpower","100","",FCVAR_NOTIFY);
// Power of a frag grenade when stuck to a player. (Real damage = 100)
CreateConVar("stickynades_grenadestuckpower","300","",FCVAR_NOTIFY);
// Radius of a frag grenade when not stuck to a player. (Real radius = 350)
CreateConVar("stickynades_grenadenormalradius","300","",FCVAR_NOTIFY);
// Radius of a frag grenade when stuck to a player. (Real radius = 350)
CreateConVar("stickynades_grenadestuckradius","300","",FCVAR_NOTIFY);
// Shake screen when hit by a stickynade?
CreateConVar("stickynades_shake","1","",FCVAR_NOTIFY);
new stickynades_entity = 0
new stickynades_spawnnadeid = 0
new stickynades_player = 0
new stickynades_string = 0
new stickynades_entity = 0
new stickynades_entity2 = 0
new stickynades_temp = 0
new stickynades_userid = 0
new stickynades_weapon = 0
new stickynades_tempname = 0
new stickynades_tempname2 = 0
new stickynades_location = 0
new stickynades_playerindex = 0
new stickynades_nadex = 0
new stickynades_nadey = 0
new stickynades_nadez = 0
new stickynades_nadexyz = 0
new stickynades_nearid = 0
new stickynades_format = 0
new stickynades_format2 = 0
new stickynades_format3 = 0
new stickynades_format4 = 0
new stickynades_xyz = 0
new stickynades_userteam = 0
new stickynades_hit = 0
new stickynades_nadetype = 0
new stickynades_currentmap = 0
new stickynades_nademodel_red = 0
new stickynades_nademodel_blue = 0
new stickynades_username = 0
new stickynades_nearname = 0
HookEvent("round_start",RoundEvent);
HookEvent("player_hurt",DamageEvent);
HookEvent("player_death",DeathEvent);
HookEvent("grenade_bounce",BounceEvent);
}
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, StopNade)
}
}
if(stickynades_flashsticky == 1)
{
if(StrEqual(Weapon,"flashbang") == true)
{
new stickynades_nadetype = 2
new stickynades_userid = client
CreateTimer(0.15, StopNade)
}
}
}
public Action:LoadStuff(Handle:timer)
{
PrintToChatAll("Grenade Thrown!")
}
public BounceEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
PrintToChatAll("Grenade Bounced!")
}