AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [REQ] Add feature to this plugin.(Easy for pros) (https://forums.alliedmods.net/showthread.php?t=262315)

Klatypaus 05-02-2015 08:37

[REQ] Add feature to this plugin.(Easy for pros)
 
ok

JusTGo 05-02-2015 09:28

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 cShovecCooldowncInUse 
new gLastShove[32], bool:g_dontshove[33]

public 
plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR
    
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(pevidpev_button ) & IN_USE && !(pevidpev_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(idprint_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,BodypName[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(idpev_sizesize
    if(
size[2] < 72.0
    { 
        
client_print(idprint_chat"[Shove Mod] You can't shove somebody while doing that action."
        return 
PLUGIN_HANDLED 
    

     
    
get_user_name(idpName63
    
get_user_name(IndextName63
    new 
Float:velocity[3], Float:shover[3], Float:shovee[3
    
pev(idpev_originshover
    
pev(Indexpev_originshovee
     
    for(new 
Count;Count 3;Count++) 
    
velocity[Count] = (shovee[Count] - shover[Count]) * get_pcvar_float(cShove
    
set_pev(Indexpev_velocityvelocity
    
client_print(idprint_chat"[Shove Mod] You have just shoved %s!"tName
    
client_print(Indexprint_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 



All times are GMT -4. The time now is 20:06.

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