搜索
查看: 2015|回复: 5

哪位大哥帮帮我,小弟先谢过了

[复制链接]
发表于 2007-11-9 22:21:55 | 显示全部楼层 |阅读模式 来自 中国–浙江–湖州
哪位大哥能把一马当先奋勇杀敌随机奖励金钱的代码改成:第一个杀人奖励金钱;第二个杀人奖励金钱,第三个杀人奖励金钱的代码
/* Rewarding
ver 0.1 By Zhao on 2004.12.4
*/
#include <amxmodx>
#include <cstrike>
#include <csstats>
#include <unlimited_money>
#define BIG_MONEY_INDEX 16
new playerkilled[33]
new rewards[20]=
{50,100,300,500,1000,3000,5000,8000,10000,15000,20000,25000,40000,50000,80000,100000,150000,
200000,500000,900000}
new g_firstblood,Round_Control
new g_random,g_roundcount
new rewardedbig,g_iRoundEndTriggered
public client_connect(id){
playerkilled[id]=0;
}
public ramdon_money(params[]){
new killer=params[0]
new oldamount=params[1]
new amount
new killername[32]
new random_range,randomvalue
random_range=(rewardedbig)?BIG_MONEY_INDEX:20//控制大额的奖励不会出现太多次
for(;;){
  randomvalue=random(random_range)
  amount=rewards[randomvalue]
  if (amount!=oldamount) break;
}
get_user_name(killer,killername,31)
if (g_random>0){
  g_random--
  set_hudmessage(0,255,0,0.05,0.25,0, 0.02, 0.4, 0.01, 0.1, 2)
  show_hudmessage(0,"%s一马当先,奋勇杀敌,奖励%6d金钱",killername,amount)
  new param[2]
  param[0]=killer
  param[1]=amount
  set_task(0.3,"ramdon_money",0,param,1)
}else{
  if(randomvalue>=BIG_MONEY_INDEX) rewardedbig=1
  //set_hudmessage(0,255,0,0.75,0.18,0, 1.0, 5.0, 0.1, 0.2, 1)
  set_hudmessage(0,255,0,0.05, 0.25, 0, 0.02, 6.0, 0.01, 0.1, 2)
  show_hudmessage(0,"%s一马当先,奋勇杀敌,奖励%6d金钱",killername,amount)
  cs_set_user_money2(killer, cs_get_user_money2(killer)+amount)
  new msg[512]
  format(msg,511,"^x03%s^x01 一马当先,奋勇杀敌,奖励^x04 %d ^x01金
钱",killername,amount)
  client_color(0,killer,msg)
}
}
//public client_death(killer,victim,wpnindex,hitplace,TK){
public eDeathMsg(){
new killer,victim,TK
killer=read_data(1)
if(!killer) return PLUGIN_CONTINUE
victim=read_data(2)
TK=(get_user_team(killer)==get_user_team(victim))?1:0
//headshot=read_data(3)
new wpnname[4]
read_data(4,wpnname,3)
new killername[32]
//if (wpnindex==CSW_C4||TK) return PLUGIN_CONTINUE
if(equal(wpnname,"c4")||TK) return PLUGIN_CONTINUE
// new headshot = ( hitplace==HIT_HEAD ) ? 1:0
new selfkill = ( killer==victim ) ? 1:0
if (selfkill) return PLUGIN_CONTINUE
playerkilled[killer]++
if(equal(wpnname,"kni")){
  cs_set_user_money2(killer, cs_get_user_money2(killer)+10000)
  get_user_name(killer,killername,31)
  set_hudmessage(0,255,0,0.05,0.25,0, 0.2, 6.0, 0.1, 0.1, 2)
  //set_hudmessage(0,255,0,0.75,0.18,0, 1.0, 1.0, 0.1, 0.2, 12)
  show_hudmessage(0,"%s使用匕首杀敌,奖励10000金钱",killername)
  new msg[100]
  format(msg,99,"^x03%s^x01使用匕首杀敌,奖励^x04 10000 ^x01 金钱",killername)
  client_color(0,killer,msg)
  //log_message("%s使用匕首杀敌,奖励10000金钱",killername)
}
if (g_firstblood){
  g_firstblood=0
  g_random=6
  new param[2]
  param[0]=killer
  param[1]=0;
  ramdon_money(param)
}
return PLUGIN_CONTINUE
}
发表于 2007-11-9 22:45:02 | 显示全部楼层 来自 中国–广东–佛山–禅城区

回复: 哪位大哥帮帮我,小弟先谢过了

注释掉第一个杀人代码部份
  1. /* Rewarding
  2. ver 0.1 By Zhao on 2004.12.4
  3. */
  4. #include <amxmodx>
  5. #include <cstrike>
  6. #include <csstats>
  7. #include <unlimited_money>
  8. #define BIG_MONEY_INDEX 16
  9. new playerkilled[33]
  10. new g_firstblood,Round_Control
  11. new g_roundcount
  12. new g_iRoundEndTriggered
  13. public client_connect(id){
  14. playerkilled[id]=0;
  15. }
  16. public eDeathMsg(){
  17. new killer,victim,TK
  18. killer=read_data(1)
  19. if(!killer) return PLUGIN_CONTINUE
  20. victim=read_data(2)
  21. TK=(get_user_team(killer)==get_user_team(victim))?1:0
  22. //headshot=read_data(3)
  23. new wpnname[4]
  24. read_data(4,wpnname,3)
  25. new killername[32]
  26. //if (wpnindex==CSW_C4||TK) return PLUGIN_CONTINUE
  27. if(equal(wpnname,"c4")||TK) return PLUGIN_CONTINUE
  28. // new headshot = ( hitplace==HIT_HEAD ) ? 1:0
  29. new selfkill = ( killer==victim ) ? 1:0
  30. if (selfkill) return PLUGIN_CONTINUE
  31. playerkilled[killer]++
  32. if(equal(wpnname,"kni")){
  33.   cs_set_user_money2(killer, cs_get_user_money2(killer)+7700)
  34.   get_user_name(killer,killername,31)
  35.   //set_hudmessage(0,255,0,0.05,0.25,0, 0.2, 6.0, 0.1, 0.1, 2)
  36.   //set_hudmessage(0,255,0,0.75,0.18,0, 1.0, 1.0, 0.1, 0.2, 12)
  37.   //show_hudmessage(0,"%s使用匕首杀敌,奖励10000金钱",killername)
  38.   new msg[100]
  39.   format(msg,99,"^x03%s^x01使用匕首杀敌,奖励^x04 8000 ^x01 金钱",killername)
  40.   client_color(0,killer,msg)
  41.   //log_message("%s使用匕首杀敌,奖励10000金钱",killername)
  42. }
  43. if (g_firstblood){
  44.   g_firstblood=0
  45.   //g_random=6
  46.   new param[2]
  47.   param[0]=killer
  48.   param[1]=0;
  49.   //ramdon_money(param)
  50. }
  51. return PLUGIN_CONTINUE
  52. }
  53. public client_color(playerid,colorid,msg[]){
  54. message_begin(playerid?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0,0,0}, playerid)
  55. write_byte(colorid)
  56. write_string(msg)
  57. message_end()
  58. }
