Raised This Month: $ Target: $400
 0% 

add enable and disable cvars to shove mod plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zyphir
Junior Member
Join Date: Aug 2015
Old 09-05-2015 , 13:20   add enable and disable cvars to shove mod plugin
Reply With Quote #1

Hello I wanna add enable and disable cvars to shove mod any help ?

and this is the shove mod source which i use
Attached Files
File Type: sma Get Plugin or Get Source (shovemod.sma - 780 views - 2.2 KB)
Zyphir is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 09-05-2015 , 16:09   Re: add enable and disable cvars to shove mod plugin
Reply With Quote #2

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

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

new cShovecCooldowncInUse
new gLastShove[32]
new 
cvar_enabled

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")
    
cvar_enabled register_cvar("shove_enabled, "1")
    
    register_forward(FM_PlayerPreThink, "
Forward_PlayerPreThink")
}

public Forward_PlayerPreThink(id)
{
    if(get_pcvar_num(cvar_shove))
    {
    if(!get_pcvar_num(cInUse))
        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(!get_pcvar_num(cvar_shove))
        return PLUGIN_HANDLED
    
    if(!is_user_alive(id))
        return PLUGIN_HANDLED
    
    if(get_systime() - gLastShove[id] < get_pcvar_num(cCooldown))
    {
        client_print(id, print_chat, "
[Shove ModYour muscles are weak from shoving the playerYou 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))
        return PLUGIN_HANDLED
    
    new Float:size[3]
    pev(id, pev_size, size)
    if(size[2] < 72.0)
    {
        client_print(id, print_chat, "
[Shove ModYou 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
    

Depresie is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-05-2015 , 16:44   Re: add enable and disable cvars to shove mod plugin
Reply With Quote #3

Code:
 cvar_enabled = register_cvar("shove_enabled", "1")
__________________

Last edited by HamletEagle; 09-05-2015 at 16:47.
HamletEagle is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 09-05-2015 , 17:27   Re: add enable and disable cvars to shove mod plugin
Reply With Quote #4

i m blind ? or the cvar already exist shove_allow_inuse 1/0
__________________
JusTGo is offline
shehzad zaidy
BANNED
Join Date: Oct 2015
Old 11-12-2015 , 09:48   Re: add enable and disable cvars to shove mod plugin
Reply With Quote #5

How To add Commond /dontshove TO dislable shovemod?
shehzad zaidy is offline
shehzad1234
BANNED
Join Date: Jan 2016
Location: https://t.me/pump_upp
Old 01-16-2016 , 03:28   Re: add enable and disable cvars to shove mod plugin
Reply With Quote #6

What if want players to enable and disable this with chat print?
/dontshove - you cannot shove %s has disble shove
/shoveme - active shove abilities

Can u impliment this commands ?

>>>Click Here To Contact Me<<<
shehzad1234 is offline
Send a message via ICQ to shehzad1234 Send a message via AIM to shehzad1234 Send a message via Yahoo to shehzad1234
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 01-16-2016 , 04:00   Re: add enable and disable cvars to shove mod plugin
Reply With Quote #7

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

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

new cShovecCooldowncInUse
new gLastShove[32]
new 
bool:canShove[33]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /shove""shovePlayer")
    
register_clcmd("say /canshove","Shove_Toggle")      

cShove register_cvar("shove_force""7")
    
cCooldown register_cvar("shove_cooldown""10")
    
cInUse register_cvar("shove_enable""1")
    
    
register_forward(FM_PlayerPreThink"Forward_PlayerPreThink")
}

public 
client_putinserver(idcanShove[id]=false
public client_disconnect(idcanShove[id]=false

public Forward_PlayerPreThink(id)
{
  
    if(!
get_pcvar_num(cInUse) || !canShove[id])
        return 
PLUGIN_HANDLED
    
if(pevidpev_button ) & IN_USE && !(pevidpev_oldbuttons ) & IN_USE ) & !is_user_bot(id))
        
shovePlayer(id)
    
    return 
PLUGIN_CONTINUE
    
}

public 
Shove_Toggle(id)
{
  if(
canShove[id]){
  
canShove[id]=false
  client_print
(id,print_chat," [INFO] Shove is OFF")
  }else{
  
canShove[id]=true
  client_print
(id,print_chat," [INFO] Shove is ON")
  }
}
public 
shovePlayer(id)
{
    
    if(!
get_pcvar_num(cInUse)){
         
client_print(id,print_chat,"[INFO] You can't use Shove. Plugin is disabled."
        return 
PLUGIN_HANDLED
}
    
    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
    


Last edited by siriusmd99; 01-16-2016 at 14:55.
siriusmd99 is offline
shehzad1234
BANNED
Join Date: Jan 2016
Location: https://t.me/pump_upp
Old 01-16-2016 , 10:47   Re: add enable and disable cvars to shove mod plugin
Reply With Quote #8

Thanxks
shehzad1234 is offline
Send a message via ICQ to shehzad1234 Send a message via AIM to shehzad1234 Send a message via Yahoo to shehzad1234
shehzad1234
BANNED
Join Date: Jan 2016
Location: https://t.me/pump_upp
Old 01-16-2016 , 11:11   Re: add enable and disable cvars to shove mod plugin
Reply With Quote #9

siriusmd99 bro NOt working

shehzad1234 is offline
Send a message via ICQ to shehzad1234 Send a message via AIM to shehzad1234 Send a message via Yahoo to shehzad1234
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 01-16-2016 , 14:56   Re: add enable and disable cvars to shove mod plugin
Reply With Quote #10

Fixed. I wrote it on mobile and i didn't seen one extra brance. I updated it above.
siriusmd99 is offline
Reply



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 19:24.


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