|
发表于 2009-1-18 20:10:36
|
显示全部楼层
|阅读模式
来自 中国–浙江–温州–平阳县
本帖最后由 mwy5ym 于 2009-1-20 18:38 编辑
插件名字是RewardAndPunish,简称rap。
参考了国外网站上的一个插件UMR,但是我的和他的可是大不一样的哦。大家来测试下。
插件描述:
插件效果 发生在一次kill之后。
根据kill的类型(普通no/爆头hs/刀杀kn/炸死he),对 杀手 和 牺牲者 进行 奖励 和 惩罚
奖励包括 加护甲armor,加生命health,加钱money; 惩罚包括扣钱money;
奖励 和 惩罚 效果可以叠加。比如爆头就包括 普通杀 + 爆头的结果,用刀或手雷爆头就是3者的叠加了。
大致就是这样,大家来测试下吧
Cvars :
rap_view :浏览插件设置
rap_enable <1/0> : 插件开关
rap_set armor max <100~200> : 每个人的最大护甲值
rap_set health max <100~200> : 每个人的最大生命值
xx表示(no:normal killing/hs:headshot killing/kn:knife killing/he:hegrenade killing)
rap_set armor xx <0~200> : 杀手在xx下杀敌得到的护甲
rap_set health xx <0~200> : 杀手在xx下杀敌得到的生命
rap_set reward xx <0~16000> : 杀手在xx下杀敌得到的钱
rap_set punish xx <0~16000> : 牺牲者在被xx杀死后失去的钱
<name> <default>
rap_view
rap_enable 1
rap_set armor max 200
rap_set health max 200
rap_set armor no 0
rap_set health no 0
rap_set punish no 0
rap_set reward no 0
rap_set armor hs 10
rap_set health hs 10
rap_set punish hs 0
rap_set reward hs 0
rap_set armor kn 10
rap_set health kn 10
rap_set punish kn 300
rap_set reward kn 0
rap_set armor he 10
rap_set health he 10
rap_set punish he 300
rap_set reward he 0
- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- #include <fun>
- #define PLUGIN "Reward And Punish"
- #define VERSION "1.0"
- #define AUTHOR "mwy5ym"
- new
- active_flag,max_armor,max_health,
- no_armor,no_health,no_punish,no_reward,
- hs_armor,hs_health,hs_punish,hs_reward,
- kn_armor,kn_health,kn_punish,kn_reward,
- he_armor,he_health,he_punish,he_reward;
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR);
- register_event("DeathMsg","Action","a");
- register_concmd("rap_set","SetRAP", ADMIN_LEVEL_A,"<flag> <flag> <n>");
- register_concmd("rap_view","ViewRAP", ADMIN_LEVEL_A,"- View The RAP Set");
- active_flag = register_cvar("rap_enable","1");
-
- max_armor=200; max_health=200;
- no_armor=0; no_health=0; no_punish=0; no_reward=0;
- hs_armor=10; hs_health=10; hs_punish=0; hs_reward=0;
- kn_armor=10; kn_health=10; kn_punish=300; kn_reward=0;
- he_armor=10; he_health=10; he_punish=300; he_reward=0;
- }
- public Action()
- {
- if(!get_pcvar_num(active_flag))
- return PLUGIN_HANDLED;
- new killer = read_data(1);
- new victim = read_data(2);
- new weapon[24];
- if( (killer == victim) || (get_user_team(killer)==get_user_team(victim)) )
- return PLUGIN_HANDLED;
- read_data(4,weapon,23);
- karmor(killer,no_armor);
- khealth(killer,no_health);
- kmoney(killer,no_reward);
- vmoney(victim,no_punish);
- if(read_data(3))
- {
- karmor(killer,hs_armor);
- khealth(killer,hs_health);
- kmoney(killer,hs_reward);
- vmoney(victim,hs_punish);
- }
- if(weapon[0] == 'k')
- {
- karmor(killer,kn_armor);
- khealth(killer,kn_health);
- kmoney(killer,kn_reward);
- vmoney(victim,kn_punish);
- }
- if(weapon[1] == 'r')
- {
- karmor(killer,he_armor);
- khealth(killer,he_health);
- kmoney(killer,he_reward);
- vmoney(victim,he_punish);
- }
- return PLUGIN_HANDLED;
- }
- public ViewRAP(id, level, cid)
- {
- if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED;
- console_print(id, " normal headshot knife hegrenade themax");
- console_print(id, "armor %5d %5d %5d %5d %5d",no_armor,hs_armor,kn_armor,he_armor,max_armor);
- console_print(id, "health %5d %5d %5d %5d %5d",no_health,hs_health,kn_health,he_health,max_health);
- console_print(id, "punish %5d %5d %5d %5d",no_punish,hs_punish,kn_punish,he_punish);
- console_print(id, "reward %5d %5d %5d %5d",no_reward,hs_reward,kn_reward,he_reward);
- return PLUGIN_HANDLED;
- }
- public SetRAP(id, level, cid)
- {
- if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED;
- new ItemFlag[7],KillFlag[4],TheDigit[7],number;
- read_argv(1,ItemFlag,6);
- read_argv(2,KillFlag,3);
- read_argv(3,TheDigit,6);
- number=str_to_num(TheDigit);
-
- if(ItemFlag[0]=='a'||ItemFlag[0]=='h')
- {
- if(number<0)number=0;
- if(number>200)number=200;
- if(KillFlag[0]=='m' && number<100)number=100;
- }else
- {
- if(number<0)number=0;
- if(number>16000)number=16000;
- }
-
- switch(ItemFlag[0])
- {
- case 'a':
- {
- if(KillFlag[0]=='m')max_armor=number;
- if(KillFlag[0]=='n'&&KillFlag[1]=='o')no_armor=number;
- if(KillFlag[0]=='h'&&KillFlag[1]=='s')hs_armor=number;
- if(KillFlag[0]=='k'&&KillFlag[1]=='n')kn_armor=number;
- if(KillFlag[0]=='h'&&KillFlag[1]=='e')he_armor=number;
- }
- case 'h':
- {
- if(KillFlag[0]=='m')max_health=number;
- if(KillFlag[0]=='n'&&KillFlag[1]=='o')no_health=number;
- if(KillFlag[0]=='h'&&KillFlag[1]=='s')hs_health=number;
- if(KillFlag[0]=='k'&&KillFlag[1]=='n')kn_health=number;
- if(KillFlag[0]=='h'&&KillFlag[1]=='e')he_health=number;
- }
- case 'p':
- {
- if(KillFlag[0]=='n'&&KillFlag[1]=='o')no_punish=number;
- if(KillFlag[0]=='h'&&KillFlag[1]=='s')hs_punish=number;
- if(KillFlag[0]=='k'&&KillFlag[1]=='n')kn_punish=number;
- if(KillFlag[0]=='h'&&KillFlag[1]=='e')he_punish=number;
- }
- case 'r':
- {
- if(KillFlag[0]=='n'&&KillFlag[1]=='o')no_reward=number;
- if(KillFlag[0]=='h'&&KillFlag[1]=='s')hs_reward=number;
- if(KillFlag[0]=='k'&&KillFlag[1]=='n')kn_reward=number;
- if(KillFlag[0]=='h'&&KillFlag[1]=='e')he_reward=number;
- }
- }
- return PLUGIN_HANDLED
- }
- karmor(index,howmuch)
- {
- set_user_armor(index,get_user_armor(index) + howmuch);
- if(get_user_armor(index)>max_armor)
- set_user_armor(index,max_armor);
- }
- khealth(index,howmuch)
- {
- set_user_health(index,get_user_health(index) + howmuch);
- if(get_user_health(index)>max_health)
- set_user_health(index,max_health);
- }
- kmoney(index,howmuch)
- {
- cs_set_user_money(index,cs_get_user_money(index) + howmuch);
- }
- vmoney(index,howmuch)
- {
- cs_set_user_money(index,cs_get_user_money(index) - howmuch);
- if(cs_get_user_money(index)<0)cs_set_user_money(index,0);
- }
复制代码 |
|