搜索
查看: 1254|回复: 0

Ryu2877 进来看看帮帮忙

[复制链接]
发表于 2007-1-20 14:39:17 | 显示全部楼层 |阅读模式 来自 中国–重庆–重庆–永川区
怎么在一个插件下添加需要金钱购买参数和函数
或则大哥帮我添加一下以下插件
添加一个限制一个多少钱购买此东西的参数和函数

/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#define PLUGIN "AMX Cards"
#define VERSION "1.5"
#define AUTHOR "MaTTe"
new g_nMsgScreenFade
new g_nMsgScreenFade2
new last_card
new g_Switch, g_CardDelay, g_PCard, g_PCardMult, g_DCard, g_LCard, g_MaxLife, g_MCard, g_IACard, g_StrCard,
g_RBCard, g_ACard, g_MaxArmor, g_SpCard, g_SlCard, g_WCard, g_GCard, g_NCard, g_SpyCard, g_MoneyCard,
g_SglassesCard, g_MaxMoney, g_MoneyPerSec, g_BankruptCard, g_InvisCard, g_InvisPercentage,
g_GlowCard, g_CardMode
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /card", "cmd_card")
register_clcmd("say_team /card", "cmd_card")
register_clcmd("say /cardhelp", "cardhelp")
register_clcmd("say_team /cardhelp", "cardhelp")

g_Switch = register_cvar("card_amxcards", "1")
g_CardDelay = register_cvar("card_delay", "300")
g_CardMode = register_cvar("card_mode", "1")
g_PCardMult = register_cvar("card_powercard_mult", "2.0")
g_MaxLife = register_cvar("card_lifecard_maxhealth", "200")
g_MaxArmor = register_cvar("card_armorcard_maxarmor", "500")
g_MaxMoney = register_cvar("card_moneycard_maxmoney", "16000")
g_MoneyPerSec = register_cvar("card_moneycard_mpc", "10")
g_InvisPercentage = register_cvar("card_invisiblepercent", "25")

g_PCard = register_cvar("card_powercard", "0")
g_DCard = register_cvar("card_deathcard", "0")
g_LCard = register_cvar("card_lifecard", "0")
g_MCard = register_cvar("card_mysterycard", "0")
g_IACard = register_cvar("card_infiniteammocard", "0")
g_StrCard = register_cvar("card_strippercard", "0")
g_RBCard = register_cvar("card_rainbowcard", "0")
g_ACard = register_cvar("card_armorcard", "0")
g_SpCard = register_cvar("card_speedcard", "0")
g_SlCard = register_cvar("card_slowcard", "0")
g_WCard = register_cvar("card_weaknesscard", "0")
g_GCard = register_cvar("card_gravitycard", "0")
g_NCard = register_cvar("card_nadecard", "0")
g_SpyCard = register_cvar("card_spycard", "0")
g_MoneyCard = register_cvar("card_moneycard", "0")
g_BankruptCard = register_cvar("card_bankruptcard", "0")
g_SglassesCard = register_cvar("card_sunglassescard", "0")
g_InvisCard = register_cvar("card_invisiblecard", "0")
g_GlowCard = register_cvar("card_glowcard", "0")

