AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Damage multiplier for all weapons (https://forums.alliedmods.net/showthread.php?t=167936)

jsaissac 09-22-2011 02:40

Damage multiplier for all weapons
 
Hi, i'm trying to make a damage multiplier for all weapons, i can't make it work.

I have this:

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <amxmisc>

#define PLUGIN "Damage multiplier"
#define VERSION "1.0"
#define AUTHOR "jsaissac"

new cvar_dmgmultiplier


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_concmd("amx_dmgmultiplier","dmgmultiplier")
    
cvar_dmgmultiplier register_cvar("amx_dmg_multiplier""5")
    
    
// Add your code here...
}

public 
dmgmultiplier(id,Float:damage)
{
    if(!(
get_user_flags(id) & ADMIN_RCON))
    {
        
SetHamParamFloat(4damage get_pcvar_floatcvar_dmgmultiplier ) )
    }


The code is bad, and i don't know how i define "damage" (the underlined).
I want to make this plugin only for rcon admins.
Sorry for my bad english, thanks, jsaissac.

D.Moder 09-22-2011 02:52

Re: Damage multiplier for all weapons
 
PHP Code:

#include <amxmodx>
#include <hamsandwich>

#define PLUGIN "Damage multiplier"
#define VERSION "1.0"
#define AUTHOR "jsaissac"

new cvar_dmgmultiplier

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
cvar_dmgmultiplier register_cvar("amx_dmg_multiplier""5")
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if (
victim == attacker || inflictor != attacker || !is_user_connected(attacker))
        return 
HAM_IGNORED
    
    SetHamParamFloat
(4get_pcvar_float(cvar_dmgmultiplier))
    
    return 
HAM_IGNORED


fixed it for ya

just change the cvar for different damage multiplication

e12harry 09-22-2011 03:15

Re: Damage multiplier for all weapons
 
change
PHP Code:

SetHamParamFloat(4get_pcvar_float(cvar_dmgmultiplier)) 

to
PHP Code:

SetHamParamFloat(4damage get_pcvar_float(cvar_dmgmultiplier)) 

Also as far as I know wouldn't
PHP Code:

inflictor != attacker 

be true if damage was given by HE grenade?

jsaissac 09-22-2011 03:41

Re: Damage multiplier for all weapons
 
Hi, thanks for help, but not work, and I think is missing this:
PHP Code:

register_concmd("amx_dmgmultiplier","fw_takedamage"

or something like this, because, if not how do I make it multiply the damage of the rcon admin?

e12harry 09-22-2011 03:52

Re: Damage multiplier for all weapons
 
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>

#define PLUGIN "Damage multiplier"
#define VERSION "1.0"
#define AUTHOR "jsaissac"

new cvar_dmgmultiplier
new g_iMaxPlayers

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
cvar_dmgmultiplier register_cvar("amx_dmg_multiplier""5")
    
g_iMaxPlayers get_maxplayers()
}

public 
fw_TakeDamage(idinflictorattackerFloat:damagedamage_type)
{
    if(
attacker != id && <= attacker <= g_iMaxPlayers && (get_user_flags(attacker) & ADMIN_RCON) && cs_get_user_team(id) == cs_get_user_team(attacker) )
    {
    
SetHamParamFloat(4damage get_pcvar_float(cvar_dmgmultiplier))
    }


If you don't need checking teams delete #include <cstrike> and cs_get_user_team(id) == cs_get_user_team(attacker)

Moltiply is set with cvar amx_dmg_multiplier (by default set to 5)
Try to set amx_cvar amx_dmg_multiplier 100 and any damage should kill oponent

jsaissac 09-22-2011 04:32

Re: Damage multiplier for all weapons
 
Don't work, autmatically detec if is an admin rcon and multiply his dmg? or it have to be activated by a comand?

e12harry 09-22-2011 04:53

Re: Damage multiplier for all weapons
 
It should automaticly detect if attacker has ADMIN_RCON flag and multiply his damage.
I assum you have required modules enabled in modules.ini and you have added your plugin to plugins.ini?

Try this (ang give log to see thats wrong):

PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>

#define PLUGIN "Damage multiplier"
#define VERSION "1.0"
#define AUTHOR "jsaissac"

new cvar_dmgmultiplier
new g_iMaxPlayers

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
cvar_dmgmultiplier register_cvar("amx_dmg_multiplier""5")
    
g_iMaxPlayers get_maxplayers()
}

public 
fw_TakeDamage(idinflictorattackerFloat:damagedamage_type)
{
    if(
attacker != id && <= attacker <= g_iMaxPlayers && (get_user_flags(attacker) & ADMIN_RCON) && cs_get_user_team(id) == cs_get_user_team(attacker) )
    {
        new 
Float:newDmg damage get_pcvar_float(cvar_dmgmultiplier);
        
SetHamParamFloat(4newDmg)
        
log_amx("[DMG_MULTIPLIER] Old Dmg=%f, New Dmg=%f"damagenewDmg);
    } else {
        
log_amx("[DMG_MULTIPLIER] id:%d, attacker:%d, g_iMaxPlayers:%d, ADMIN_RCON:%d"idattackerg_iMaxPlayersget_user_flags(attacker) & ADMIN_RCON);
    }
    return 
HAM_IGNORED;



jsaissac 09-23-2011 02:12

Re: Damage multiplier for all weapons
 
4 Attachment(s)
what i'm doing bad?

edit: yes i have steam, but i was testing with bots from nosteam. id: jsaissac

e12harry 09-23-2011 02:59

Re: Damage multiplier for all weapons
 
Ham_TakeDamage has no effects on bots. Try with real player.
I have seen somewhere registering ham for entities (like bots), but i have never done that so I can't help you with this.

jsaissac 09-23-2011 03:13

Re: Damage multiplier for all weapons
 
Ok, i'm going to test with players.

EDIT: isn't working with players :/


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

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