广告广告
  加入我的最爱 设为首页 风格修改
首页 首尾
 手机版   订阅   地图  繁体 
您是第 1196 个阅读者
 
发表文章 发表投票 回覆文章
  可列印版   加为IE收藏   收藏主题   上一主题 | 下一主题   
99wudi
个人文章 个人相簿 个人日记 个人地图
小人物
级别: 小人物 该用户目前不上站
推文 x3 鲜花 x12
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片
推文 x0
[1.6][插件] 关于掉钱留到下局的问题,急求助
各位高手,请问掉的钱留到下局的源码怎么写??
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "Players Drop Money"
#define AUTHOR "Sh!nE*"
#define VERSION "1.7"

#if cellbits == 32
#define OFFSET_CSMONEY  115
#else
#define OFFSET_CSMONEY  140
#endif

#define OFFSET_LINUX      5
#define MAXENTS 1500
new moneybox[MAXENTS]
new model[] = "models/p_knife.mdl"
new method, ison, m_amount, ran_money, random_nums, money_drop, money_drop_a, fadeon, divide, force
//new method6
new g_msgScreenFade
new bool:can_pickup[33]

public plugin_init()
{
 register_plugin(PLUGIN, VERSION, AUTHOR)
 
 ison = register_cvar("amx_dropmoney","1")
 method = register_cvar("amx_dropmethod","2")
 divide = register_cvar("amx_moneydivide","2")
 m_amount = register_cvar("amx_dropamount","300")
 ran_money = register_cvar("amx_droprandom","300 500 700")
 random_nums = register_cvar("amx_droprandomnums","300 9000000")
 money_drop = register_cvar("amx_playerdrop","1")
 money_drop_a = register_cvar("amx_playerdropamount","1000")
 fadeon = register_cvar("amx_moneyfade","1")
 force = register_cvar("amx_dropforce","10")
 g_msgScreenFade = get_user_msgid("ScreenFade")
 
 register_clcmd("drop","hook_drop")
 
 register_event("DeathMsg", "deatha", "a")
 register_forward(FM_Touch,"player_Touch")
 register_logevent("round_start", 2, "1=Round_Start")
}

public client_connect(id) can_pickup[id]=true
public client_disconnect(id) can_pickup[id]=false

public plugin_precache() {
 precache_model(model)
}

public hook_drop(id) {
 if(!get_pcvar_num(ison) || !get_pcvar_num(money_drop)) return PLUGIN_CONTINUE
 new weapon,clip,ammo,money,Float:velo[3]
 weapon = get_user_weapon(id,clip,ammo)
 if(weapon == CSW_KNIFE) {
  if(cs_get_user_money2(id) < get_pcvar_num(money_drop_a))
   money = cs_get_user_money2(id)
  else
   money = get_pcvar_num(money_drop_a)
  
  cs_set_user_money2(id,cs_get_user_money2(id) - money)
  can_pickup[id] = false
  set_task(0.3,"reset_pick",id)
  new start_velo = get_pcvar_num(force) * 15
  new end_velo = get_pcvar_num(force) * 50
  velocity_by_aim(id,random_num(start_velo,end_velo),velo)
  make_money(id,money,velo)
  return PLUGIN_HANDLED
 }
 return PLUGIN_CONTINUE
}

public reset_pick(id) can_pickup[id] = true
public deatha() {
 if(!get_pcvar_num(ison)) return PLUGIN_CONTINUE
 
 new money, Float:velo[3]
 new victim = read_data(2)
 new killer = read_data(1)
 
 if(killer && killer != victim)
  cs_set_user_money2(killer,cs_get_user_money2(killer) - 300)
 
 switch(get_pcvar_num(method)) {
  case 1:{
   money = get_pcvar_num(m_amount)
   if(cs_get_user_money2(victim) < money) {
    money = cs_get_user_money2(victim)
    cs_set_user_money2(victim,0)
   }
   else cs_set_user_money2(victim,cs_get_user_money2(victim) - get_pcvar_num(m_amount))
   }
  case 2:{
   new tempmoney = cs_get_user_money2(victim)
   if(money != 1) {
    money = (tempmoney / get_pcvar_num(divide))
    cs_set_user_money2(victim,cs_get_user_money2(victim) - money)
   }
   else {
    cs_set_user_money2(victim,0)
    money = 1
   }
  }
  case 3:{
   new maxmoney = cs_get_user_money2(victim)
   money = random_num(1,maxmoney)
   cs_set_user_money2(victim,cs_get_user_money2(victim) - money)
  }
  case 4:{
   new tempmoney2[32]
   get_pcvar_string(ran_money,tempmoney2,31)
   new tempmoney[3][6]
   parse(tempmoney2, tempmoney[0], sizeof tempmoney[] - 1,tempmoney[1], sizeof tempmoney[] - 1,tempmoney[2], sizeof tempmoney[] - 1)
   new num = random_num(1,3)
   switch(num) {
    case 1:{
     money = str_to_num(tempmoney[0])
    }
    case 2:{
     money = str_to_num(tempmoney[1])
    }
    case 3:{
     money = str_to_num(tempmoney[2])
    }
   }
   if(cs_get_user_money2(victim) < money) {
    cs_set_user_money2(victim,0)
    money = cs_get_user_money2(victim)
   }
   else cs_set_user_money2(victim,cs_get_user_money2(victim) - money)
   }
  case 5:{
   new tempmoney22[32], num_from, num_to
   get_pcvar_string(random_nums,tempmoney22,31)
   new tempmoney1[2][6]
   parse(tempmoney22, tempmoney1[0], sizeof tempmoney1[] - 1,tempmoney1[1], sizeof tempmoney1[] - 1)
   num_from = str_to_num(tempmoney1[0])
   num_to = str_to_num(tempmoney1[1])
   if(num_from < 0) num_to = 0
   money = random_num(num_from,num_to)
   
   if(cs_get_user_money2(victim) < money) {
    cs_set_user_money2(victim,0)
    money = cs_get_user_money2(victim)
   }
   else cs_set_user_money2(victim,cs_get_user_money2(victim) - money)
   }
 }
 make_money(victim,money,velo)
 return PLUGIN_CONTINUE
}

