AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   amx_adminmoney.amxx (https://forums.alliedmods.net/showthread.php?t=76772)

terry0412x 08-30-2008 03:23

amx_adminmoney.amxx
 
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.

ConnorMcLeod 08-30-2008 04:20

Re: amx_adminmoney.amxx
 
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



Prajch 08-30-2008 04:42

Re: amx_adminmoney.amxx
 
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?

ConnorMcLeod 08-30-2008 06:14

Re: amx_adminmoney.amxx
 
Quote:

Originally Posted by Prajch (Post 678420)
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 (Post 678420)
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.

Prajch 08-30-2008 06:59

Re: amx_adminmoney.amxx
 
Quote:

Originally Posted by connorr (Post 678458)
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 (Post 678458)
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?

ConnorMcLeod 08-30-2008 07:37

Re: amx_adminmoney.amxx
 
http://svn.alliedmods.net/viewvc.cgi...dx&view=markup

Prajch 08-30-2008 10:14

Re: amx_adminmoney.amxx
 
Very good, thanks. 8)

terry0412x 08-30-2008 13:22

Re: amx_adminmoney.amxx
 
Thanks, but is there a way you can give me a plugin with the cvar?


All times are GMT -4. The time now is 03:10.

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