Raised This Month: $32 Target: $400
 8% 

how to modify money earning for killing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rivotril
Senior Member
Join Date: Feb 2014
Location: Argentina
Old 03-28-2018 , 14:21   how to modify money earning for killing
Reply With Quote #1

Hello, how can i modify the weapon earning money from killing with 'X' weapon? thanks!
Rivotril is offline
CookieCrumbler
Senior Member
Join Date: Feb 2013
Location: Australia
Old 03-28-2018 , 14:30   Re: how to modify money earning for killing
Reply With Quote #2

Weapon Money Reward(Similar)
__________________
--------------------------------------------------
C is for cookie ... thats good enuff 4 me
CookieCrumbler is offline
Rivotril
Senior Member
Join Date: Feb 2014
Location: Argentina
Old 03-29-2018 , 16:08   Re: how to modify money earning for killing
Reply With Quote #3

Quote:
Originally Posted by CookieCrumbler View Post
yeah but not quite what i'm trying to do, thx anyway

what i want to do is give less money (than 300 per kill) with a weapon or more with another weapon and the hud that checks the earning (that says 300 everytime you kill) say the amount of money that you actually are getting

Last edited by Rivotril; 03-29-2018 at 16:09.
Rivotril is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 03-29-2018 , 18:13   Re: how to modify money earning for killing
Reply With Quote #4

Code:
register_message(get_user_msgid("Money"), "message_money") public message_money(msgid, msgdest, id) {    set_msg_arg_int(1, get_msg_argtype(1), /*whatever amount you need*/) }

Last edited by jimaway; 03-29-2018 at 18:14.
jimaway is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-29-2018 , 18:37   Re: how to modify money earning for killing
Reply With Quote #5

jimaway: That will only update the HUD message.

Not thoroughly tested. The below will give $50 for all weapons, including knife. If you want, a modifier can be added if the kill was via headshot to give an extra $X or multiply pay by X. You can also modify money impact for team-kill.
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fakemeta>

new const Version[] = "0.1";

#define MAX_PLAYERS 32

new const WeaponMoney[] = 
{
    
0,
    
50//P228
    
0,
    
50//SCOUT
    
50//Grenade
    
50//XM1014
    
0,  //C4
    
50//Mac10
    
50//Aug
    
0,  //Smoke
    
50//Elites
    
50//FiveSeven
    
50//Ump45
    
50//SG550
    
50//Galil
    
50//Famas
    
50//USP
    
50//Glock
    
50//Awp
    
50//MP5Navy
    
50//M249
    
50//M3
    
50//M4A1
    
50//Tmp
    
50//G3SG1
    
0,  //Flashbang
    
50//Deagle
    
50//SG552
    
50//AK47
    
50//Knife
    
50  //P90
};

const 
m_iAccount 115;
const 
Default_Kill_Money 300;

new 
g_iWeaponIDMAX_PLAYERS ];

public 
plugin_init() 
{
    
register_plugin"Kill Money by Weapon" Version "bugsy" );
    
    
register_event"DeathMsg" "Event_DeathMsg" "a" "1>0" );
    
register_messageget_user_msgid"Money" ) , "Message_Money" );
}

public 
Event_DeathMsg()
{
    new 
iKiller read_data);
    new 
iVictim read_data);
    
    if ( ( 
iKiller != iVictim ) && is_user_connectediKiller ) && ( cs_get_user_teamiKiller ) != cs_get_user_teamiVictim ) ) )
    {
        
g_iWeaponIDiKiller ] = get_user_weaponiKiller );
    }
}

public 
Message_MoneyiMsgId iMsgDest id )
{
    if ( 
g_iWeaponIDid ] )
    {    
        new 
iNewMoney clamp( ( get_pdata_intid m_iAccount ) - Default_Kill_Money ) + WeaponMoneyg_iWeaponIDid ] ] , 16000 );
        
        
set_pdata_intid m_iAccount iNewMoney );
        
        
set_msg_arg_intARG_LONG iNewMoney );
        
set_msg_arg_intARG_BYTE );
        
        
g_iWeaponIDid ] = 0;
    }

__________________

Last edited by Bugsy; 03-29-2018 at 19:33.
Bugsy is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 03-29-2018 , 19:08   Re: how to modify money earning for killing
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
snip
You don't need to check IsPlayer and is_user_connected because is_user_connected already checks for valid index

