View Full Version : [Solved] [REQ] More Money Plugin With Bank
yas17sin
01-03-2017, 20:20
Hi all
I want a plugin make money more than 16000 i want make it 200000 and make auto save without need for player to type anything if anyone can help please make it :)
Don't tested, I have it on my Furien Mod plugin and it works
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <nvault>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
#define MAX_PLAYERS 32
#define Money_Amount 1
#define XTRA_OFS_PLAYER 5
#define m_iAccount 115
#define cs_set_money_value(%1,%2) set_pdata_int(%1, m_iAccount, %2, XTRA_OFS_PLAYER)
new PlayerMoney[MAX_PLAYERS+1]
enum
{
DeathMsg_KillerID = 1,
DeathMsg_VictimID
}
new g_iNewMoney
new g_iMsgHookMoney
new gmsgMoney
new nVault
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg" , "eDeath_Msg", "a" )
register_message(get_user_msgid("Money"), "message_money" )
nVault = nvault_open("PlayerMoney")
if(nVault == INVALID_HANDLE)
set_fail_state("Error opening Money nVault, file does not exist!")
}
public client_putinserver(id)
{
if(!is_user_bot(id))
LoadUserMoney(id)
}
public client_disconnect(id)
{
if(!is_user_bot(id))
SaveUserMoney(id)
}
public eDeath_Msg()
{
new iKiller = read_data( 1 )
if( !iKiller )
return
PlayerMoney[ iKiller ] = cs_get_user_money( iKiller )
}
public message_money()
{
new iKiller = read_data(DeathMsg_KillerID)
if(is_user_connected(iKiller) && is_user_alive(iKiller))
{
new iVictim = read_data(DeathMsg_VictimID)
if( iVictim != iKiller )
{
PlayerMoney[ iKiller ] += 300
g_iNewMoney = clamp
(
cs_set_user_money( iKiller, PlayerMoney[iKiller],1),
0,
99999999
)
g_iMsgHookMoney = register_message(gmsgMoney, "Message_Money")
return PLUGIN_HANDLED
}
}
return PLUGIN_HANDLED
}
public Message_Money(iMsgId, iMsgDest, id)
{
unregister_message(gmsgMoney, g_iMsgHookMoney)
cs_set_money_value(id, g_iNewMoney)
set_msg_arg_int(Money_Amount, ARG_LONG, g_iNewMoney)
}
SaveUserMoney( id )
{
new szAuthid[32]
get_user_authid(id, szAuthid, charsmax(szAuthid))
new szVaultKey[128], szVaultData[512]
formatex(szVaultKey, 127, "%s-Money", szAuthid)
formatex(szVaultData, 511, "%i", PlayerMoney[id])
nvault_set(nVault, szVaultKey, szVaultData)
}
LoadUserMoney(id)
{
new szAuthid[32]
get_user_authid(id, szAuthid, charsmax(szAuthid))
new szVaultKey[128], szVaultData[512]
formatex(szVaultKey, 127, "%s-Money", szAuthid )
formatex(szVaultData, 511, "%i", PlayerMoney[id])
nvault_get(nVault, szVaultKey, szVaultData,511)
new money[32]
parse(szVaultData, money, 31)
PlayerMoney[id] = str_to_num(money)
cs_set_user_money(id,PlayerMoney[id])
}
yas17sin
01-04-2017, 07:49
thanks i go test it :)
yas17sin
01-04-2017, 08:28
there is a bug with money when i win round and i play next round the money show me 0 $ then when next round come the money back if my money was 20000 it get it back and that keep happen every round and i did change this value because i wannt the money be limited to 200000 $
i think this for money limit :
cs_set_user_money( iKiller, PlayerMoney[iKiller],1),
0,
9999999
i change it to :
cs_set_user_money( iKiller, PlayerMoney[iKiller],1),
0,
200000
and i test the tow change but the bug still happen and can you make it auto save money by name
Try hooking the Ham_Spawn and add
cs_set_user_money( id, PlayerMoney[id],1)
yas17sin
01-04-2017, 18:58
sorry but i am not a scripter i know just a little things but what i understand is to change the cmd line with this one you give me and that what i did but when i compile it give me error so please help me
can i ask you how the money save ? and the limit of money is ?
For hook the spawn:
#include <hamsandwich>
RegisterHam(Ham_Spawn,"player","playerSpawn",1)
public playerSpawn(id)
if(is_user_alive(id))
cs_set_user_money( id, PlayerMoney[id],1)
cs_set_user_money( iKiller, PlayerMoney[iKiller],1),
0,
200000
The 20000 is the limit, the save is the SaveUserMoney(id) and LoadUserMoney(id) function.
yas17sin
01-04-2017, 19:35
Thanks for your help .
You are the best
The plugin work perfect :)
Naaaah, i'm not the best :3
yas17sin
01-04-2017, 20:07
You are the best in my opinion and because you are the only one helped me thank you very much
Most of all helpers here are busy I think.
yas17sin
01-04-2017, 20:12
Okay i can see that .
But you don't like to be take some thanks and best or what
No, obviously you can say that, that was sarcasm, but lets stop talk here, we already solved your thread :V
Edit: thank you xD
yas17sin
01-04-2017, 20:20
Oay thanks again and i just want to say you are the best :) .
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.