User talk:Battle Bott

From Valve Developer Community
Jump to: navigation, search

function eventPlayerSay ( Owner, strText, bTeam )

if string.find(strText, "nade") then
local vVelocity;
local grenade = _EntCreate("grenade_ar2");
local pos = _EntGetPos (Owner)
_EntSetKeyValue(grenade, "damage", "60");
_EntSetPos(grenade, pos);
_EntSetPos(grenade, _PlayerGetShootAng(Owner));
_EntSetOwner(grenade, Owner);
vVelocity = vecMul(_PlayerGetShootAng(Owner), 1500);
_EntSetVelocity(grenade, vVelocity);
_EntSpawn(grenade);
else
return strText;
end;

end;
--Block of variables that need to be defined
local vecpos = _PlayerGetShootPos( Owner );
local plyang = _PlayerGetShootAng( Owner );
_TraceLine( vecpos, plyang, 10000, Owner );
local hitpos = _TraceEndPos();
local surfaceang = _TraceGetSurfaceNormal();
local plyright = _EntGetRightVector( Owner );
local plyang = _PlayerGetShootAng(Owner)
local vecpos = _PlayerGetShootPos(Owner)
local ang2 = vecMul( plyang, vector3( 50, 50, 50 ) )
local ang3 = vecAdd( ang2, vector3( 0, 0, -10 ) )
local endpos = vecAdd( _PlayerGetShootPos(Owner), ang3 )
local muzzlepos = vecAdd( endpos, vecMul( plyright, vector3(10,10,0)))
--End block