PHP Code:
static cell AMX_NATIVE_CALL is_user_connected(AMX *amxcell *params/* 1 param */
{
    
int index params[1];

    if (
index || index gpGlobals->maxClients)
        return 
0;

    
CPlayerpPlayer GET_PLAYER_POINTER_I(index);

    return (
pPlayer->ingame 0);

__________________

Last edited by JusTGo; 03-29-2018 at 19:09.
JusTGo is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-29-2018 , 19:25   Re: how to modify money earning for killing
Reply With Quote #7

Yeah, I know, I added is_user_connected() last minute and didn't consider that.
__________________
Bugsy is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 03-30-2018 , 04:27   Re: how to modify money earning for killing
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
jimaway: That will only update the HUD message.

Not thoroughly tested. The below will give $50 for all weapons, including knife. If you want, a modifier can be added if the kill was via headshot to give an extra $X or multiply pay by X. You can also modify money impact for team-kill.
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fakemeta>

new const Version[] = "0.1";

#define MAX_PLAYERS 32

new const WeaponMoney[] = 
{
    
0,
    
50//P228
    
0,
    
50//SCOUT
    
50//Grenade
    
50//XM1014
    
0,  //C4
    
50//Mac10
    
50//Aug
    
0,  //Smoke
    
50//Elites
    
50//FiveSeven
    
50//Ump45
    
50//SG550
    
50//Galil
    
50//Famas
    
50//USP
    
50//Glock
    
50//Awp
    
50//MP5Navy
    
50//M249
    
50//M3
    
50//M4A1
    
50//Tmp
    
50//G3SG1
    
0,  //Flashbang
    
50//Deagle
    
50//SG552
    
50//AK47
    
50//Knife
    
50  //P90
};

const 
m_iAccount 115;
const 
Default_Kill_Money 300;

new 
g_iWeaponIDMAX_PLAYERS ];

public 
plugin_init() 
{
    
register_plugin"Kill Money by Weapon" Version "bugsy" );
    
    
register_event"DeathMsg" "Event_DeathMsg" "a" "1>0" );
    
register_messageget_user_msgid"Money" ) , "Message_Money" );
}

public 
Event_DeathMsg()
{
    new 
iKiller read_data);
    new 
iVictim read_data);
    
    if ( ( 
iKiller != iVictim ) && is_user_connectediKiller ) && ( cs_get_user_teamiKiller ) != cs_get_user_teamiVictim ) ) )
    {
        
g_iWeaponIDiKiller ] = get_user_weaponiKiller );
    }
}

public 
Message_MoneyiMsgId iMsgDest id )
{
    if ( 
g_iWeaponIDid ] )
    {    
        new 
iNewMoney clamp( ( get_pdata_intid m_iAccount ) - Default_Kill_Money ) + WeaponMoneyg_iWeaponIDid ] ] , 16000 );
        
        
set_pdata_intid m_iAccount iNewMoney );
        
        
set_msg_arg_intARG_LONG iNewMoney );
        
set_msg_arg_intARG_BYTE );
        
        
g_iWeaponIDid ] = 0;
    }

Why are you resetting the g_iWeaponID? Because even if you don't reset it, it won't corrupt anything.
__________________

Last edited by Relaxing; 03-30-2018 at 04:28.
Relaxing is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-30-2018 , 04:47   Re: how to modify money earning for killing
Reply With Quote #9

Quote:
Originally Posted by Relaxing View Post
Why are you resetting the g_iWeaponID? Because even if you don't reset it, it won't corrupt anything.
Because message money is also called on gaining money other than killing thats why he reset it.

But saddly this wont work for grenades.

PHP Code:
public Event_DeathMsg()
{
    new 
iKiller read_data);
    new 
iVictim read_data);
    
    if ( ( 
iKiller != iVictim ) && is_user_connectediKiller ) && ( cs_get_user_teamiKiller ) != cs_get_user_teamiVictim ) ) )
    {
        new 
szWp[32]
        
add(szWp7"weapon_")
        
read_data(4szWp[7], charsmax(szWp))
        if(
equal(szWp[7], "grenade")) formatex(szWpcharsmax(szWp), "weapon_hegrenade");
        
g_iWeaponIDiKiller ] = get_weaponidszWp );
    }

This should work for hegrenade kill
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 03-30-2018 at 07:56.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 03-30-2018 , 06:58   Re: how to modify money earning for killing
Reply With Quote #10

Quote:
Originally Posted by Natsheh View Post
Because message money is also called on gaining money other than killing thats why he reset it.

But saddly this wont work for grenades.
Gotcha
__________________
Relaxing is offline
Reply


Thread Tools
Display Modes

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 02:50.


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