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

Show Money


Post New Thread Reply   
 
Thread Tools Display Modes
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 05-08-2011 , 07:31   Re: Show Money
Reply With Quote #11

Emp`
Yes, I tried hooking message for my zp_cs_buymenu, but on kill event it screws things up pretty hard. In my case that was because of ham_takedamage:

You shoot enemy, you get +32 $ for 32 damage dealt
You kill enemy, money message, hooking it, changing money, okay.
Ham_takedamage triggers again and things getting screwed up pretty hard. Sometimes I get -5000$, sometimes +54895$.

Here is my code:
PHP Code:
public ham_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    static 
Float:armor
        
    
if (victim<1||victim>g_maxplayers||attacker<1||attacker>g_maxplayers||victim==attacker||!is_user_connected(attacker))
        return 
HAM_IGNORED
        
    zp_cs_damage
[attacker][victim]+=damage
    
    
if (zp_get_user_zombie(attacker))
    {
        
pev(victimpev_armorvaluearmor)
        
        if (
armor 36.0)
            
set_task(0.1"zp_cs_hevsuitstatusiconblink"victim)
            
        if (
armor 1.0)
            
set_task(0.1"zp_cs_hevsuitstatusiconhide"victim)

        if (!
zp_get_user_nemesis(attacker)||zp_get_user_survivor(victim))
        {
            if (!
zp_get_user_nemesis(attacker))
                
zp_cs_player_money[attacker]+=floatround(damage*zp_cs_z_income_cash_rate)
            else
                
zp_cs_player_money[attacker]+=floatround(damage*zp_cs_n_income_cash_rate)
        }        
    }
    else if (
zp_get_user_survivor(attacker))
            
zp_cs_player_money[attacker]+=floatround(damage*zp_cs_s_income_cash_rate)
        else 
            
zp_cs_player_money[attacker]+=floatround(damage*zp_cs_h_income_cash_rate)
    
    if (
zp_cs_player_money[attacker] > zp_cs_moneymax
        
zp_cs_player_money[attacker]=zp_cs_moneymax 

    
if (damage>=float(pev(victimpev_health))&&!(!zp_get_user_zombie(victim)&&!zp_get_user_last_human(victim)&&pev(victimpev_armorvalue)<1.0&&!zp_get_user_survivor(victim)))
        return 
HAM_IGNORED

    message_begin
(MSG_ONE_UNRELIABLEg_msgMoney_attacker
    
write_long(zp_cs_player_money[attacker])
    
write_byte(1)
    
message_end()
        
    return 
HAM_IGNORED
}


public 
ham_PlayerKilled(victimattackershouldgib)
{
    if (
victim<1||victim>g_maxplayers||attacker<1||attacker>g_maxplayers||victim==attacker||!is_user_connected(attacker))
        return 
HAM_IGNORED
    
    
if (zp_get_user_zombie(attacker)&&!zp_get_user_nemesis(attacker))
        
zp_cs_player_money[attacker]+=get_pcvar_num(cvar_zp_cs_infectmoneybonus)
        else if (
zp_get_user_nemesis(attacker))
            
zp_cs_player_money[attacker]+=floatround(float(get_pcvar_num(cvar_zp_cs_infectmoneybonus))*zp_cs_n_income_cash_rate
            else if (
zp_get_user_survivor(attacker)) 
                
zp_cs_player_money[attacker]+=floatround(float(get_pcvar_num(cvar_zp_cs_money_killbonus))*zp_cs_s_income_cash_rate)
                else 
                
zp_cs_player_money[attacker]+=get_pcvar_num(cvar_zp_cs_money_killbonus)
    
    if (
zp_get_user_zombie(attacker)&&!zp_get_user_nemesis(attacker))
    {
        if (
get_pcvar_num(cvar_zp_cs_zombie_nodeathscore)) set_pdata_int(victimOFFSET_DEATHSget_pdata_int(victimOFFSET_DEATHSOFFSET_LINUX)-1OFFSET_LINUX)
        
zp_cs_player_money[victim]+=get_pcvar_num(cvar_zp_cs_deathmoneybonus)
    }
    
    
menu_cancel(victim)
    
show_menu(victim0"^n"1)
    
set_task(0.1"zp_cs_hevsuitstatusiconhide"victim)
        
    return 
HAM_IGNORED

Works perfectly. Also, I had some problem on round start when hooked message, I don't know what the problem was, but it was also solved by hooking event. So i stick with post message (event).
__________________


Last edited by SonicSonedit; 05-08-2011 at 07:33.
SonicSonedit is offline
Groven
AlliedModders Donor
Join Date: Apr 2011
Location: Sweden
Old 05-08-2011 , 10:11   Re: Show Money
Reply With Quote #12

Don't go off-topic please!

Can someone fix this?
Groven is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 05-08-2011 , 10:47   Re: Show Money
Reply With Quote #13

Groven
Upload the cashmod plugin source you currently using.
__________________

SonicSonedit is offline
HBxander
Senior Member
Join Date: Jan 2011
Location: Behind you!
Old 05-08-2011 , 12:42   Re: Show Money
Reply With Quote #14

Try this:
PHP Code:
public eUpdateMoney iPlayer )
{
    new 
gMoney g_iCash[iPlayer]
    
    
cs_set_user_money iPlayergMoney )
    
    
set_task 0.2"eUpdateMoney"iPlayer )
}

public 
FwdPlayerSpawn iPlayer )
{
    
// add:
    
eUpdateMoney iPlayer )

i used it and its working..

Add it to Cashmod.sma file.
__________________
Selling:

- PointMod for Hide And Seek - $20
- Private BlockMaker with Weapon Block And More - $50
- Achievements ( FFA GamePlay ) - $25

PM Me about Private Work!
HBxander is offline
Groven
AlliedModders Donor
Join Date: Apr 2011
Location: Sweden
Old 05-08-2011 , 13:34   Re: Show Money
Reply With Quote #15

Here it is.

I added:

PHP Code:
public eUpdateMoney iPlayer )
{
    new 
gMoney g_iCash[iPlayer]
    
    
cs_set_user_money iPlayergMoney )
    
    
set_task 0.2"eUpdateMoney"iPlayer )
}

public 
FwdPlayerSpawn iPlayer )
{
    
// add:
    
eUpdateMoney iPlayer )

I get Symbol already defined "FwdPlayerSpawn"
Attached Files
File Type: sma Get Plugin or Get Source (cashmod_v007.sma - 412 views - 40.6 KB)

Last edited by Groven; 05-08-2011 at 13:38.
Groven is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 05-08-2011 , 22:16   Re: Show Money
Reply With Quote #16

You just add the specific line that @HBxander put in the FwdPlayerSpawn function, you don't copy the whole function.
__________________
Hi.
Kreation is offline
Groven
AlliedModders Donor
Join Date: Apr 2011
Location: Sweden
Old 05-09-2011 , 13:12   Re: Show Money
Reply With Quote #17

It's not working i added it to line 290-297

PHP Code:
public eUpdateMoney iPlayer )
{
    new 
gMoney g_iCash[iPlayer]
    
    
cs_set_user_money iPlayergMoney )
    
    
set_task 0.2"eUpdateMoney"iPlayer )

Groven is offline
Groven
AlliedModders Donor
Join Date: Apr 2011
Location: Sweden
Old 06-28-2016 , 08:12   Re: Show Money
Reply With Quote #18

Bump?
__________________
Groven is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 06-28-2016 , 08:30   Re: Show Money
Reply With Quote #19

Quote:
Originally Posted by Groven View Post
Bump?
You're plugin compiles fine without any errors, what's the problem?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Groven
AlliedModders Donor
Join Date: Apr 2011
Location: Sweden
Old 06-28-2016 , 12:20   Re: Show Money
Reply With Quote #20

Quote:
Originally Posted by Napoleon_be View Post
You're plugin compiles fine without any errors, what's the problem?
The money that are earned by the CashMod refuses to show up in the corner like regular money.
__________________
Groven 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 04:06.


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