public round_start() {
 new money_ent
 while((money_ent=engfunc(EngFunc_FindEntityByString,money_ent,"classname","pdm_money")) != 0){
  engfunc(EngFunc_RemoveEntity,money_ent)
 }
}


public make_money(id,money,Float:velo[]) {
 new moneybags = money/1000
 new moneyleft = money
 new Float:origin[3]
 new Float:angles[3]
 new Float:mins[3] = {-2.79, -0.0, -6.14}
 new Float:maxs[3] = {2.42, 1.99, 6.35}
 
 if((moneybags * 1000) < money) moneybags++
 
 for(new i = 0; i < moneybags; ++i) {
  new newent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"))
  if(!is_user_alive(id)) {
   velo[0] = random_float(1.0,150.0)
   velo[1] = random_float(1.0,150.0)
   velo[2] = random_float(1.0,150.0)
  }
  else
   velo[2] += 100
  
  pev(newent,pev_angles,angles)
  angles[1] += random_num(1,360)
  pev(id,pev_origin,origin)
  set_pev(newent, pev_origin, origin)
  set_pev(newent, pev_classname, "pdm_money")
  engfunc(EngFunc_SetModel, newent, model)
  engfunc(EngFunc_SetSize,newent,mins,maxs)
  set_pev(newent,pev_angles,angles)
  set_pev(newent, pev_solid, SOLID_TRIGGER)
  set_pev(newent,pev_movetype,MOVETYPE_TOSS)
  set_pev(newent, pev_velocity,velo)
  engfunc(EngFunc_DropToFloor,newent)
  
  if(moneyleft == 0) return FMRES_IGNORED
  
  if(moneyleft < 1000) {
   moneybox[newent]=moneyleft
   moneyleft = 0
   return FMRES_IGNORED
  }
  moneyleft -= 1000
  moneybox[newent]=1000
 }
 return FMRES_IGNORED
}

public player_Touch(touched, toucher) {
 
 if (!pev_valid(touched) || !is_user_alive(toucher) ||  !get_pcvar_num(ison) || !can_pickup[toucher])
  return FMRES_IGNORED
 
 new classname[32]
 pev(touched, pev_classname, classname, sizeof classname - 1)
 
 if (equali(classname, "pdm_money")) {
  if(cs_get_user_money2(toucher) == 16000) return FMRES_IGNORED
  else cs_set_user_money2(toucher,cs_get_user_money2(toucher) + moneybox[touched])
  
  if(pev_valid(touched))
   engfunc(EngFunc_RemoveEntity,touched)
  
  if(get_pcvar_num(fadeon))
   screen_fade(toucher)
 }
 
 return FMRES_IGNORED
}


public screen_fade(id) {
 message_begin(MSG_ONE, g_msgScreenFade, {0,0,0}, id)
 write_short(1<<12)
 write_short(1<<12)
 write_short(1<<12)
 write_byte(0)
 write_byte(200)
 write_byte(0)
 write_byte(20)
 message_end()
}

万分感激===================



献花 x0 回到顶端 [楼 主] From:未知地址 | Posted:2011-01-28 13:41 |
a7811311622 手机
个人头像
个人文章 个人相簿 个人日记 个人地图
特殊贡献奖 优秀管理员勋章 社区建设奖
头衔:我…在工作了…我…在工作了…
版主
级别: 版主 该用户目前不上站
版区: CS提问区
推文 x771 鲜花 x2152
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

要贴原码时请善用[code]语法… 表情
而且想让钱留到下局只要将「register_logevent("round_start", 2, "1=Round_Start")」这句拿掉就好…


尚无签名,欢迎 [新增个性化签名]
献花 x0 回到顶端 [1 楼] From:台湾中华电信 | Posted:2011-01-28 16:39 |
99wudi
个人文章 个人相簿 个人日记 个人地图
小人物
级别: 小人物 该用户目前不上站
推文 x3 鲜花 x12
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

非常感谢!!!!!祝你春节快乐,合家平安!!!


献花 x0 回到顶端 [2 楼] From:未知地址 | Posted:2011-01-28 17:32 |

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