搜索
查看: 2622|回复: 1

中文名字怎么才能用SQL版银行插件???

[复制链接]
发表于 2008-7-9 17:26:55 | 显示全部楼层 |阅读模式 来自 中国–广东–深圳–宝安区
装了sql版本的银行插件,用英文名字是可以用的,改成中文名字就用不了啦````菜单出不来!!
 楼主| 发表于 2008-7-9 17:30:31 | 显示全部楼层 来自 中国–广东–深圳–宝安区

回复: 中文名字怎么才能用SQL版银行插件???

#define SQLON 0 // 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[33] = false
new interest[33] = 0
new bankfees = 0
new rounds = 0
new sayspecial[33] = 0
#if SQLON
#include <dbi>
#else
#include <vault>
#endif
#if SQLON
new Sql:dbc
new Result:result
#else
new allowfilepath[251]
#endif
public plugin_init()
{
register_plugin("AMX Bank","1.7","作者twistedeuphoria汉化R0C修改caihanzi")
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_transfer","bank_transfer",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","1000")
register_cvar("bank_state","1")
register_cvar("bank_min_players","2")
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.01")
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调用银行菜单.")
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[201]
  get_configsdir(directory,200)
  if(get_cvar_num("bank_restrict") == 2)
  {
   format(allowfilepath,250,"%s/bankusers.ini",directory)
   if(!file_exists(allowfilepath))
   {
    new writestr[101]
    format(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[id] == 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[35]
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[51]
  format(key,50,"%s_account",sid)
  if(vaultdata_exists(key))
  {
   new balancestr[21]
   get_vaultdata(key,balancestr,20)
   balance = str_to_num(balancestr)
  }
#endif
return balance
}
public set_balance(id,balance)
{
new sid[35]
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[51]
  format(key,50,"%s_account",sid)
  if(vaultdata_exists(key))
  {
   new balancestr[21]
   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[276], 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[len],275-len,"1. Open a Bank Account^n\d")
  keys |= (1<<0|1<<9)  
}
else
  len += format(menubody[len],275-len,"\d1. 创建银行账户^n\w")
len += format(menubody[len],275-len,"2. 查询账户余额^n3. 存款^n4. 全部存入银行^n5. 取款^n6. 取款至16000^n7. 帮助^n8. 转帐^n^n")
if(hasacc)
{
  len += format(menubody[len],275-len,"0. 退出")
  keys |= (1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<9)
}
else
  len += format(menubody[len],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[id] = 1
   client_print(id,print_chat,"按Y输入你的存款金额.")
  }   
  case 3: client_cmd(id,"maxdep")
  case 4:
  {
   sayspecial[id] = 2
   client_print(id,print_chat,"按Y输入你的取款金额.")
  }
  case 5: client_cmd(id,"maxwit")
  case 6: client_cmd(id,"bank_help")
  case 7:
  {
   sayspecial[id] = 3
   client_print(id,print_chat,"按Y输入收款人和转帐金额.")
  }
}
return PLUGIN_HANDLED
}
public bank_givemoney(id,level,cid)
{
if(!cmd_access(id,level,cid,3))
  return PLUGIN_HANDLED
new target[32], tid
read_argv(1,target,31)
tid = cmd_target(id,target,2)
if(!tid)
  return PLUGIN_HANDLED
new amountstr[10], 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[32], tname[32]
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_transfer(id)
{
new client = 0
if(read_argc() > 3)
  client = 1
if(!check_use(id,client)) return PLUGIN_HANDLED
new target[32]
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[9],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[32], tname[32]
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[id] == 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 += 10000
  set_balance(id,balance)
  cs_set_user_money(id,curmoney-10000)
  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[256]
  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[191]
read_args(said,190)
remove_quotes(said)
if(sayspecial[id])
{
  switch(sayspecial[id])
  {
   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[id] = 0
  return PLUGIN_HANDLED
}   
if(said[0] == 'm')
{
  if(equali(said,"maxwit"))
  {
   withdrawl_maximum(id)
   return PLUGIN_HANDLED
  }
  if(equali(said,"maxdep"))
  {
   deposit_maximum(id)
   return PLUGIN_HANDLED
  }
}
else if(said[0] == '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[51],amountstr[51]
    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[51],amountstr[51]
    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[id] = 0
canuse[id] = false
switch(get_cvar_num("bank_restrict"))
{
  case 0:
  {
   canuse[id] = true
  }
  case 1:
  {
   if(access(id,ADMIN_CHAT))
    canuse[id] = true
   else
    canuse[id] = false
  }
  case 2:
  {
   canuse[id] = false
   new sid[35]
   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[id] = false
    else
     canuse[id] = true
    dbi_free_result(result)
   #else
    new retstr[35],a,i
    while(read_file(allowfilepath,i,retstr,34,a))
    {
     if(equali(sid,retstr))
      canuse[id] = true
     i++
    }
   #endif
  }
}
}
public client_disconnect(id)
{
canuse[id] = false
interest[id] = 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[32],sqlhostname[35],sqluser[35],sqlpass[35],sqldbname[35]
  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[35]
  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[35],key[51]
  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[21]
  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[9],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[9],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
}



我把代码发上来~~~~~
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表