Raised This Month: $ Target: $400
 0% 

Money for kill a NPC depend on Team (CT, T)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Rirre
Veteran Member
Join Date: Nov 2006
Old 01-13-2009 , 15:21   Money for kill a NPC depend on Team (CT, T)
Reply With Quote #1

Hi,
This works, but there is one problem.
Example:
If im a CT i gain the plusMoney sometimes, and minusMoney with T.

I don't really know the problem...
I want T to gain the plusMoney and CT gain the minusMoney, always to be so.
PHP Code:
new plusMoneyminusMoney

public plugin_init()
{
    
register_plugin("Money for kill NPC""1.0""Rirre")

    
minusMoney register_cvar("amx_minus_money""-100")
    
plusMoney register_cvar("amx_plus_money""100")

    
RegisterHam(Ham_Killed"func_wall""killed")
}

public 
killed(thisididattacker)
{
    new 
players[32], pnumid
    get_players
(playerspnum)
    if (
is_user_connected(id))
    {
        if(!
pev_valid(this))
            return 
HAM_IGNORED

        
new npc[31]
        new 
money

        
if(equal(npc"models/npc.mdl")) {

            for(new 
i=0i<pnumi++) {
            
id players[i]

            if(
cs_get_user_team(id) == CS_TEAM_CT) {
                
money get_pcvar_num(minusMoney)
            }

            if(
cs_get_user_team(id) == CS_TEAM_T) {
                
money get_pcvar_num(plusMoney)
            }
        }
        else
            return 
HAM_HANDLED

        
new attacker[31]
        
get_user_name(idattackerattacker30)
        new 
newmoney cs_get_user_money(idattacker) + money
        cs_set_user_money
(idattackernewmoney1)
    }
    return 
HAM_HANDLED


Last edited by Rirre; 01-13-2009 at 15:30.
Rirre is offline
 



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 01:37.


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