Raised This Month: $ Target: $400
 0% 

[SNIPPET] Wicked Nades


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 08-06-2013 , 21:24   [SNIPPET] Wicked Nades
Reply With Quote #1

Give nades random direction depending on players movement speed

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <smlib>

public OnEntityCreated(entity, const String:classname[])
{
if (
StrEqual(classname"hegrenade_projectile"))
{
CreateTimer(0.0Timer_RandomentityTIMER_FLAG_NO_MAPCHANGE);
}

if (
StrEqual(classname"flashbang_projectile"))
{
CreateTimer(0.0Timer_RandomentityTIMER_FLAG_NO_MAPCHANGE);
}

if (
StrEqual(classname"smokegrenade_projectile"))
{
CreateTimer(0.0Timer_RandomentityTIMER_FLAG_NO_MAPCHANGE);
}
}

public 
Action:Timer_Random(Handle:Timerany:entity)
{
if(
IsValidEntity(entity))
{
new 
client GetEntPropEnt(entityProp_Send"m_hOwnerEntity");

decl Float:fVelp[3];
new 
Float:currentspeed;

new 
Float:RandomMult;

if(
Client_IsValid(clienttrue))
{
Entity_GetAbsVelocity(clientfVelp);
currentspeed SquareRoot(Pow(fVelp[0],2.0)+Pow(fVelp[1],2.0));

RandomMult currentspeed+1.0 2.0;
}

decl Float:fVeln[3];
Entity_GetAbsVelocity(entityfVeln);

fVeln[1] += GetRandomFloat(RandomMult*(-1.0), RandomMult);
fVeln[0] += GetRandomFloat(RandomMult*(-1.0), RandomMult);

TeleportEntity(entityNULL_VECTORNULL_VECTORfVeln);
}
return 
Plugin_Handled;

__________________

Last edited by asherkin; 01-14-2015 at 20:03.
zipcore is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:29.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode