搜索
查看: 5432|回复: 15

捡钱的声效怎么添加?

[复制链接]
发表于 2007-9-19 20:18:46 | 显示全部楼层 |阅读模式 来自 中国–浙江–湖州
捡钱的声效怎么添加?我用的是   giveoutmoney.amxx        ;掉钱与捡钱插件
请高手教教我,万分感激!!!
发表于 2007-9-20 03:43:04 | 显示全部楼层 来自 中国–广东–佛山–禅城区

回复: 捡钱的声效怎么添加?

修改两处
  1.   add_player_money(id, -money)
  2.   [color=red]client_cmd(0,"spk misc/dropmoney") //增加行[/color]
  3.   new msg[256], name[32]
  4.   get_user_name(id, name, 31)
  5.   format(msg, 255, "^x03%s^x01 发了 ^x04%d^x01 金钱", name, money)
  6.   client_color(0, id, msg
复制代码
  1.   new oldmoney = total_money[ptd]
  2.   add_player_money(ptd, money)
  3.   [color=red]client_cmd(ptd,"spk misc/getmoney") //增加行[/color]
  4.   new usergetmoney = total_money[ptd] - oldmoney
  5.   if(usergetmoney>99){  //玩家可以捡的钱数太少就不提示了
复制代码
  1. [color=#000000]public plugin_precache()
  2. {
  3. precache_model(g_MoneyModel[0])
  4. precache_model(g_MoneyModel[1])
  5. precache_model(g_MoneyModel[2])
  6. [color=red] precache_sound( "misc/dropmoney.wav")
  7. precache_sound( "misc/getmoney.wav")[/color]
  8. }[/color]
复制代码
红色部份是加进去的代码.
请自行对比.
回复

使用道具 举报

发表于 2007-9-20 03:47:05 | 显示全部楼层 来自 中国–广东–佛山–禅城区

回复: 捡钱的声效怎么添加?

掉钱的声音我只能修改到让所有人听到,如果要改成同一队伍的才可以听到还是亲自请教Rulzy老大吧.
回复

使用道具 举报

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

我有源文件谁帮我编译成amxx

/*
参数及命令介绍:
amx_maxmoney <300000>
    设置可以达到的最大金钱数, n≥16000(如果小于,自动设为16000),默认 300000
    最好不要超过999999,因为如果为7位数,则最后一位数根本就看不到
    注意:其个位数不能为1或6,如果是1或6,会自动减1(是为了保证插件正常工作)
amx_startmoney <n>
    开始金钱数,≥800(如果小于,自动设为800),且个位数不能为1或6,如果是1或6,会自动减1,默认 800
amx_mindropmoney <10000>
  玩家的钱大于等于此值才会掉钱, 默认 10000
  最小取值 1000
amx_dropmoney <16000>
  玩家的钱大于等于值此值肯定会掉钱,默认 100000
  最小取值 不小于 amx_mindropmoney
amx_savespecmoney <1|0>
  玩家转为观察员后是否保留他的金钱,默认 0 (CS默认也是不保存的)
   
amx_givemoneymenu
    打开发钱菜单(已经绑定到J键)
   
axm_setmoneynum <num1> [num2]...[num9]
    设置发钱菜单中的发钱数目
amx_addmoney <#t|#ct|name|#userid> <money>
    给所有土匪或警察或指定玩家加钱或扣钱
*/
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike>
#define MONEY_TIER 8000
#define MAX_DROPED_MONEY_COUNT 100
//Money事件msgid
new gmsg_Money
//开始金额和最大金额
new g_startmoney, g_maxmoney
new droped_money_count, g_roundcount
new g_NewRound = 0
new g_MoneyMenuBody[512]
new g_Money[9] = {3000, 5000, 10000, 20000, 30000,...}
new g_keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_0
new g_MoneyCount = 5
new g_MoneyModel[3][]={
"models/money/money1.mdl",
"models/money/money2.mdl",
"models/money/money3.mdl"
}
new total_money[33], g_specmoney[33]
public plugin_init() {
register_plugin("Unlimited Money", "1.0", "Rulzy")
register_dictionary("common.txt")
register_event("Money","read_gmsg_Money","b")
register_event("DeathMsg","eDeathMsg","a")
register_cvar("amx_startmoney", "800")
register_cvar("amx_maxmoney", "300000")
register_cvar("amx_mindropmoney","10000")
register_cvar("amx_dropmoney","100000")
register_cvar("amx_savespecmoney","0")
register_event("TextMsg", "eRestart", "ac", "2&#Game_Commencing", "2&#Game_will_restart")
register_event("HLTV", "eNewRound", "a", "1=0", "2=0")
register_logevent("eRoundStart", 2, "0=World triggered", "1=Round_Start")
register_logevent("eEndRound", 2, "0=World triggered", "1=Round_End")
register_logevent("team_join",3,"1=joined team","2=TERRORIST","2=CT","2=SPECTATOR")
register_touch("MoneyEnt", "player", "money_touch")
gmsg_Money = get_user_msgid("Money")
register_concmd("axm_setmoneynum" , "cmdSetMoneyNum", ADMIN_LEVEL_A, "<num1> [num2]...[num9]")
register_clcmd("amx_givemoneymenu", "cmdGiveMoneyMenu")
register_menucmd(register_menuid("Give Money"), 1023, "ActionMoneyMenu")
register_concmd("amx_addmoney", "cmdAddmoney", ADMIN_LEVEL_A, "<#t|#ct|name|#userid> <money>")
g_keys = 0
new iLen = format(g_MoneyMenuBody, 511, "\y你想发多少钱?\w^n^n");
for(new i=0;i<g_MoneyCount;i++)
{
  iLen += format(g_MoneyMenuBody[iLen], 511-iLen, "%d. %d^n", i+1, g_Money)
  g_keys |= 1<<i
}
for(new i=g_MoneyCount;i<9;i++)
  g_Money = 0
format(g_MoneyMenuBody[iLen], 511-iLen, "^n0. 退出")
g_keys |= MENU_KEY_0
}
public plugin_precache()
{
precache_model(g_MoneyModel[0])
precache_model(g_MoneyModel[1])
precache_model(g_MoneyModel[2])
}
public check_start_maxmoney()
{ g_maxmoney = get_cvar_num("amx_maxmoney")
if(g_maxmoney<16000)
  g_maxmoney = 16000
g_startmoney = get_cvar_num("amx_startmoney")
if(g_startmoney>g_maxmoney)
  g_startmoney = g_maxmoney
else if(g_startmoney<800)
  g_startmoney=800
set_cvar_num("amx_maxmoney", g_maxmoney)
set_cvar_num("amx_startmoney", g_startmoney)
}
public read_gmsg_Money(id)
{
check_start_maxmoney()
new current_total = read_data(1)   //变化后当前真正的钱
new newmoney
if(current_total%5==1)  //只有是CS给予玩家默认的第一局钱,其尾数才可能是1或6,游戏中真正加减钱都会是5的倍数
{
  total_money[id] = 0
  newmoney = g_startmoney
}else{
  if(total_money[id]>MONEY_TIER)
   newmoney = total_money[id] - MONEY_TIER + current_total
  else if(total_money[id]%5==1)
   newmoney = current_total+1
  else
   newmoney = current_total
}
native_cs_set_user_money2(id, newmoney, 1)
}
public plugin_natives()
{
register_native("cs_set_user_money2", "native_cs_set_user_money2", 1)
register_native("cs_get_user_money2", "native_cs_get_user_money2", 1)
}
public native_cs_set_user_money2(id, money, flash)
{
if(!is_user_connected(id)) return
if(money>g_maxmoney)
  money=g_maxmoney
else if(money<0)
  money = 0
if(money>MONEY_TIER)
{
  cs_set_user_money(id, MONEY_TIER, 0)  //设置玩家可用钱为MONEY_TIER
  
  message_begin( MSG_ONE , gmsg_Money , {0,0,0}, id)
  write_long(total_money[id])
  write_byte(0)
  message_end()
  
  message_begin( MSG_ONE , gmsg_Money , {0,0,0}, id)
  write_long(money)
  write_byte(flash)
  message_end()
}else if(money%5==1){
  cs_set_user_money(id, money-1, 0)
  
  message_begin( MSG_ONE , gmsg_Money , {0,0,0}, id)
  write_long(total_money[id])
  write_byte(0)
  message_end()
  
  message_begin( MSG_ONE , gmsg_Money , {0,0,0}, id)
  write_long(money)
  write_byte(flash)
  message_end()
}else{
  cs_set_user_money(id, money, flash)
}
total_money[id] = money
}
public native_cs_get_user_money2(id)
{
return total_money[id]
}
public add_player_money(player, addmoney)
{
check_start_maxmoney()
new newmoney = total_money[player] + addmoney
native_cs_set_user_money2(player, newmoney, 1)
}
public cmdSetMoneyNum(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
  return PLUGIN_HANDLED
new argv[13]
g_MoneyCount = read_argc() - 1
if(g_MoneyCount>9) g_MoneyCount = 9
g_keys = 0
new iLen = format(g_MoneyMenuBody, 511, "\y你想发多少钱?\w^n^n");
for(new i=0;i<g_MoneyCount;i++)
{
  read_argv(i+1, argv, 12)
  g_Money = str_to_num(argv)
  iLen += format(g_MoneyMenuBody[iLen], 511-iLen, "%d. %d^n", i+1, g_Money)
  g_keys |= 1<<i
}
for(new i=g_MoneyCount;i<9;i++)
  g_Money = 0
format(g_MoneyMenuBody[iLen], 511-iLen, "^n0. 退出")
g_keys |= MENU_KEY_0
return PLUGIN_HANDLED
}
public ActionMoneyMenu(id, key)
{
if(key!=9)
{
  GiveMoney(id, g_Money[key])
  show_menu(id, g_keys, g_MoneyMenuBody, -1, "Give Money")
}
}
public cmdGiveMoneyMenu(id)
{
show_menu(id, g_keys, g_MoneyMenuBody, -1, "Give Money")
return PLUGIN_HANDLED
}
public GiveMoney(id, money)
{
if(!is_user_alive(id))
{
  client_print(id, print_chat, "对不起,只有活着的玩家才能发钱")
  return
}
if(total_money[id]<money)
{
  client_print(id, print_chat, "对不起,你的金钱不足 %d", money)
  return
}
if(droped_money_count>=MAX_DROPED_MONEY_COUNT)
{
  client_print(id, print_chat, "对不起,已经达到最大发钱掉钱金钱数量")
  return
}
droped_money_count++
new Float:origin[3], Float:uservelocity[3], Float:velocity[3]
entity_get_vector(id, EV_VEC_origin, origin)
entity_get_vector(id, EV_VEC_velocity, uservelocity)
velocity_by_aim(id, 450, velocity)
velocity[0] += uservelocity[0]
velocity[1] += uservelocity[1]
velocity[2] = 0.0
//使发出的钱适当分散
velocity[0]+=random_float(-100.0,100.0)
velocity[1]+=random_float(-100.0,100.0)
new gEnt = create_entity("info_target")
entity_set_string(gEnt, EV_SZ_classname, "MoneyEnt")
entity_set_origin(gEnt,origin)
entity_set_int(gEnt, EV_INT_solid, SOLID_TRIGGER)
entity_set_int(gEnt, EV_INT_movetype, MOVETYPE_TOSS)
entity_set_vector(gEnt, EV_VEC_velocity, velocity)
entity_set_int(gEnt, EV_INT_iuser1, g_roundcount) //哪局发的钱
entity_set_int(gEnt, EV_INT_iuser2, money)//玩家可以捡到的钱数
entity_set_edict(gEnt, EV_ENT_owner, id) //谁发的钱
entity_set_float(gEnt, EV_FL_fuser1, get_gametime())//发钱的时间
if(money<5000)
  entity_set_model(gEnt, g_MoneyModel[2])
else if(money<30000)
  entity_set_model(gEnt, g_MoneyModel[1])
else
  entity_set_model(gEnt, g_MoneyModel[0])

new iOrigin[3]
FVecIVec(origin, iOrigin)
new param[4]
param[0] = gEnt
param[1] = iOrigin[0]
param[2] = iOrigin[1]
param[3] = iOrigin[2]
set_task(0.2, "reset_size", 0, param, 4)

add_player_money(id, -money)
        client_cmd(0,"spk misc/dropmoney.mp3")
new msg[256], name[32]
get_user_name(id, name, 31)
format(msg, 255, "^x03%s^x01 发了 ^x04%d^x01 金钱", name, money)
client_color(0, id, msg)
}
public reset_size(param[])
{
new gEnt = param[0]
if(!is_valid_ent(gEnt)) return
new oldOrigin[3], Float: newOrigin[3], inewOrigin[3]
oldOrigin[0] = param[1]
oldOrigin[1] = param[2]
oldOrigin[2] = param[3]
entity_get_vector(gEnt, EV_VEC_origin, newOrigin)
FVecIVec(newOrigin, inewOrigin)
if(get_distance(oldOrigin, inewOrigin)>0){
  param[0] = gEnt
  param[1] = inewOrigin[0]
  param[2] = inewOrigin[1]
  param[3] = inewOrigin[2]
  set_task(0.2, "reset_size", 0, param, 4)
}else{
  new Float:maxbox[3] = {15.0, 15.0, 15.0}, Float:minbox[3] = {-15.0, -15.0, -15.0}
  entity_set_size(gEnt, minbox, maxbox)
}
}
public money_touch(ptr, ptd)
{        
if (is_user_alive(ptd)&&(total_money[ptd]<g_maxmoney))
{
  new owner = entity_get_edict(ptr, EV_ENT_owner)
  new Float:droptime = entity_get_float(ptr, EV_FL_fuser1)
  if(owner==ptd && get_gametime()-droptime<0.3) return
  new money = entity_get_int(ptr, EV_INT_iuser2)
  new oldmoney = total_money[ptd]
  add_player_money(ptd, money)
                client_cmd(ptd,"spk misc/getmoney.mp3")
  new usergetmoney = total_money[ptd] - oldmoney
  if(usergetmoney>99){  //玩家可以捡的钱数太少就不提示了
   new name[32]
   get_user_name(ptd, name, 31)
   new msg[256]
   format(msg, 255, "^x03%s^x01 捡到 ^x04%d^x01 金钱", name, usergetmoney)
   client_color(0, ptd, msg)
  }
  new leftmoney = money-usergetmoney
  if(leftmoney<100)  //剩余钱数少于100
  {
   remove_entity(ptr)
   droped_money_count--
  }else{
   entity_set_int(ptr, EV_INT_iuser2, leftmoney)
   if(leftmoney<5000)
    entity_set_model(ptr, g_MoneyModel[2])
   else if(leftmoney<30000)
    entity_set_model(ptr, g_MoneyModel[1])
   else
    entity_set_model(ptr, g_MoneyModel[0])
   new Float:maxbox[3] = {15.0, 15.0, 15.0}, Float:minbox[3] = {-15.0, -15.0, -15.0}
   entity_set_size(ptr, minbox, maxbox)
  }
}
}
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 bind_key(id)
{
client_cmd(id, "bind j amx_givemoneymenu")
client_color(id, id, "^x04【提示】^x01按 ^x04J^x01 键打开发钱菜单")
}
public client_putinserver(id)
{
set_cvar_num("mp_startmoney", 801)
check_start_maxmoney()
set_task(5.0, "bind_key", id)
return PLUGIN_CONTINUE
}
public team_join()
{
check_start_maxmoney()
new user[128]
read_logargv(0, user, 127)
new name[32], oldteam[12]={0}
parse_loguser(user, name, 31, _, _, _, oldteam, 11)

new id = get_user_index(name)

new newteam[16]
read_logargv(2,newteam, 15)
new savespecmoney = get_cvar_num("amx_savespecmoney")
if(equal(newteam,"SPECTATOR")) //加入观察员
{
  if(oldteam[0]) //从T或CT加入观察员
  {
   if(savespecmoney)
    g_specmoney[id] = total_money[id]
   else
    g_specmoney[id] = g_startmoney
  }else{  //进入服务器就加入观察员
   g_specmoney[id] = g_startmoney
  }
}else{  //加入T队伍或CT队伍
  if(oldteam[0]==0)  //连接到服务器就加入T或CT
  {
   total_money[id] = 0
   native_cs_set_user_money2(id, g_startmoney, 1)
  }else if(equal(oldteam,"SPECTATOR")){  //从观察员加入T或CT
   if(savespecmoney)
   {
    total_money[id] = 0
    native_cs_set_user_money2(id, g_specmoney[id], 1)
   }else{
    total_money[id] = 0
    native_cs_set_user_money2(id, g_startmoney, 1)
   }
  }
}
}
public eRestart()
{
g_roundcount = 0
check_start_maxmoney()
}
public eNewRound()
{
g_NewRound = 1
g_roundcount++
new gEnt = -1
while ((gEnt = find_ent_by_class(gEnt, "MoneyEnt"))!=0)
{
  if(g_roundcount-entity_get_int(gEnt, EV_INT_iuser1)>3||g_roundcount==1)
  {
   remove_entity(gEnt)
   droped_money_count--
  }
}
}
public eRoundStart()
{
if(!g_NewRound) eNewRound()
}
public eEndRound()
{
g_NewRound = 0
}
public random_drop_money(ori_ammount){
  new drop_control
  new mindropmoney = get_cvar_num("amx_mindropmoney")
  if(mindropmoney<1000)
  {
   mindropmoney = 1000
   set_cvar_num("amx_mindropmoney", 1000)
  }
  if(ori_ammount>=mindropmoney)
  {
   new dropmoney = get_cvar_num("amx_dropmoney")
   if(dropmoney<mindropmoney+1000)
   {
    dropmoney = mindropmoney
    set_cvar_num("amx_dropmoney", dropmoney)
   }
   drop_control=random_num(0, dropmoney)
   if(ori_ammount>=drop_control)
    return random_num(3,7)*random_num(4,8)*random_num(5,10)
   else
    return 0
  }
  return 0
}
public eDeathMsg(){
new killer,victim
killer=read_data(1)
if(!killer) return PLUGIN_CONTINUE
victim=read_data(2)
if(get_user_team(killer)==get_user_team(victim)) return PLUGIN_CONTINUE
//被杀者将会掉一些钱
new victim_money = total_money[victim]
if(droped_money_count<MAX_DROPED_MONEY_COUNT)
{
  new drop_prec = random_drop_money(victim_money)
  if(drop_prec>0){
   new droped_money = victim_money*drop_prec/1000
   new money = droped_money*80/100
   add_player_money(victim,-droped_money)
   new Float:victim_coord[3]
   entity_get_vector(victim, EV_VEC_origin, victim_coord)
   droped_money_count++
   new gEnt = create_entity("info_target")
   entity_set_string(gEnt, EV_SZ_classname, "MoneyEnt")
   entity_set_origin(gEnt, victim_coord)
   entity_set_int(gEnt, EV_INT_solid, SOLID_TRIGGER)
   entity_set_int(gEnt, EV_INT_movetype, MOVETYPE_TOSS)
   entity_set_int(gEnt, EV_INT_iuser1, g_roundcount) //哪局掉的钱
   entity_set_int(gEnt, EV_INT_iuser2, money)//玩家可以捡到的钱数
   entity_set_edict(gEnt, EV_ENT_owner, victim) //谁掉的钱
   entity_set_float(gEnt, EV_FL_fuser1, get_gametime())//掉钱的时间
   if(money<5000)
    entity_set_model(gEnt, g_MoneyModel[2])
   else if(money<30000)
    entity_set_model(gEnt, g_MoneyModel[1])
   else
    entity_set_model(gEnt, g_MoneyModel[0])
   
   new iOrigin[3]
   FVecIVec(victim_coord, iOrigin)
   new param[4]
   param[0] = gEnt
   param[1] = iOrigin[0]
   param[2] = iOrigin[1]
   param[3] = iOrigin[2]
   set_task(0.2, "reset_size", 0, param, 4)
   new victimname[32]
   get_user_name(victim,victimname,31)
   new msg[100]
   format(msg,99,"^x03%s^x01 掉了 ^x04%d^x01 金钱",victimname,droped_money)
   client_color(0,victim,msg)
  }
}
return PLUGIN_CONTINUE
}
public cmdAddmoney(id, level, cid)
{
if(!cmd_access(id, level, cid, 3))
  return PLUGIN_HANDLED

new target[32], smoney[14], money, maxplayers
read_argv(1, target, 31)
read_argv(2, smoney, 13)
money = str_to_num(smoney)
if(money==0) return PLUGIN_HANDLED
maxplayers = get_maxplayers()
new team = 0
if(equali(target, "#t"))
  team = 1
else if(equali(target, "#ct"))
  team = 2
new name[32]
get_user_name(id, name, 31)
if(team>0){
  new teamplayercount = 0
  for(new i=1;i<=maxplayers;i++){
   if(!is_user_connected(i)) continue
   if(get_user_team(i)==team){
    add_player_money(i, money)
    teamplayercount++
   }
  }
  if(teamplayercount>0){
   switch (get_cvar_num("amx_show_activity"))
   {
    case 2: client_print(0, print_chat, "管理员 %s: 给所有%s%s %d 金钱", name, (team==1)?"恐怖分子":"警察", (money>0)?"加":"扣除", abs(money))
    case 1: client_print(0, print_chat, "管理员: 给所有%s%s %d 金钱", (team==1)?"恐怖分子":"警察", (money>0)?"加":"扣除", abs(money))
   }
  }
  return PLUGIN_HANDLED
}
new player = cmd_target(id, target, 2)
if(!player) return PLUGIN_HANDLED
add_player_money(player, money)
new playername[32]
get_user_name(player, playername, 31)
switch (get_cvar_num("amx_show_activity"))
{
  case 2: client_print(0, print_chat, "管理员 %s: 给 %s %s %d 金钱", name, playername, (money>0)?"加":"扣除", abs(money))
  case 1: client_print(0, print_chat, "管理员: 给 %s %s %d 金钱", playername, (money>0)?"加":"扣除", abs(money))
}
return PLUGIN_HANDLED
}
/* UTF-8 func by www.DT-Club.net */
回复

使用道具 举报

发表于 2007-9-20 17:29:21 | 显示全部楼层 来自 中国–广东–佛山–禅城区

回复: 捡钱的声效怎么添加?

2楼的代码已修改得很清楚了,自已动一下手.声音文件自己去找.
回复

使用道具 举报

 楼主| 发表于 2007-9-20 20:04:15 | 显示全部楼层 来自 中国–浙江–湖州

回复: 捡钱的声效怎么添加?

但是源文件不能编译啊?
回复

使用道具 举报

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

回复: 捡钱的声效怎么添加?

源文件不能编译啊:sweat: ?

本帖子中包含更多资源

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

×
回复

使用道具 举报

发表于 2007-9-21 02:17:45 | 显示全部楼层 来自 中国–广东–佛山–禅城区

回复: 捡钱的声效怎么添加?

哦,之前没留意代码里面已经有了precache.
不好意思.
帮你改好了.不过没测试.自己编译吧.

本帖子中包含更多资源

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

×
回复

使用道具 举报

发表于 2007-9-21 02:40:03 | 显示全部楼层 来自 中国–广东–广州–白云区

回复: 捡钱的声效怎么添加?

钱。钱。钱。钱钱钱。钱。钱。钱。钱钱钱。钱。钱。钱

本帖子中包含更多资源

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

×
回复

使用道具 举报

发表于 2007-9-21 02:44:25 | 显示全部楼层 来自 中国–广东–广州–白云区

回复: 捡钱的声效怎么添加?

:D 捡钱的声效 :super: 捡钱的声效:D

本帖子中包含更多资源

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

×
回复

使用道具 举报

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

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