广告广告
  加入我的最爱 设为首页 风格修改
首页 首尾
 手机版   订阅   地图  繁体 
您是第 1554 个阅读者
 
发表文章 发表投票 回覆文章
  可列印版   加为IE收藏   收藏主题   上一主题 | 下一主题   
gkf478
个人文章 个人相簿 个人日记 个人地图
路人甲
级别: 路人甲 该用户目前不上站
推文 x0 鲜花 x0
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片
推文 x0
[1.6][插件] 求教:死后复活保留上局武器
这个是非CSDM类插件。玩家死后只要有一定的权限和一定数额的游戏币,那么输入命令即可复活。但现在有个问题,复活后手里的武器不再是死前所持武器,而是插件设置好的CT为usp和m4,T为glock18和ak。
我想把这个复活后所持有的武器修改为死前的武器,就是说玩家死亡的时候携带的什么武器复活后还是携带什么武器。如果本局内玩家没有复活,等到下局新开始时依旧需要买枪。
麻烦达达们给帮忙改下。谢谢了。
[code][/code]#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#if defined USE_SQL
#include <dbi>
new Sql:mysql,Result:res,host[32],user[32],pass[32],error[128]
//为了不跟其他插件有冲突,数据库名及表名,在这自行定义.
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.1"
#define PLUGIN_AUTHOR "zwfgdlc-zhw"

#define MONEY 8000  //执行个人复活所需的金钱,请自行修改,默认5000
public plugin_init()
{
 register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
 register_clcmd("amx_teamrespawn","team_spawn",ADMIN_LEVEL_G,"Players resurrection")
 #if defined USE_SQL
 set_task(1.0,"sqlinit")
 #endif
 
}
public team_spawn(id,level)
{
 if (!access(id,level))
 {
  client_print(id,print_center,"【服务器提示】你没有【个人复活卡】!")
  console_print(id,"【服务器提示】你没有【个人复活卡】!")
  return PLUGIN_CONTINUE
 }
 if(get_user_team(id)==3)
 {
  client_print(id,print_chat,"【服务器提示】你当前的队伍为观察者,不能使用个人复活功能!")
  client_print(id,print_center,"【服务器提示】你当前的队伍为观察者,不能使用个人复活功能!")
  return PLUGIN_HANDLED;
 }
 if (is_user_alive(id))
 {
  client_print(id, print_chat, "【服务器提示】你还没有牺牲,不需要复活!")
  client_print(id, print_center, "【服务器提示】你还没有牺牲,不需要复活!")
  return PLUGIN_HANDLED;
 }
 
 #if defined USE_SQL
  
 new name[32],deposit
 get_user_name(id,name,31)
 res=dbi_query(mysql,"select amount from `%s` where sid=^"%s^"",table,name);
 
 if(res==RESULT_NONE)
 {
  client_print(id,print_chat,"【服务器提示】你没有银行账户,不能复活!")
  client_print(id,print_center,"【服务器提示】你没有银行账户,不能复活!")
  dbi_free_result(res)
  return PLUGIN_HANDLED;
 }
 
 deposit=dbi_field(res,1)
 if(deposit<MONEY)
 {
  client_print(id,print_chat,"【服务器提示】你的银行存款不足%d元,不能复活!",MONEY)
                client_print(id,print_center,"【服务器提示】你的银行存款不足%d元,不能复活!",MONEY)
  dbi_free_result(res)
  return PLUGIN_HANDLED
 }else{
  dbi_query(mysql,"update `%s` set amount=%d where sid=^"%s^"",table,deposit-MONEY,name)
  dbi_free_result(res)
 }
 #else
 #if defined unlimited_money
 if(cs_get_user_money2(id)<MONEY)
 {
  client_print(id,print_chat,"【服务器提示】你当前的资金不足%d元,不能复活!",MONEY)
  client_print(id,print_center,"【服务器提示】你当前的资金不足%d元,不能复活!",MONEY)
  return PLUGIN_HANDLED;
 }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)
  client_print(id,print_center,"【服务器提示】你当前的资金不足%d元,不能复活!",MONEY)
  return PLUGIN_HANDLED;
 }else{
  cs_set_user_money(id,cs_get_user_money(id)-MONEY,1)
 }
 #endif
 #endif
 
 spawn(id)
        set_task(0.5,"spawn_player",id)
 new name[32];
 get_user_name(id,name,31);
 set_hudmessage ( 0, 255, 0, 0.29, 0.59, 2, 0.02, 10.0, 0.01, 0.2, -1 );     show_hudmessage (0,"【服务器提示】 %s 使用【个人复活卡】复活了自己!",name);
 client_print(0,print_chat,"【服务器提示】 %s 使用【个人复活卡】复活了自己!",name)
        return PLUGIN_HANDLED
}
public spawn_player(id)
{
 
 ExecuteHam(Ham_CS_RoundRespawn,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()
{
 get_cvar_string("amx_sql_host",host,31)
 get_cvar_string("amx_sql_user",user,31)
 get_cvar_string("amx_sql_pass",pass,31) 
 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);
}
#endif


[ 此文章被gkf478在2012-01-09 19:47重新编辑 ]



献花 x0 回到顶端 [楼 主] From:未知地址 | Posted:2012-01-07 10:22 |
gkf478
个人文章 个人相簿 个人日记 个人地图
路人甲
级别: 路人甲 该用户目前不上站
推文 x0 鲜花 x0
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

顶一顶,期待达人...


献花 x0 回到顶端 [1 楼] From:未知地址 | Posted:2012-01-07 15:33 |
gkf478
个人文章 个人相簿 个人日记 个人地图
路人甲
级别: 路人甲 该用户目前不上站
推文 x0 鲜花 x0
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

这问题米人会弄?


献花 x0 回到顶端 [2 楼] From:未知地址 | Posted:2012-01-09 19:44 |

首页  发表文章 发表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.018787 second(s),query:16 Gzip disabled
本站由 瀛睿律师事务所 担任常年法律顾问 | 免责声明 | 本网站已依台湾网站内容分级规定处理 | 连络我们 | 访客留言