new CardMode = get_pcvar_num(g_CardMode)
switch(CardMode) {
  case 0:
  {
   set_pcvar_num(g_PCard, 1)
   set_pcvar_num(g_DCard, 1)
   set_pcvar_num(g_LCard, 1)
   set_pcvar_num(g_MCard, 1)
   set_pcvar_num(g_IACard, 1)
   set_pcvar_num(g_StrCard, 1)
   set_pcvar_num(g_RBCard, 1)
   set_pcvar_num(g_ACard, 1)
   set_pcvar_num(g_SpCard, 1)
   set_pcvar_num(g_SlCard, 1)
   set_pcvar_num(g_WCard, 1)
   set_pcvar_num(g_GCard, 1)
   set_pcvar_num(g_NCard, 1)
   set_pcvar_num(g_SpyCard, 1)
   set_pcvar_num(g_MoneyCard, 1)
   set_pcvar_num(g_BankruptCard, 1)
   set_pcvar_num(g_SglassesCard, 1)
   set_pcvar_num(g_InvisCard, 1)
   set_pcvar_num(g_GlowCard, 1)
  }
  case 1:
  {
   set_pcvar_num(g_PCard, 1)
   set_pcvar_num(g_DCard, 1)
   set_pcvar_num(g_LCard, 1)
   set_pcvar_num(g_MCard, 1)
   set_pcvar_num(g_IACard, 1)
   set_pcvar_num(g_StrCard, 1)
  }
  case 2:
  {
   set_pcvar_num(g_RBCard, 1)
   set_pcvar_num(g_ACard, 1)
   set_pcvar_num(g_SpCard, 1)
   set_pcvar_num(g_SlCard, 1)
   set_pcvar_num(g_WCard, 1)
   set_pcvar_num(g_GCard, 1)
  }
  case 3:
  {
   set_pcvar_num(g_NCard, 1)
   set_pcvar_num(g_SpyCard, 1)
   set_pcvar_num(g_MoneyCard, 1)
   set_pcvar_num(g_BankruptCard, 1)
   set_pcvar_num(g_SglassesCard, 1)
   set_pcvar_num(g_InvisCard, 1)
   set_pcvar_num(g_GlowCard, 1)
  }
}

register_logevent("logevent_round_end", 2, "1=Round_End")

set_task(300.0, "advertise")

if(!get_pcvar_num(g_SglassesCard))
  return PLUGIN_CONTINUE
  
