Raised This Month: $51 Target: $400
 12% 

Damage by the amount of money 1.5


Post New Thread Reply   
 
Thread Tools Display Modes
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 04-09-2009 , 04:57   Re: Damage by the amount of money 1.1
Reply With Quote #21

So the amount of damage you do depends on the money you had *before you bought weapons* ??

Fair enough, I suppose ... but it seems a little wrong.

Also, if someone disables this plugin in-game all it will do is freeze the players' levels at their current state.
(If you don't want to check the cvar value in the damage event, which I fully understand, then the spawn event should set PlayerLevel back to 0 before checking the flag)

And do you really need to query "is_user_alive" at player_spawn? (You may well - been a while since I played with the glorious HamSandwich)

Last edited by purple_pixie; 04-09-2009 at 05:00.
purple_pixie is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-09-2009 , 07:11   Re: Damage by the amount of money 1.1
Reply With Quote #22

Quote:
Originally Posted by purple_pixie View Post
And do you really need to query "is_user_alive" at player_spawn? (You may well - been a while since I played with the glorious HamSandwich)
Yes, because Spawn is called 1 time when a player enter the server.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Old 04-09-2009, 07:19
alan_el_more
This message has been deleted by alan_el_more.
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 04-09-2009 , 07:47   Re: Damage by the amount of money 1.1
Reply With Quote #23

Hmmm... Interesting plugin. Armor basically does the same thing, but what a hey.
SnoW is offline
Send a message via MSN to SnoW
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 04-09-2009 , 08:53   Re: Damage by the amount of money 1.1
Reply With Quote #24

Quote:
Originally Posted by purple_pixie View Post
So the amount of damage you do depends on the money you had *before you bought weapons* ??
Yeah, I think it would be better to hook Money message so you set levels depending on the actual money.

You could even do both things and make a cvar for switching between the two.

And I think you should implement cvars for both the required money and the multi for each level.
__________________
In Flames we trust!
Nextra is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 04-09-2009 , 08:59   Re: Damage by the amount of money 1.1
Reply With Quote #25

Quote:
Originally Posted by Nextra View Post
Yeah, I think it would be better to hook Money message so you set levels depending on the actual money.
How do I do that?
__________________
alan_el_more is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 04-09-2009 , 09:15   Re: Damage by the amount of money 1.1
Reply With Quote #26

Quote:
Originally Posted by alan_el_more View Post
How do I do that?
Check this:

http://forums.alliedmods.net/showthread.php?t=84761

Quote:
Originally Posted by ConnorMcLeod View Post
Yes, because Spawn is called 1 time when a player enter the server.
I just learned that yesterday. Since this plugin uses a cstrike function on spawn, everytime someone joined the server (without the user_is_alive check), it gave me an error. Everybody should be aware of that.

A hamsandwich hook to the spawn event gets called everytime a player joins the server.
__________________
joaquimandrade is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 04-09-2009 , 09:28   Re: Damage by the amount of money 1.1
Reply With Quote #27

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

enum Level
{
    
Level0,
    
Level1,
    
Level2,
    
Level3
}

new 
Level:PlayerLevels[33]
new 
Float:LevelDamageMultiplier[Level] = {_:1.0,_:1.5,_:2.0,_:2.5}

new 
g_enabledmoney

public plugin_init()
{
    
register_plugin("Damage by the amount of money""1.1.2""alan_el_more")
    
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
RegisterHam(Ham_Spawn,"player","playerSpawn",1)
    
    
money get_user_msgid("Money")
    
register_message(money,"hook_money")
    
    
g_enabled register_cvar("amx_dmg_money""1"FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
}

public 
playerSpawn(id)
{
    if(
get_pcvar_num(g_enabled))
    {
        
check_level(id)
    }
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if(
get_pcvar_num(g_enabled))
        
SetHamParamFloat(4damage LevelDamageMultiplier[PlayerLevels[attacker]])
}

public 
hook_money(msg_id,msg_dest,id)
{
    if(!
get_pcvar_num(g_enabled)) return PLUGIN_CONTINUE
        
    check_level
(id)
    
    return 
PLUGIN_CONTINUE
}

public 
check_level(id)
{
    if(
get_pcvar_num(g_enabled))
    {
        new 
money cs_get_user_money(id);
        if(
money 5000)
        {
            
PlayerLevels[id] = Level0;
        }
        else if(
money <= 10000)
        {
            
PlayerLevels[id] = Level1;
        }
        else if(
money <= 14000)
        {
            
PlayerLevels[id] = Level2;
        }
        else
        {
            
PlayerLevels[id] = Level3;
        }
    }

It is well so?
__________________
alan_el_more is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 04-09-2009 , 10:00   Re: Damage by the amount of money 1.1
Reply With Quote #28

Quote:
Originally Posted by alan_el_more View Post
It is well so?
Yeah, that should be ok. But you can leave out the enabled check in both spawn and the money hook because you already do it in check_level.


You should change check_level to:

PHP Code:
public check_level(id)
{
    if(
get_pcvar_num(g_enabled))
    {
        new 
money cs_get_user_money(id);
        if(
money 5000)
        {
            
PlayerLevels[id] = Level0;
        }
        else if(
money <= 10000)
        {
            
PlayerLevels[id] = Level1;
        }
        else if(
money <= 14000)
        {
            
PlayerLevels[id] = Level2;
        }
        else
        {
            
PlayerLevels[id] = Level3;
        }
    }
    else
    {
        
PlayerLevels[id] = Level0;
    }

Then you can leave out the cvar check on Ham_TakeDamage as the players level will be reset on the next round at the latest.
__________________
In Flames we trust!

Last edited by Nextra; 04-09-2009 at 10:07.
Nextra is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 04-09-2009 , 10:04   Re: Damage by the amount of money 1.1
Reply With Quote #29

Also, PlayerSpawn will have to be:
Code:
public playerSpawn(id) {         check_level(id) }
Otherwise it won't reset the level to 0 because check_level is never called ;-)
purple_pixie is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 04-09-2009 , 10:06   Re: Damage by the amount of money 1.1
Reply With Quote #30

As I said, he should remove the cvar check in Spawn and Money hook.
__________________
In Flames we trust!
Nextra 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 07:15.


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