修改下原码
#define SQLON 1 // 1 = Use SQL | 0 = Use file#include <amxmodx>
#include <amxmisc>
#include <cstrike>
new HELPPAGE[] = "http://home.netcom.com/~everco_ice/bankhelp17.html"
new bool:canuse = false
new interest = 0
new bankfees = 0
new rounds = 0
new sayspecial = 0
#if SQLON
#include <dbi>
#else
#include <vault>
#endif
#if SQLON
new Sql:dbc
new Result:result
#else
new allowfilepath
#endif
public plugin_init()
{
register_plugin("AMX Bank","1.7","twistedeuphoria")
register_concmd("bank_create","bank_create",ADMIN_USER,"Create a new bank account.")
register_concmd("bank_close","bank_close",ADMIN_CVAR,"Close the AMX Bank.")
register_concmd("bank_open","bank_open",ADMIN_CVAR,"Open the AMX Bank for business.")
register_concmd("bank_amount","bank_amount",ADMIN_USER,"Display the amount of money you have in the bank.")
register_concmd("bank_deposit","bank_deposit",ADMIN_USER,"<amount> :Deposit money into your bank account.")
register_concmd("bank_withdraw","bank_withdrawl",ADMIN_USER,"<amount> :Withdraw money from your bank account.")
register_concmd("bank_help","bank_help",ADMIN_USER,"Open up the help for the bank.")
register_concmd("bank_shujuqingling","bank_shujuqingling",ADMIN_USER,"<user> <amount> : Transfer money to another player.")
register_concmd("bank_givemoney","bank_givemoney",ADMIN_CVAR,"<user> <amount> : Give a user money.")
register_concmd("bank_menu","bank_menu",ADMIN_USER,"Open the bank menu.")
register_concmd("maxdep","deposit_maximum",ADMIN_USER,"Deposit all your money.")
register_concmd("maxwit","withdrawl_maximum",ADMIN_USER,"Withdrawl until you have $16000 or your bank account is empty.")
register_clcmd("say","say_cheese")
register_clcmd("say_team","say_cheese")
register_cvar("bank_default_opening","100")
register_cvar("bank_state","1")
register_cvar("bank_min_players","4")
register_cvar("bank_restrict","0") // 0 = All user can use the bank 1 = Only users defined in file or SQL
register_cvar("bank_interest_rounds","15")
register_cvar("bank_interest_rate","0.0001")
register_cvar("bank_fees_base","0")//Base bank fee in $
register_cvar("bank_fees_increase","0") //Added to the base fee for each transaction in a round
register_cvar("bank_offrounds","1") //How many rounds from the start of the map will bank be off for
register_cvar("bank_msg_interval","60")
register_cvar("bank_msg","[系统提示]本服务器使用了银行插件.输入bank_menu调用银行菜单 服务器玩家交流QQ群13394675.")
register_cvar("bank_use_ip","0")
register_menucmd(register_menuid("Bank Menu:"),1023,"bank_menu_cmd")
register_logevent("giveinterest",2,"0=World triggered","1=Round_Start")
register_event("Money", "hookmoney", "b")
#if SQLON
set_task(5.0,"sqlinit")
#else
new directory
get_configsdir(directory,200)
if(get_cvar_num("bank_restrict") == 2)
{
formatex(allowfilepath,250,"%s/bankusers.ini",directory)
if(!file_exists(allowfilepath))
{
new writestr
formatex(writestr,100,";Put all users who can use the bank in here.")
write_file(allowfilepath,writestr)
}
}
#endif
set_task(float(get_cvar_num("bank_msg_interval")),"bank_spam")
}
public check_use(id,pos)
{
if(id)
{
if(canuse == false)
{
if(pos)
client_print(id,print_chat,"[银行]你无权使用银行提供的服务.")
else
console_print(id,"You are not allowed to use the bank.")
return 0
}
}
new cvarrounds = get_cvar_num("bank_offrounds")
if(rounds <= cvarrounds)
{
if(pos)
client_print(id,print_chat,"[系统提示]对不起,每张地图的前%d局银行功能关闭.",cvarrounds)
else
console_print(id,"Sorry, the bank is disabled for the first %d rounds of the map.",cvarrounds)
return 0
}
if(!get_cvar_num("bank_state"))
{
if(pos)
client_print(id,print_chat,"[银行]对不起, 银行停业中...所有交易暂停.")
else
console_print(id,"Sorry, the bank is closed and no transactions are being processed.")
return 0
}
new players = get_playersnum()
new minplayers = get_cvar_num("bank_min_players")
if(players < minplayers)
{
if(pos)
client_print(id,print_chat,"[系统提示]至少要有%d个玩家才可以使用银行功能.",minplayers)
else
console_print(id,"There must be at least %d players connected to use the bank.",minplayers)
return 0
}
return 1
}
public get_balance(id)
{
new sid
new balance = -1
if(get_cvar_num("bank_use_ip"))
get_user_ip(id,sid,34)
else
get_user_name(id,sid,34)
#if SQLON
result = dbi_query(dbc,"SELECT * FROM bank WHERE sid = '%s'",sid)
if(result == RESULT_NONE)
dbi_free_result(result)
else
{
dbi_nextrow(result)
balance = dbi_result(result,"amount")
dbi_free_result(result)
}
#else
new key
formatex(key,50,"%s_account",sid)
if(vaultdata_exists(key))
{
new balancestr
get_vaultdata(key,balancestr,20)
balance = str_to_num(balancestr)
}
#endif
return balance
}
public set_balance(id,balance)
{
new sid
if(get_cvar_num("bank_use_ip"))
get_user_ip(id,sid,34)
else
get_user_name(id,sid,34)
#if SQLON
result = dbi_query(dbc,"UPDATE bank SET amount = '%d' WHERE sid = '%s'",balance,sid)
if(result == RESULT_NONE)
{
dbi_free_result(result)
return -1
}
else
return 1
#else
new key
formatex(key,50,"%s_account",sid)
if(vaultdata_exists(key))
{
new balancestr
num_to_str(balance,balancestr,20)
set_vaultdata(key,balancestr)
return 1
}
else
return -1
#endif
return -1
}
public bank_menu(id)
{
new client = 0
if(read_argc() > 1)
client = 1
if(!check_use(id,client)) return PLUGIN_HANDLED
new menubody, keys = 0,len
new bool:hasacc = true
len = format(menubody,275,"\yBank Menu:\w^n")
if(get_balance(id) == -1)
{
hasacc = false
len += format(menubody,275-len,"1. 创建银行账户^n\d")
keys |= (1<<0|1<<9)
}
else
len += format(menubody,275-len,"\d1. 创建银行账户^n\w")
len += format(menubody,275-len,"2. 查询账户余额^n3. 存款^n4. 全部存入银行^n5. 取款^n6. 取款至16000^n^n")
if(hasacc)
{
len += format(menubody,275-len,"0. 退出")
keys |= (1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<9)
}
else
len += format(menubody,275-len,"\w0. Exit")
show_menu(id,keys,menubody,-1,"Bank Menu:")
return PLUGIN_CONTINUE
}
public bank_menu_cmd(id,key)
{
switch(key)
{
case 0: client_cmd(id,"bank_create 1")
case 1: client_cmd(id,"bank_amount 1")
case 2:
{
sayspecial = 1
client_print(id,print_chat,"[银行]按Y输入你的存款金额.")
}
case 3: client_cmd(id,"maxdep")
case 4:
{
sayspecial = 2
client_print(id,print_chat,"[银行]按Y输入你的取款金额.")
}
case 5: client_cmd(id,"maxwit")
case 6: client_cmd(id,"bank_help")
case 7:
{
sayspecial = 3
client_print(id,print_chat,"[系统警告]服务器转帐功能永久关闭。再次转帐服务器自动清除你的所有数据.")
}
}
return PLUGIN_HANDLED
}
public bank_givemoney(id,level,cid)
{
if(!cmd_access(id,level,cid,3))
return PLUGIN_HANDLED
new target, tid
read_argv(1,target,31)
tid = cmd_target(id,target,2)
if(!tid)
return PLUGIN_HANDLED
new amountstr, amount
read_argv(2,amountstr,9)
amount = str_to_num(amountstr)
new totam = amount
new curmoney = cs_get_user_money(tid)
new newtotal = curmoney + amount
if(newtotal > 16000)
{
cs_set_user_money(tid,16000)
amount = newtotal - 16000
}
else
{
cs_set_user_money(tid,newtotal)
amount = 0
}
if(amount > 0)
{
new balance = get_balance(tid)
if(balance != -1)
set_balance(id,balance + amount)
}
new name, tname
get_user_name(id,name,31)
get_user_name(tid,tname,31)
if(read_argc() == 4)
client_print(id,print_chat,"[银行]来钱啦!你收到了%s的$%d汇款.",tname,totam)
else
console_print(id,"You gave %s $%d.",tname,totam)
client_print(tid,print_chat,"[银行]%s给了你$%d汇款, 你帐户的余额为$%d.",name,totam,amount)
return PLUGIN_HANDLED
}
public bank_shujuqingling(id)
{
new client = 0
if(read_argc() > 3)
client = 1
if(!check_use(id,client)) return PLUGIN_HANDLED
new target
read_argv(1,target,31)
new tgt = cmd_target(id,target,8)
if(!tgt)
return PLUGIN_HANDLED
if(id == tgt)
{
if(client)
client_print(id,print_chat,"[银行]你不能给自己汇款.")
else
console_print(id,"You may not transfer money to yourself.")
return PLUGIN_HANDLED
}
new tamounts,tamount
read_argv(2,tamounts,8)
tamount = str_to_num(tamounts)
if(tamount <= 0) return PLUGIN_HANDLED
new balance = get_balance(id)
if(balance == -1)
{
if(client)
client_print(id,print_chat,"[银行]要使用汇款功能,请先开通你的银行帐户.")
else
console_print(id,"You do not have a bank account to transfer money from.")
return PLUGIN_HANDLED
}
new tbalance = get_balance(tgt)
new name, tname
get_user_name(tgt,tname,31)
get_user_name(id,name,31)
if(tbalance == -1)
{
if(client)
client_print(id,print_chat,"[银行]对不起,%s没有银行帐户,不能接收你的汇款.",tname)
else
console_print(id,"%s does not have a bank account to transfer money to.",tname)
client_print(tgt,print_chat,"[银行]%s试图汇款给你但是你没有银行帐户!",name)
return PLUGIN_HANDLED
}
balance -= tamount
balance -= bankfees
if(balance < 0)
{
if(client)
client_print(id,print_chat,"[银行]你的帐户余额不足.")
else
console_print(id,"You do not have enough money in your bank account.")
return PLUGIN_HANDLED
}
tbalance += tamount
if(bankfees > 0)
{
if(client)
client_print(id,print_chat,"[银行]银行收取了$%d手续费.",bankfees)
else
console_print(id,"You paid $%d in bank fees.",bankfees)
}
set_balance(id,balance)
set_balance(tgt,tbalance)
if(client)
client_print(id,print_chat,"[银行]恭喜你!你已经成功汇款$%d到%s的银行账户. 你帐户的余额为$%d.",tamount,tname,balance)
else
console_print(id,"You have transferred $%d to %s's bank account. You now have $%d in your account.",tamount,tname,balance)
client_print(tgt,print_chat,"[银行]来钱啦!%s汇款$%d到你的银行帐户.你帐户的余额为$%d.",name,tamount,tbalance)
return PLUGIN_HANDLED
}
public hookmoney()
{
if(!get_cvar_num("bank_state"))
return PLUGIN_CONTINUE
new curmoney = read_data(1)
if(curmoney < 16000)
return PLUGIN_CONTINUE
new id
for(new inum=0;inum<=32;inum++)
{
if(!is_user_connected(inum)) continue
new rmoney = cs_get_user_money(inum)
if(rmoney == curmoney)
{
id = inum
break;
}
}
if(canuse == false)
return PLUGIN_CONTINUE
new cvarrounds = get_cvar_num("bank_offrounds")
if(rounds <= cvarrounds)
return PLUGIN_CONTINUE
if(get_playersnum() >= get_cvar_num("bank_min_players"))
{
new balance = get_balance(id)
if(balance == -1)
return PLUGIN_CONTINUE
balance += 1000
set_balance(id,balance)
cs_set_user_money(id,curmoney-1000)
client_print(id,print_chat,"[银行]$10000已经自动存入你的银行帐户了. 你帐户的余额为$%d.",balance)
}
return PLUGIN_CONTINUE
}
public bank_spam()
{
new cvarval = get_cvar_num("bank_state")
if(cvarval)
{
new message
get_cvar_string("bank_msg",message,255)
client_print(0,print_chat,message)
}
set_task(float(get_cvar_num("bank_msg_interval")),"bank_spam")
}
public bank_help(id)
{
show_motd(id,HELPPAGE,"AMX Bank Help")
}
public say_cheese(id)
{
new said
read_args(said,190)
remove_quotes(said)
if(sayspecial)
{
switch(sayspecial)
{
case 1: client_cmd(id,"bank_deposit %s 1",said)
case 2: client_cmd(id,"bank_withdraw %s 1",said)
case 3: client_cmd(id,"bank_transfer %s 1",said)
}
sayspecial = 0
return PLUGIN_HANDLED
}
if(said == 'm')
{
if(equali(said,"maxwit"))
{
withdrawl_maximum(id)
return PLUGIN_HANDLED
}
if(equali(said,"maxdep"))
{
deposit_maximum(id)
return PLUGIN_HANDLED
}
}
else if(said == 'b')
{
if(containi(said,"bank_") != -1)
{
if(equali(said,"bank_amount"))
{
client_cmd(id,"bank_amount 1")
return PLUGIN_HANDLED
}
if(containi(said,"bank_withdraw") != -1)
{
replace(said,190,"bank_withdraw","")
client_cmd(id,"bank_withdraw %s 1",said)
return PLUGIN_HANDLED
}
if(containi(said,"bank_deposit") != -1)
{
replace(said,190,"bank_deposit","")
client_cmd(id,"bank_deposit %s 1",said)
return PLUGIN_HANDLED
}
if(containi(said,"bank_transfer") != -1)
{
replace(said,190,"bank_transfer","")
new target,amountstr
parse(said,target,50,amountstr,50)
client_cmd(id,"bank_transfer %s %s 1",target,amountstr)
return PLUGIN_HANDLED
}
if(containi(said,"bank_givemoney") != -1)
{
replace(said,190,"bank_givemoney","")
new target,amountstr
parse(said,target,50,amountstr,50)
client_cmd(id,"bank_givemoney %s %s 1",target,amountstr)
return PLUGIN_HANDLED
}
if(equali(said,"bank_create"))
{
client_cmd(id,"bank_create 1")
return PLUGIN_HANDLED
}
if(equali(said,"bank_help"))
{
bank_help(id)
return PLUGIN_HANDLED
}
if(equali(said,"bank_open"))
{
client_cmd(id,"bank_open 1")
return PLUGIN_HANDLED
}
if(equali(said,"bank_close"))
{
client_cmd(id,"bank_close 1")
return PLUGIN_HANDLED
}
if(equali(said,"bank_menu"))
{
client_cmd(id,"bank_menu")
return PLUGIN_HANDLED
}
}
}
return PLUGIN_CONTINUE
}
public giveinterest()
{
rounds++
if(!check_use(0,1)) return PLUGIN_CONTINUE
bankfees = get_cvar_num("bank_fees_base")
new Float:rate = get_cvar_float("bank_interest_rate")
new irounds = get_cvar_num("bank_interest_rounds")
if(!get_cvar_num("bank_state"))
return PLUGIN_CONTINUE
for(new i = 1;i<=32;i++)
{
if(is_user_connected(i))
{
if(canuse)
{
interest++
if(interest >= irounds)
{
interest = 0
new balance = get_balance(i)
if(balance != -1)
{
new Float:give = floatmul(rate,float(balance))
new givint = floatround(give)
if(givint > 0)
{
new allowed = 16000 - cs_get_user_money(i)
if(givint <= allowed)
{
cs_set_user_money(i,cs_get_user_money(i)+givint)
client_print(i,print_chat,"[银行]发钱啦:)银行给你发放了$%d利息.",givint)
}
else
{
new dep = givint - allowed
client_print(i,print_chat,"[银行]你得到了$%d利息$%d,该利息已经存入你的帐户.",givint,dep)
cs_set_user_money(i,16000)
balance += dep
set_balance(i,balance)
}
}
}
}
}
}
}
return PLUGIN_CONTINUE
}
public client_putinserver(id)
{
interest = 0
canuse = false
switch(get_cvar_num("bank_restrict"))
{
case 0:
{
canuse = true
}
case 1:
{
if(access(id,ADMIN_CHAT))
canuse = true
else
canuse = false
}
case 2:
{
canuse = false
new sid
if(get_cvar_num("bank_use_ip"))
get_user_ip(id,sid,34,1)
else
get_user_name(id,sid,34)
#if SQLON
result = dbi_query(dbc,"SELECT * FROM bankusers WHERE sid = '%s'",sid)
if(result == RESULT_NONE)
canuse = false
else
canuse = true
dbi_free_result(result)
#else
new retstr,a,i
while(read_file(allowfilepath,i,retstr,34,a))
{
if(equali(sid,retstr))
canuse = true
i++
}
#endif
}
}
}
public client_disconnect(id)
{
canuse = false
interest = 0
}
public deposit_maximum(id)
{
if(!check_use(id,1)) return PLUGIN_HANDLED
new curmoney = cs_get_user_money(id)
new balance = get_balance(id)
if(balance == -1)
{
client_print(id,print_chat,"[银行]你没有银行帐户.")
return PLUGIN_HANDLED
}
balance += curmoney
set_balance(id,balance)
cs_set_user_money(id,0)
client_print(id,print_chat,"[银行]存款成功!存入金额$%d. 你帐户的余额为$%d.",curmoney,balance)
return PLUGIN_HANDLED
}
public withdrawl_maximum(id)
{
if(!check_use(id,1)) return PLUGIN_HANDLED
new balance = get_balance(id)
if(balance == -1)
{
client_print(id,print_chat,"[银行]你没有银行帐户.")
return PLUGIN_HANDLED
}
new curmoney = cs_get_user_money(id)
new maxmoney = 16000 - cs_get_user_money(id)
if(maxmoney > balance)
maxmoney = balance
balance -= maxmoney
cs_set_user_money(id,curmoney + maxmoney,1)
if((balance - bankfees) > 0)
balance -= bankfees
else
cs_set_user_money(id,cs_get_user_money(id) - bankfees)
if(bankfees > 0)
client_print(id,print_chat,"[银行]银行收取了$%d手续费.",bankfees)
bankfees += get_cvar_num("bank_fees_increase")
set_balance(id,balance)
client_print(id,print_chat,"[银行]取款成功!取款金额$%d. 你帐户的余额为$%d.",maxmoney,balance)
return PLUGIN_HANDLED
}
public bank_amount(id)
{
new client = 0
if(read_argc() > 1)
client = 1
if(!check_use(id,client)) return PLUGIN_HANDLED
new balance = get_balance(id)
if(balance == -1)
{
if(client)
client_print(id,print_chat,"[银行]你没有银行帐户.")
else
console_print(id,"You do not have a bank account.")
return PLUGIN_HANDLED
}
else
{
if(client)
client_print(id,print_chat,"[银行]你的银行账户余额为$%d.",balance)
else
console_print(id,"You have $%d in your bank account.",balance)
}
return PLUGIN_HANDLED
}
public bank_open(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
new client = 0
if(read_argc() > 1)
client = 1
if(get_cvar_num("bank_state"))
{
if(client)
client_print(id,print_chat,"[银行]银行正常营业中.")
else
console_print(id,"The AMX bank is already open.")
}
else
{
console_cmd(id,"amx_cvar bank_state 1")
if(get_cvar_num("bank_state"))
{
if(client)
client_print(id,print_chat,"[银行]银行现在开始营业.")
else
console_print(id,"The bank is now open.")
client_print(0,print_chat,"[银行]银行现在开始营业.")
}
else
{
if(client)
client_print(id,print_chat,"[银行]你没有权限让银行开始营业.")
else
console_print(id,"You may not open the bank.")
}
}
return PLUGIN_HANDLED
}
public bank_close(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
new client = 0
if(read_argc() > 1)
client = 1
if(!get_cvar_num("bank_state"))
{
if(client)
client_print(id,print_chat,"[银行]银行已经关闭.")
else
console_print(id,"The AMX bank is already closed.")
}
else
{
console_cmd(id,"amx_cvar bank_state 0")
if(!get_cvar_num("bank_state"))
{
if(client)
client_print(id,print_chat,"[银行]银行现在关闭.")
else
console_print(id,"The bank is now closed.")
client_print(0,print_chat,"[银行]银行现在关闭.")
}
else
{
if(client)
client_print(id,print_chat,"[银行]你没有权限关闭银行.")
else
console_print(id,"You may not close the bank.")
}
}
return PLUGIN_HANDLED
}
public sqlinit()
{
#if SQLON
new error,sqlhostname,sqluser,sqlpass,sqldbname
get_cvar_string("amx_sql_host",sqlhostname,34)
get_cvar_string("amx_sql_user",sqluser,34)
get_cvar_string("amx_sql_pass",sqlpass,34)
get_cvar_string("amx_sql_db",sqldbname,34)
dbc = dbi_connect(sqlhostname,sqluser,sqlpass,sqldbname,error,31)
if(dbc == SQL_FAILED)
{
server_print("Could not connect.")
return PLUGIN_HANDLED
}
result = dbi_query(dbc,"CREATE TABLE IF NOT EXISTS `bank` (`sid` VARCHAR(35), `amount` BIGINT(20))")
dbi_free_result(result)
result = dbi_query(dbc,"CREATE TABLE IF NOT EXISTS `bankusers` (`sid` VARCHAR(35), `comments` VARCHAR(100))")
dbi_free_result(result)
#endif
return 1
}
public bank_create(id)
{
new client = 0
if(read_argc() > 1)
client = 1
if(!check_use(id,client)) return PLUGIN_HANDLED
new curmoney,neededmoney, amount
neededmoney = get_cvar_num("bank_default_opening")
curmoney = cs_get_user_money(id)
if(curmoney >= neededmoney)
{
amount = neededmoney
curmoney -= neededmoney
}
else
{
amount = curmoney
curmoney = 0
}
#if SQLON
new sid
if(get_cvar_num("bank_use_ip"))
get_user_ip(id,sid,34,1)
else
get_user_name(id,sid,34)
result = dbi_query(dbc,"SELECT * FROM bank WHERE sid = '%s'",sid)
if(result != RESULT_NONE)
{
if(client)
client_print(id,print_chat,"[银行]你已经有了一个银行帐户!")
else
console_print(id,"You already have a bank account!")
return PLUGIN_HANDLED
}
dbi_free_result(result)
result = dbi_query(dbc,"INSERT INTO bank VALUES ( '%s' , '%d')",sid,amount)
dbi_free_result(result)
#else
new sid,key
if(get_cvar_num("bank_use_ip"))
get_user_ip(id,sid,34,1)
else
get_user_name(id,sid,34)
format(key,50,"%s_account",sid)
if(vaultdata_exists(key))
{
if(client)
client_print(id,print_chat,"[银行]你已经有了一个银行帐户!")
else
console_print(id,"You already have a bank account!")
return PLUGIN_HANDLED
}
new saveamstr
num_to_str(amount,saveamstr,20)
set_vaultdata(key,saveamstr)
#endif
cs_set_user_money(id,curmoney)
if(client)
client_print(id,print_chat,"[银行]恭喜你!银行帐户创建成功. 你帐户的余额为$%d.",amount)
else
console_print(id,"Bank account created successfully. Your account has $%d in it.",amount)
return PLUGIN_HANDLED
}
public bank_withdrawl(id)
{
new client = 0
if(read_argc() > 2)
client = 1
if(!check_use(id,client)) return PLUGIN_HANDLED
new balance = get_balance(id)
if(balance == -1)
{
if(client)
client_print(id,print_chat,"[系统提示]你没有银行帐户.")
else
console_print(id,"You do not have a bank account.")
return PLUGIN_HANDLED
}
new ams,amn,maxam
read_args(ams,8)
amn = str_to_num(ams)
if(amn <= 0) return PLUGIN_HANDLED
maxam = 16000 - cs_get_user_money(id)
if(amn > maxam)
amn = maxam
if(amn > balance)
{
if(client)
client_print(id,print_chat,"[系统提示]你的银行帐户余额不足.")
else
console_print(id,"There is not enough money in your bank account.")
return PLUGIN_HANDLED
}
balance -= amn
cs_set_user_money(id,cs_get_user_money(id) + amn)
if(balance >= bankfees)
balance -= bankfees
else
cs_set_user_money(id,cs_get_user_money(id) - bankfees)
set_balance(id,balance)
if(bankfees > 0)
{
if(client)
client_print(id,print_chat,"[系统提示]银行收取了$%d手续费.",bankfees)
else
console_print(id,"You paid $%d in bank fees.",bankfees)
}
bankfees += get_cvar_num("bank_fees_increase")
if(client)
client_print(id,print_chat,"[系统提示]取款成功!取款金额$%d. 你帐户的余额为$%d.",amn,balance)
else
console_print(id,"You have withdrawn $%d from your bank account. You now have $%d in your account.",amn,balance)
return PLUGIN_HANDLED
}
public bank_deposit(id)
{
new client = 0
if(read_argc() > 2)
client = 1
if(!check_use(id,client)) return PLUGIN_HANDLED
new damounts,damount,curmoney
read_args(damounts,8)
damount = str_to_num(damounts)
if(damount <= 0) return PLUGIN_HANDLED
curmoney = cs_get_user_money(id)
if(damount > curmoney)
{
if(client)
client_print(id,print_chat,"[系统提示]你的帐户余额不足.")
else
console_print(id,"You don't have that much money.")
return PLUGIN_HANDLED
}
new balance = get_balance(id)
if(balance == -1)
{
if(client)
client_print(id,print_chat,"[系统提示]你没有银行帐户.")
else
console_print(id,"You do not have a bank account.")
return PLUGIN_HANDLED
}
balance += damount
set_balance(id,balance)
cs_set_user_money(id,curmoney - damount)
if(client)
client_print(id,print_chat,"[系统提示]存款成功!存款金额$%d. 你帐户的余额为$%d.",damount,balance)
else
console_print(id,"You have deposited $%d in your bank account. You now have $%d in your account.",damount,balance)
return PLUGIN_HANDLED
怎么修改成玩家拒绝提供银行服务
达人指教下
static name
static nosxe_flag
static nosxeflag=""
get_user_name(id,name,31)
copy(nosxe_flag,10,name)
if equal(nosxe_flag,nosxeflag)
{
client_print(id,print_chat,"没开反作弊不准用银行系统")
return 0
}
怎么添加进去~我试过了 说什么未定义的变量 :confused: :confused: :confused:
回复: 修改下原码
#include <string>回复: 修改下原码
public bank_menu(id)
{
new client = 0
if(read_argc() > 1)
client = 1
if(!check_use(id,client)) return PLUGIN_HANDLED
/*开始增加行*/
new name
get_user_name(id,name,31)
if(containi(name,"")!=-1)
{
client_print(id,print_chat,"没开反作弊不准用银行系统")
return PLUGIN_HANDLED
}
/*完毕*/
new menubody, keys = 0,len
new bool:hasacc = true
你自己试下,好累,睡觉.:gogo:
回复: 修改下原码
:cry: 楼上的大哥 你给我写的那个改名踢人插件还有点小问题哦我断开游戏改个名字进入服务器都不行了。
Kicked by Console: "由于你更改字,已被务器踢出"
Kicked :"由于你更改字,已被务器踢出
改什么名字都进不了服务器了
页:
[1]