AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   add enable and disable cvars to shove mod plugin (https://forums.alliedmods.net/showthread.php?t=271114)

Zyphir 09-05-2015 13:20

add enable and disable cvars to shove mod plugin
 
1 Attachment(s)
Hello I wanna add enable and disable cvars to shove mod any help ?

and this is the shove mod source which i use

Depresie 09-05-2015 16:09

Re: add enable and disable cvars to shove mod plugin
 
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
    



HamletEagle 09-05-2015 16:44

Re: add enable and disable cvars to shove mod plugin
 
Code:

cvar_enabled = register_cvar("shove_enabled", "1")

JusTGo 09-05-2015 17:27

Re: add enable and disable cvars to shove mod plugin
 
i m blind ? or the cvar already exist shove_allow_inuse 1/0 :shock:

shehzad zaidy 11-12-2015 09:48

Re: add enable and disable cvars to shove mod plugin
 
How To add Commond /dontshove TO dislable shovemod?

shehzad1234 01-16-2016 03:28

Re: add enable and disable cvars to shove mod plugin
 
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<<<

siriusmd99 01-16-2016 04:00

Re: add enable and disable cvars to shove mod plugin
 
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
    



shehzad1234 01-16-2016 10:47

Re: add enable and disable cvars to shove mod plugin
 
Thanxks

shehzad1234 01-16-2016 11:11

Re: add enable and disable cvars to shove mod plugin
 
siriusmd99 bro NOt working

http://i64.tinypic.com/29lenph.png

siriusmd99 01-16-2016 14:56

Re: add enable and disable cvars to shove mod plugin
 
Fixed. I wrote it on mobile and i didn't seen one extra brance. I updated it above.


All times are GMT -4. The time now is 19:24.

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