Raised This Month: $344 Target: $400
 86%   Almost there!

Adding A Death Shove Message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mr Misw
Member
Join Date: Aug 2018
Location: India
Old 11-28-2018 , 12:20   Adding A Death Shove Message
Reply With Quote #1

Hi ,
I have a shove plugin in which i want to add a message for death shove .
For Example , When i shove someone and he dies than a message should be displayed .
PLAYER_XYZ Death Shoved XYZ

Code :
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>

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

new cShovecCooldowncInUsecTeamcOnAir
new gLastShove[32]
new 
shove[32]
new const 
TASK_ID_COOLDOWN 9462748;
new 
tTemp;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /shove""shovePlayer")
    
register_clcmd("say /shoveme""ClCmd_On")
    
register_clcmd("say /dontshove""ClCmd_Off")
    
register_clcmd("say /dontshoveme""ClCmd_Off")
    
    
    
cShove register_cvar("shove_force""800")
    
cCooldown register_cvar("shove_cooldown""5")
    
cInUse register_cvar("shove_allow_inuse""1")
    
cTeam register_cvar("shove_team_shove""0")
    
cOnAir register_cvar("shove_on_air""0")
    
    
register_forward(FM_PlayerPreThink"Forward_PlayerPreThink")
    
register_logevent("RoundNew"2"1=Round_Start");
}

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 
client_authorized(id)
{
    
shove[id] = true
}

public 
ClCmd_On(id)
{
    if(
shove[id])
    {
        
c_print(id"!g[SHOVE] !nShove is already enabled!g!")
        return 
PLUGIN_HANDLED
    
}
    else
    {
        
shove[id]=true
        c_print
(id"!g[SHOVE] !nYou have successfully enabled shove!g!")
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED
}
public 
ClCmd_Off(id)
{
    if(!
shove[id])
    {
        
c_print(id"!g[SHOVE] !nShove is already disabled!g!")
        return 
PLUGIN_HANDLED
    
}
    else
    {
        
shove[id]=false;
        
c_print(id"!g[SHOVE] !nYou have successfully disabled shove!g!")
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED
}

public 
client_disconnect(id)
{
    
shove[id] = false;
}
public 
shovePlayer(id)
{
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED
    
    
if(get_systime() - gLastShove[id] < get_pcvar_num(cCooldown))
    {
        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)
    {
        
c_print(id"!g[SHOVE] !nYou can't shove somebody while doing that action!g!")
        return 
PLUGIN_HANDLED
    
}
    
    if(
get_pcvar_num(cTeam) && cs_get_user_team(id) == cs_get_user_team(Index))
    {
        
c_print(id"!g[SHOVE] !nYou can't shove your own teammate!g!")
        return 
PLUGIN_HANDLED
    
}
    
    if(
get_pcvar_num(cOnAir) && !(pev(Indexpev_flags) & FL_ONGROUND))
    {
        
c_print(id"!g[SHOVE] !nYou cannot shove someone on air!g!")
        return 
PLUGIN_HANDLED
    
}  
    
    
get_user_name(idpNamecharsmax(pName))
    
get_user_name(IndextNamecharsmax(tName))
    if(!
shove[id]||!shove[Index])
    {
        if(!
shove[id] && !shove[Index])
        {
            
c_print(id"!g[SHOVE] !nBoth users has disabled shove!g!")
            return 
PLUGIN_HANDLED
        
}
        else if(!
shove[Index])
        {
            
c_print(id"!g[SHOVE] !nThat user has disabled shove!g!")
            return 
PLUGIN_HANDLED
        
}
        else
        {
            
c_print(id"!g[SHOVE] !nSay !g/shoveme !nto enable shove!g!")
            return 
PLUGIN_HANDLED
        
}
        
    }    
    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)
    
c_print(id"!g[SHOVE] !nYou just shoved !t%s!g!"tName)
    
c_print(Index"!g[SHOVE] !nYou have been shoved by !t%s!g!"pName)
    
gLastShove[id] = get_systime()
    
    
tTemp get_pcvar_numcCooldown );
    
set_task1.0"TASK_SHOW_COOLDOWN"id TASK_ID_COOLDOWN__"b" );

    return 
PLUGIN_HANDLED
    
}

public 
TASK_SHOW_COOLDOWN(id)
{
    
    
id -= TASK_ID_COOLDOWN;
    
    
set_hudmessage01500_0.1500.51.00.10.1, -);
    
show_hudmessageid"shove cooldown %d seconds"tTemp );
    
    
tTemp--;
    
    if( 
tTemp <= ) {
        
        if( 
task_existsid TASK_ID_COOLDOWN ) ) {
            
            
remove_taskid TASK_ID_COOLDOWN );
            return;
        }
    }
    
}

stock c_print(idString[ ], any:... )
{
    new 
szMsg190 ]
    
vformatszMsgcharsmaxszMsg ), String)
    
    
replace_allszMsgcharsmaxszMsg ), "!n""^1" )
    
replace_allszMsgcharsmaxszMsg ), "!t""^3" )
    
replace_allszMsgcharsmaxszMsg ), "!g""^4" )
    
    static 
msgSayText 0
    
static fake_user
    
    
if( !msgSayText )
    {
        
msgSayText get_user_msgid"SayText" )
        
fake_user get_maxplayers( ) + 1
    
}
    
    
message_beginid MSG_ONE_UNRELIABLE MSG_BROADCASTmsgSayText_id )
    
write_byteid id fake_user )
    
write_stringszMsg )
    
message_end( )

__________________
Facebook ==> Here
ScrewedUP's Website :
Main Website
My Ranking System [Skin Version] :
ScrewedUP Ranking System
My Ranking System [Without Skin Version] :
ScrewedUP Ranking System
Mr Misw is offline
Old 11-28-2018, 18:24
Napoleon_be
This message has been deleted by Napoleon_be. Reason: nvm lol
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 11-28-2018 , 18:56   Re: Adding A Death Shove Message
Reply With Quote #2

PHP Code:
c_print(0"!g[SHOVE]!n Player!t %s!n have been shoved by!t %s"tNamepName
__________________
a simple act of caring creates an endless ripple.

Last edited by Nutu_; 11-28-2018 at 18:56.
Nutu_ is offline
Mr Misw
Member
Join Date: Aug 2018
Location: India
Old 11-28-2018 , 21:54   Re: Adding A Death Shove Message
Reply With Quote #3

Every Shove Is Not a Death Shove .....
Shove means to push a player away from you
__________________
Facebook ==> Here
ScrewedUP's Website :
Main Website
My Ranking System [Skin Version] :
ScrewedUP Ranking System
My Ranking System [Without Skin Version] :
ScrewedUP Ranking System
Mr Misw is offline
Reply


Thread Tools
Display Modes

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 11:55.


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