Raised This Month: $ Target: $400
 0% 

how to kick a player back?(not shooting)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-29-2008 , 15:38   Re: how to kick a player back?(not shooting)
Reply With Quote #2

Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> new gkb_radius; new gkb_speed; new g_max_clients; public plugin_init() {     register_plugin("Grenade Knock Back", "0.1", "Exolent");         register_forward(FM_Think, "FwdThink");         gkb_radius = register_cvar("gkb_radius", "200");     gkb_speed = register_cvar("gkb_speed", "800");         g_max_clients = global_get(glb_maxClients); } public FwdThink(ent) {     if( !pev_valid(ent) ) return;         new classname[32];     pev(ent, pev_classname, classname, sizeof(classname) - 1);         if( !equal(classname, "grenade") ) return;         new Float:damage_time;     pev(ent, pev_dmgtime, damage_time);         if( get_gametime() > damage_time ) return;         HandleExplosion(ent); } HandleExplosion(ent) {     new Float:radius = get_pcvar_float(gkb_radius);     new Float:speed = get_pcvar_float(gkb_speed);         new Float:ent_origin[3];     pev(ent, pev_origin, ent_origin);         new client = -1, Float:client_origin[3], Float:distance, Float:calc_speed, Float:velocity[3];     while( (client = engfunc(EngFunc_FindEntityInSphere, client, ent_origin, radius)) )     {         if( !(0 < client <= g_max_clients) ) continue;         if( !is_user_alive(client) ) continue;                 pev(client, pev_origin, client_origin);                 distance = get_distance_f(ent_origin, client_origin);                 calc_speed = speed * (1.0 - (distance / radius));                 get_speed_vector(ent_origin, client_origin, calc_speed, velocity);                 set_pev(client, pev_velocity, velocity);     } } // Thanks GHW_Chronic // from chr_engine.inc stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3]) {     new_velocity[0] = origin2[0] - origin1[0]     new_velocity[1] = origin2[1] - origin1[1]     new_velocity[2] = origin2[2] - origin1[2]     new Float:num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))     new_velocity[0] *= num     new_velocity[1] *= num     new_velocity[2] *= num     return 1; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 10-22-2008 at 15:27.
Exolent[jNr] 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 03:11.


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