廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 1183 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為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.078709 second(s),query:16 Gzip disabled
本站由 瀛睿律師事務所 擔任常年法律顧問 | 免責聲明 | 本網站已依台灣網站內容分級規定處理 | 連絡我們 | 訪客留言