|
发表于 2008-4-10 16:43:25
|
显示全部楼层
来自 中国–广东–广州–天河区
回复: 发布 团队复活/个人复活 插件
代码是这样的,有错误没?
-------------------------------------------------------------------------------------------
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#if defined USE_SQL
#include <dbi>
new Sql:mysql,Result:res,host[32],user[32],pass[32],error[128]
new bool:bank_account[33]
//为了不跟其他插件有冲突,数据库名及表名,在这自行定义.
new table[]="bank" //银行插件的数据表名,根据实际情况更改
new db[]="amx" //银行插件的数据表所在的库名,根据实际情况更改
#else
#if defined unlimited_money
#include <unlimited_money>
#endif
#endif
#define PLUGIN_NAME "Team Respawn"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "zwfgdlc"
#define MONEY 96000 //执行团队复活所需的金钱,请自行修改,默认5000
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_clcmd("amx_teamspawn","team_spawn")
#if defined USE_SQL
get_cvar_string("amx_sql_host",host,31)
get_cvar_string("amx_sql_user",user,31)
get_cvar_string("amx_sql_pass",pass,31)
sqlinit()
#endif
}
public team_spawn(id)
{
if(get_user_team(id)==3)
{
client_print(id,print_chat,"你当前的队伍为观察者,不能执行些命令")
return PLUGIN_CONTINUE;
}
#if defined USE_SQL
if(!bank_account[id])
{
client_print(id,print_chat,"你没有银行帐户,不能使用团队复活")
return PLUGIN_CONTINUE;
}
new name[32],deposit
get_user_name(id,name,31)
res=dbi_query(mysql,"select amount from `%s` where sid=^"%s^"",table,name);
deposit=dbi_field(res,1)
dbi_free_result(res)
if(deposit<MONEY)
{
client_print(id,print_chat,"你的银行存款不足%d,不能使用团队复活",MONEY)
return PLUGIN_CONTINUE
}else{
dbi_query(mysql,"update `%s` set amount=%d where sid=^"%s^"",table,deposit-MONEY,name)
}
#else
#if defined unlimited_money
if(cs_get_user_money2(id)<MONEY)
{
client_print(id,print_chat,"你当前的金钱不足%d,不能执行团队复活命令",MONEY)
return PLUGIN_CONTINUE;
}else{
cs_set_user_money2(id,cs_get_user_money2(id)-MONEY,1)
}
#else
if(cs_get_user_money(id)<MONEY)
{
client_print(id,print_chat,"你当前的金钱不足%d,不能执行团队复活命令",MONEY)
return PLUGIN_CONTINUE;
}else{
cs_set_user_money(id,cs_get_user_money(id)-MONEY,1)
}
#endif
#endif
new players[32],num;
get_players(players,num,"be",get_user_team(id)==2?"CT":"TERRORIST")
for(new i=0;i<num;i++)
{
spawn(players)
set_task(0.5,"spawn_player",players)
}
return PLUGIN_HANDLED
}
public spawn_player(id)
{
spawn(id)
give_item(id,"weapon_knife")
switch(get_user_team(id))
{
case 1:
{
give_item(id,"weapon_glock18")
give_item(id,"weapon_ak47")
cs_set_user_armor(id,100,CS_ARMOR_VESTHELM)
cs_set_user_bpammo(id,CSW_AK47,90)
}
case 2 :
{
give_item(id,"weapon_usp")
cs_set_user_armor(id,100,CS_ARMOR_VESTHELM)
give_item(id,"weapon_m4a1")
cs_set_user_bpammo(id,CSW_M4A1,90)
}
}
}
#if defined USE_SQL
public sqlinit()
{
mysql=dbi_connect(host,user,pass,db,error,127)
if(mysql==SQL_FAILED)
{
server_print("^xCA^xFD^xBE^xDD^xBF^xE2^xC1^xAC^xBD^xD3^xCA^xA7^xB0^xDC^x2C^xC7^xEB^xBC^xEC^xB2^xE9^xC9^xE8^xD6^xC3^xB2^xCE^xCA^xFD^xBB^xF2^xBC^xEC^xB2^xE9^xCD^xF8^xC2^xE7^xC1^xAC^xBD^xD3")
pause("ad")
}
}
public plugin_end()
{
if(mysql==SQL_OK)
dbi_close(mysql);
}
public client_putinserver(id)
{
new name[32]
get_user_name(id,name,31)
res=dbi_query(mysql,"select count(*) from `%s` where sid=^"%s^"",table,name)
if(res==RESULT_OK)
bank_account[id]=true;
else
bank_account[id]=false;
dbi_free_result(res);
}
#endif
----------------------------------------------------------------------------------
我银行是有1000W的,可是复活的时候显示这个
-------------------
文字显示不出,只显示出了数字 需要 96000 元。 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|