Raised This Month: $ Target: $400
 0% 

amx_adminmoney.amxx


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
terry0412x
Member
Join Date: Feb 2007
Old 08-30-2008 , 03:23   amx_adminmoney.amxx
Reply With Quote #1

Hey guys, I tried to make a plugin, when I noticed that I suck at coding, so I want to ask you guys if you guys can make one for me? :]

Well, the plugin's kind of simple, the plugin does a check for the flag "ADMIN_SLAY", and if that's assigned with the person, then admins always get 2x, 3x, 4x, etc.. more money. (Please make it so that the 2x, 3x, etc is configurable with a CVAR, like amx_adminmoney 1|2|3|, etc.) So if it's set to something more than 1, then it's active, automatically. So 2 = 2x more money for admins, 3 = 3x more money for admins, etc.. If this can be made, I think it may be in like amx_super or something. Lawl. Thanks guys.

Last edited by terry0412x; 08-30-2008 at 03:26.
terry0412x is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-30-2008 , 04:20   Re: amx_adminmoney.amxx
Reply With Quote #2

Try this :

PHP Code:
/*    Copyright © 2008, ConnorMcLeod

    More Money For Admins is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with More Money For Admins; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#define ADMIN_MONEY        ADMIN_SLAY

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "More Money For Admins"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

#define MAX_PLAYERS    32

#define OFFSET_CSMONEY  115

new bool:g_bMoney[MAX_PLAYERS+1]
new 
g_iMoney[MAX_PLAYERS+1]

new 
g_pcvarNoLooseg_pcvarMoreMoney

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
g_pcvarNoLoose register_cvar("admin_money_noloose""1")
    
g_pcvarMoreMoney register_cvar("admin_money_factor""2")

    
register_message(get_user_msgid("Money"),"Message_Money")
}

public 
client_authorized(id)
{
    
g_bMoney[id] = bool:(get_user_flags(id) & ADMIN_MONEY)
    
g_iMoney[id] = 0
}

public 
Message_Money(iMsgIdMSG_DESTid)
{
    if( !
g_bMoney[id] )
        return 
PLUGIN_CONTINUE

    
new iOldMoney g_iMoney[id]
    new 
iNewMoney get_msg_arg_int(1)
    new 
iDiff iNewMoney iOldMoney

    
if( iDiff && get_pcvar_float(g_pcvarNoLoose) )
    {
        
set_pdata_int(idOFFSET_CSMONEYiOldMoney)
        return 
PLUGIN_HANDLED
    
}

    new 
iFactor get_pcvar_num(g_pcvarMoreMoney)

    if( 
iDiff && iFactor )
    {
        
iDiff *= iFactor
        iNewMoney 
min(iOldMoney iDiff16000)

        
set_pdata_int(idOFFSET_CSMONEYiNewMoney)
        
set_msg_arg_int (1ARG_LONGiNewMoney)
    }

    
g_iMoney[id] = iNewMoney
    
return PLUGIN_CONTINUE

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-30-2008 at 06:14.
ConnorMcLeod is offline
Prajch
Senior Member
Join Date: Dec 2007
Location: anger++
Old 08-30-2008 , 04:42   Re: amx_adminmoney.amxx
Reply With Quote #3

I think he wants a money multiplier though so you could change it to something like
PHP Code:
iNewMoney min(iOldMoney iFactor16000
Do you use set_pdata just to avoid the cstrike module?
Prajch is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-30-2008 , 06:14   Re: amx_adminmoney.amxx
Reply With Quote #4

Quote:
Originally Posted by Prajch View Post
I think he wants a money multiplier though so you could change it to something like
PHP Code:
iNewMoney min(iOldMoney iFactor16000
This is wrong, i also was wrong, code updated.
If cvar = 2, if your money is 4000 and your team win 1000, you will win 2000 (now).

Quote:
Originally Posted by Prajch View Post
Do you use set_pdata just to avoid the cstrike module?
Yep, i don't use this module, + using cs_set_user_money would send another Money message that is useless in this case.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Prajch
Senior Member
Join Date: Dec 2007
Location: anger++
Old 08-30-2008 , 06:59   Re: amx_adminmoney.amxx
Reply With Quote #5

Quote:
Originally Posted by connorr View Post
This is wrong, i also was wrong, code updated.
If cvar = 2, if your money is 4000 and your team win 1000, you will win 2000 (now).
Right, I guess I meant to do what you're doing now, oldmoney + addedmoney*multiplier.

Quote:
Originally Posted by connorr View Post
Yep, i don't use this module, + using cs_set_user_money would send another Money message that is useless in this case.
Maybe you could block the first one? I guess it doesn't matter.

Is there a guide anywhere for all the offsets?

Last edited by Prajch; 08-30-2008 at 07:01.
Prajch is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-30-2008 , 07:37   Re: amx_adminmoney.amxx
Reply With Quote #6

http://svn.alliedmods.net/viewvc.cgi...dx&view=markup
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Prajch
Senior Member
Join Date: Dec 2007
Location: anger++
Old 08-30-2008 , 10:14   Re: amx_adminmoney.amxx
Reply With Quote #7

Very good, thanks.
Prajch is offline
terry0412x
Member
Join Date: Feb 2007
Old 08-30-2008 , 13:22   Re: amx_adminmoney.amxx
Reply With Quote #8

Thanks, but is there a way you can give me a plugin with the cvar?
terry0412x 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 03:10.


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