AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Shove edit (https://forums.alliedmods.net/showthread.php?t=320157)

Sanjay Singh 12-07-2019 07:28

Shove edit
 
If any player shoved other player and 2nd player is dead due to shove , how can I display that in chat?

PHP Code:

client_print(0,0"%s just deathshoved %s"attackervictim


PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Shove Mod"
#define VERSION "1.0"
#define AUTHOR "Styles"

new cShovecCooldowncInUse
new gLastShove[32]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /shove""shovePlayer")
    
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))
        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))
        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))
        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
    
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 



All times are GMT -4. The time now is 23:49.

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