Re: [REQ] Add feature to this plugin.(Easy for pros)
untested:
PHP Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta>
#define PLUGIN "Shove Mod" #define VERSION "1.0" #define AUTHOR "Styles"
new cShove, cCooldown, cInUse new gLastShove[32], bool:g_dontshove[33]
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /shove", "shovePlayer") register_clcmd("say /dontshove", "RemoveShove") cShove = register_cvar("shove_force", "7") cCooldown = register_cvar("shove_cooldown", "10") cInUse = register_cvar("shove_allow_inuse", "1") register_forward(FM_PlayerPreThink, "Forward_PlayerPreThink") }
public Forward_PlayerPreThink(id) { if(!get_pcvar_num(cInUse) || g_dontshove[id]) return PLUGIN_HANDLED if(pev( id, pev_button ) & IN_USE && !(pev( id, pev_oldbuttons ) & IN_USE ) & !is_user_bot(id)) shovePlayer(id) return PLUGIN_CONTINUE }
public shovePlayer(id) { if(!is_user_alive(id) || g_dontshove[id]) return PLUGIN_HANDLED if(get_systime() - gLastShove[id] < get_pcvar_num(cCooldown)) { client_print(id, print_chat, "[Shove Mod] Your muscles are weak from shoving the player. You must wait to do it again. (%i)", (get_pcvar_num(cCooldown) - (get_systime() - gLastShove[id]))) return PLUGIN_HANDLED } new Index,Body, pName[64], tName[64] get_user_aiming(id,Index,Body,200) if(!Index || !is_user_alive(Index) || g_dontshove[Index]) return PLUGIN_HANDLED new Float:size[3] pev(id, pev_size, size) if(size[2] < 72.0) { client_print(id, print_chat, "[Shove Mod] You can't shove somebody while doing that action.") return PLUGIN_HANDLED } get_user_name(id, pName, 63) get_user_name(Index, tName, 63) new Float:velocity[3], Float:shover[3], Float:shovee[3] pev(id, pev_origin, shover) pev(Index, pev_origin, shovee) for(new Count;Count < 3;Count++) velocity[Count] = (shovee[Count] - shover[Count]) * get_pcvar_float(cShove) set_pev(Index, pev_velocity, velocity) client_print(id, print_chat, "[Shove Mod] You have just shoved %s!", tName) client_print(Index, print_chat, "[Shove Mod] You have just been shoved by %s!", pName) gLastShove[id] = get_systime() return PLUGIN_HANDLED }
public RemoveShove(id) g_dontshove[id] = true public client_disconnect(id) g_dontshove[id] = false
|