g_nMsgScreenFade2 = get_user_msgid("ScreenFade")
register_event("ScreenFade","sunglassescard","be","4=255","5=255","6=255","7>199")
return PLUGIN_CONTINUE
}
public cardhelp(id) {
show_motd(id, "help.txt", "Card Help")
}
public advertise() {
client_print(0, print_chat, "This server is running AMX Cards version %s (/cardhelp for more info)", VERSION)
}
public cmd_card(id) {
if(!get_pcvar_num(g_Switch))
  return PLUGIN_HANDLED
if(get_gametime() - get_pcvar_num(g_CardDelay) <= last_card) {
  client_print(id, print_chat, "You've already chosen a card recently. Please try again later.")
  return PLUGIN_CONTINUE
}

new rand = random_num(1,19)

switch(rand)
{
  case 1:
  {
   client_print(id, print_chat, "You got the Death Card")
   deathcard(id)
  }
  case 2:
  {
   client_print(id, print_chat, "You got the Life Card")
   lifecard(id)
  }
  case 3:
  {
   client_print(id, print_chat, "You got the Mystery Card")
   mysterycard(id)
  }
  case 4:
  {
   client_print(id, print_chat, "You got the Infinite Ammo Card")
   infiniteammocard(id)
  }
  case 5:
  {
   client_print(id, print_chat, "You got the Stripper Card")
   strippercard(id)
  }
  case 6:
  {
   client_print(id, print_chat, "You got the Rainbow Card")
   rainbowcard(id)
  }
  case 7:
  {
   client_print(id, print_chat, "You got the Armor Card")
   armorcard(id)
  }
  case 8:
  {
   client_print(id, print_chat, "You got the Speed Card")
   speedcard(id)
  }
  case 9:
  {
   client_print(id, print_chat, "You got the Slow Card")
   slowcard(id)
  }
  case 10:
  {
   client_print(id, print_chat, "You got the Power Card")
   powercard(id)
  }
  case 11:
  {
   client_print(id, print_chat, "You got the Weakness Card")
   weaknesscard(id)
  }
  case 12:
  {
   client_print(id, print_chat, "You got the Gravity Card")
   gravitycard(id)
  }
  case 13:
  {
   client_print(id, print_chat, "You got the Nade Card")
   nadecard(id)
  }
  case 14:
  {
   client_print(id, print_chat, "You got the Spy Card")
   spycard(id)
  }
  case 15:
  {
   client_print(id, print_chat, "You got the Money Card")
   moneycard(id)
  }
  case 16:
  {
   client_print(id, print_chat, "You got the Bankrupt Card")
   bankruptcard(id)
  }
  case 17:
  {
   client_print(id, print_chat, "You got the Invisible Card")
   invisiblecard(id)
  }
  case 18:
  {
   client_print(id, print_chat, "You got the Glow Card")
   glowcard(id)
  }
  case 19:
  {
   client_print(id, print_chat, "You got the Sunglasses Card")
   sunglassescard(id)
  }
}
return PLUGIN_CONTINUE
}
public deathcard(id) {
if(!get_pcvar_num(g_DCard))
  return PLUGIN_CONTINUE

client_cmd(id, "kill")
return PLUGIN_CONTINUE
}
public give_life(id) {
new health = get_user_health(id)
new maxhealth = get_pcvar_num(g_MaxLife)
if(health == maxhealth)
  return PLUGIN_CONTINUE
  
set_user_health(id, health+3)
set_task(1.0, "give_life", id)
return PLUGIN_CONTINUE
}
public give_armor(id) {
new armor = get_user_armor(id)
new maxarmor = get_pcvar_num(g_MaxArmor)
if(armor == maxarmor)
  return PLUGIN_CONTINUE
  
set_user_armor(id, armor+5)
set_task(1.0, "give_armor", id)
return PLUGIN_CONTINUE
}
public lifecard(id) {
if(!get_pcvar_num(g_LCard))
  return PLUGIN_CONTINUE
give_life(id)
return PLUGIN_CONTINUE
}
public armorcard(id) {
if(!get_pcvar_num(g_ACard))
  return PLUGIN_CONTINUE

give_armor(id)
return PLUGIN_CONTINUE
}
public speedcard(id) {
if(!get_pcvar_num(g_SpCard))
  return PLUGIN_CONTINUE

set_user_maxspeed(id, 640.0)
return PLUGIN_CONTINUE
}
public slowcard(id) {
if(!get_pcvar_num(g_SlCard))
  return PLUGIN_CONTINUE

set_user_maxspeed(id, 160.0)
return PLUGIN_CONTINUE
}
public powercard(id) {
if(!get_pcvar_num(g_PCard))
  return PLUGIN_CONTINUE

new damage = read_data(2)
new Float:damage_mult = damage * get_pcvar_float(g_PCardMult)
damage == damage_mult

return PLUGIN_CONTINUE
}
public weaknesscard(id) {
if(!get_pcvar_num(g_WCard))
  return PLUGIN_CONTINUE

new damage = read_data(2)
new Float:damage_mult = damage / get_cvar_float("powercard_mult")
damage == damage_mult

return PLUGIN_CONTINUE
}
public mysterycard(id) {
if(!get_pcvar_num(g_MCard))
  return PLUGIN_CONTINUE

new rand2 = random_num(1, 3)

switch(rand2)
{
  case 1:
  {
   set_user_noclip(id, 1)
  }
  case 2:
  {
   set_user_godmode(id, 1)
  }
  case 3:
  {
   set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0)
  }
}
return PLUGIN_CONTINUE
}
public infiniteammocard(id) {
if(!get_pcvar_num(g_IACard))
  return PLUGIN_CONTINUE
new clip, ammo
get_user_weapon(id, clip, ammo)

if(clip==0)
{
  cs_set_weapon_ammo(id, 30)
}
return PLUGIN_CONTINUE
}
public strippercard(id) {
if(!get_pcvar_num(g_StrCard))
  return PLUGIN_CONTINUE

strip_user_weapons(id)
give_item(id, "weapon_knife")
set_user_health(id, 15)
return PLUGIN_CONTINUE
}
public rainbowcard(id) {
if(!get_pcvar_num(g_RBCard))
  return PLUGIN_CONTINUE

new rand3 = random_num(1, 4)

new rgb[3]

switch(rand3)
{
  case 1:
  {
   rgb[0] = 255
   rgb[1] = 0
   rgb[2] = 0
  }
  case 2:
  {
   rgb[0] = 255
   rgb[1] = 255
   rgb[2] = 0
  }
  case 3:
  {
   rgb[0] = 255
   rgb[1] = 255
   rgb[2] = 255
  }
  case 4:
  {
   rgb[0] = 0
   rgb[1] = 255
   rgb[2] = 0
  }
}
message_begin(MSG_ONE, g_nMsgScreenFade, {0,0,0}, id)
write_short(read_data(1))
write_short(read_data(2))
write_short(read_data(3))
write_byte (rgb[0])
write_byte (rgb[1])
write_byte (rgb[2])
write_byte (read_data(7))
message_end()

return PLUGIN_CONTINUE
}
public gravitycard(id) {
if(!get_pcvar_num(g_GCard))
  return PLUGIN_CONTINUE

new rand5 = random_num(1, 4)

switch(rand5) {
  case 1: {
   set_user_gravity(id, 100.0)
  }
  case 2: {
   set_user_gravity(id, 200.0)
  }
  case 3: {
   set_user_gravity(id, 300.0)
  }
  case 4: {
   set_user_gravity(id, 400.0)
  }
}
return PLUGIN_CONTINUE
}
public givenade(id) {
give_item(id, "weapon_hegrenade")
set_task(0.1, "givenade", id)
}
public nadecard(id) {
if(!get_pcvar_num(g_NCard))
  return PLUGIN_CONTINUE

givenade(id)
return PLUGIN_CONTINUE
}
public spycard(id) {
if(!get_pcvar_num(g_SpyCard))
  return PLUGIN_CONTINUE
   
new Team = get_user_team(id)
new rand4 = random_num(1, 4)
   
switch(rand4)
{
  case 1:
  {
   if(Team == 1)
   {
    cs_set_user_model(id, "sas")
   } else if(Team == 2) {
    cs_set_user_model(id, "leet")
   }
  }
  case 2:
  {
   if(Team== 1)
   {
    cs_set_user_model(id, "gsg9")
   } else if(Team == 2) {
    cs_set_user_model(id, "arctic")
   }
  }
  case 3:
  {
   if(Team == 1)
   {
    cs_set_user_model(id, "gign")
   } else if(Team == 2) {
    cs_set_user_model(id, "guerilla")
   }
  }
  case 4:
  {
   if(Team== 1)
   {
    cs_set_user_model(id, "urban")
   } else if(Team == 2) {
    cs_set_user_model(id, "phoenix")
   }
  }
}
return PLUGIN_CONTINUE
}
public give_money(id) {
new money = cs_get_user_money(id)
if(money==get_pcvar_num(g_MaxMoney))
  return PLUGIN_CONTINUE
  
cs_set_user_money(id, money + get_pcvar_num(g_MoneyPerSec))
set_task(1.0, "give_money", id)
return PLUGIN_CONTINUE
}
public moneycard(id) {
if(!get_pcvar_num(g_MoneyCard))
  return PLUGIN_CONTINUE

give_money(id)
return PLUGIN_CONTINUE
}
public bankruptcard(id) {
if(!get_pcvar_num(g_BankruptCard))
  return PLUGIN_CONTINUE

new money = cs_get_user_money(id)
cs_set_user_money(id, money - money)
return PLUGIN_CONTINUE
}
public sunglassescard(id) {
if(!get_pcvar_num(g_SglassesCard))
  return PLUGIN_CONTINUE
message_begin(MSG_ONE, g_nMsgScreenFade2, {0,0,0}, id)
write_short(read_data(1))
write_short(read_data(2))
write_short(read_data(3))
write_byte (0)
write_byte (0)
write_byte (0)
write_byte (read_data(7))
message_end()
return PLUGIN_CONTINUE
}
public invisiblecard(id) {
if(!get_pcvar_num(g_InvisCard))
  return PLUGIN_CONTINUE

new percentage = get_pcvar_num(g_InvisPercentage)
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, percentage)
return PLUGIN_CONTINUE
}
public glowcard(id) {
if(!get_pcvar_num(g_GlowCard))
  return PLUGIN_CONTINUE

set_user_rendering(id, kRenderFxNone, 224, 12, 224, kRenderGlow, 100)
return PLUGIN_CONTINUE
}
public logevent_round_end(id)
{
set_user_godmode(id, 0)
set_user_noclip(id, 0)
set_user_health(id, 100)
set_user_maxspeed(id, 320.0)
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 100)
cs_reset_user_model(id)
}
游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

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