复制代码
然后使用前五名杀人奖励插件即可
http://www.dt-club.net/forum/thread/90/36723.htm
回复

使用道具 举报

 楼主| 发表于 2007-11-9 23:32:19 | 显示全部楼层 来自 中国–浙江–湖州

回复: 哪位大哥帮帮我,小弟先谢过了

ceoguang大哥具体加在什么位置
/* Rewarding
ver 0.1 By Zhao on 2004.12.4
*/
#include <amxmodx>
#include <cstrike>
#include <csstats>
#include <unlimited_money>
#define BIG_MONEY_INDEX 16
new playerkilled[33]
new rewards[20]={50,100,300,500,1000,3000,5000,8000,10000,15000,20000,25000,40000,50000,80000,100000,150000,200000,500000,900000}
new g_firstblood,Round_Control
new g_random,g_roundcount
new rewardedbig,g_iRoundEndTriggered
public client_connect(id){
playerkilled[id]=0;
}
public ramdon_money(params[]){
new killer=params[0]
new oldamount=params[1]
new amount
new killername[32]
new random_range,randomvalue
random_range=(rewardedbig)?BIG_MONEY_INDEX:20//控制大额的奖励不会出现太多次
for(;;){
  randomvalue=random(random_range)
  amount=rewards[randomvalue]
  if (amount!=oldamount) break;
}
get_user_name(killer,killername,31)
if (g_random>0){
  g_random--
  set_hudmessage(0,255,0,0.05,0.25,0, 0.02, 0.4, 0.01, 0.1, 2)
  show_hudmessage(0,"%s一马当先,奋勇杀敌,奖励%6d金钱",killername,amount)
  new param[2]
  param[0]=killer
  param[1]=amount
  set_task(0.3,"ramdon_money",0,param,1)
}else{
  if(randomvalue>=BIG_MONEY_INDEX) rewardedbig=1
  //set_hudmessage(0,255,0,0.75,0.18,0, 1.0, 5.0, 0.1, 0.2, 1)
  set_hudmessage(0,255,0,0.05, 0.25, 0, 0.02, 6.0, 0.01, 0.1, 2)
  show_hudmessage(0,"%s一马当先,奋勇杀敌,奖励%6d金钱",killername,amount)
  cs_set_user_money2(killer, cs_get_user_money2(killer)+amount)
  new msg[512]
  format(msg,511,"^x03%s^x01 一马当先,奋勇杀敌,奖励^x04 %d ^x01金钱",killername,amount)
  client_color(0,killer,msg)
}
}
//public client_death(killer,victim,wpnindex,hitplace,TK){
public eDeathMsg(){
new killer,victim,TK
killer=read_data(1)
if(!killer) return PLUGIN_CONTINUE
victim=read_data(2)
TK=(get_user_team(killer)==get_user_team(victim))?1:0
//headshot=read_data(3)
new wpnname[4]
read_data(4,wpnname,3)
new killername[32]
//if (wpnindex==CSW_C4||TK) return PLUGIN_CONTINUE
if(equal(wpnname,"c4")||TK) return PLUGIN_CONTINUE
// new headshot = ( hitplace==HIT_HEAD ) ? 1:0
new selfkill = ( killer==victim ) ? 1:0
if (selfkill) return PLUGIN_CONTINUE
playerkilled[killer]++
if(equal(wpnname,"kni")){
  cs_set_user_money2(killer, cs_get_user_money2(killer)+10000)
  get_user_name(killer,killername,31)
  set_hudmessage(0,255,0,0.05,0.25,0, 0.2, 6.0, 0.1, 0.1, 2)
  //set_hudmessage(0,255,0,0.75,0.18,0, 1.0, 1.0, 0.1, 0.2, 12)
  show_hudmessage(0,"%s使用匕首杀敌,奖励10000金钱",killername)
  new msg[100]
  format(msg,99,"^x03%s^x01使用匕首杀敌,奖励^x04 10000 ^x01 金钱",killername)
  client_color(0,killer,msg)
  //log_message("%s使用匕首杀敌,奖励10000金钱",killername)
}
if (g_firstblood){
  g_firstblood=0
  g_random=6
  new param[2]
  param[0]=killer
  param[1]=0;
  ramdon_money(param)
}
return PLUGIN_CONTINUE
}
public client_color(playerid,colorid,msg[]){
message_begin(playerid?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0,0,0}, playerid)
write_byte(colorid)
write_string(msg)
message_end()
}
public new_round(){
new i
if (!Round_Control){
  g_roundcount++
  Round_Control = 1
  g_firstblood=1
  g_iRoundEndTriggered=0
  for(i=0;i<=32;i++)playerkilled=0;
}
}
public eEndRound(){
if (g_iRoundEndTriggered) return PLUGIN_CONTINUE
g_iRoundEndTriggered=1
Round_Control=0
new i,maxkillcount
maxkillcount=0
new RoundEndMsg[513],ipos
new playerslist[32],playerscount
ipos=0
ipos+=format(RoundEndMsg[ipos],512-ipos,"本局最佳杀手")

get_players(playerslist,playerscount)//Get  Players
for(i=0;i<playerscount;i++){
  if(playerkilled[playerslist]&&playerkilled[playerslist]>maxkillcount) maxkillcount=playerkilled[playerslist]
}
if(maxkillcount){
  new playername[33],playeradded=0
  ipos+=format(RoundEndMsg[ipos],512-ipos,"  (杀%d人)^n __________________________^n",maxkillcount)
  for(i=0;i<playerscount;i++){
   if(playerkilled[playerslist]==maxkillcount){//WeiGet this players
    get_user_name(playerslist,playername,32)
    ipos+=format(RoundEndMsg[ipos],512-ipos,"%s^n",playername)
    ++playeradded
    if(playeradded>=2){
     ipos+=format(RoundEndMsg[ipos],512-ipos,"......^n")
     break;
    }
   }
  }
}else{
  ipos+=format(RoundEndMsg[ipos],512-ipos,"^n__________________________^n大家太客气了,都没有杀敌^n")
}
set_hudmessage( 49,179,113, -1.0, 0.55, 2, 0.02, 5.0, 0.01, 0.01, 3 )
show_hudmessage(0,RoundEndMsg)
return PLUGIN_CONTINUE
}
public eRestart()
{
g_roundcount = 0
g_firstblood = 0
Round_Control = 0
rewardedbig = 0
}
public plugin_init(){
register_plugin("First Killer Reward","0.1","Zhao")
register_event("RoundTime", "new_round", "bc")  
register_event("DeathMsg","eDeathMsg","a")
register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
register_event("TextMsg","eRestart","a","2&#Game_C","2&#Game_w")
g_firstblood=1
rewardedbig = 0
g_roundcount=0
}
/* UTF-8 func by www.DT-Club.net */
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset134 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2052\\ f0\\ fs16 \n\\ par }
*/
回复

使用道具 举报

发表于 2007-11-10 04:44:29 | 显示全部楼层 来自 中国–广东–佛山–禅城区

回复: 哪位大哥帮帮我,小弟先谢过了

  1. message_end()
  2. }
复制代码
回复

使用道具 举报

 楼主| 发表于 2007-11-10 10:23:16 | 显示全部楼层 来自 中国–浙江–湖州

回复: 哪位大哥帮帮我,小弟先谢过了

有源码帮我合并一下谢谢大哥了

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
回复

使用道具 举报

发表于 2007-11-10 15:25:55 | 显示全部楼层 来自 中国–广东–佛山–禅城区

回复: 哪位大哥帮帮我,小弟先谢过了

只是注释掉第一个杀人部份.
前五名杀人部份没加进去.
不过两个配合起来使用就可以了.
前五名杀人奖励
http://www.dt-club.net/forum/thread/90/36723.htm

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
回复

使用道具 举报

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

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