|
已经是二次发贴了:
最近在Super Hero的官方网上找到了一个很有趣的英雄,他的技能有点像七龙珠里的魔人布欧(sh_majinbuu.amxx),可以把玩家打死后让其变成巧克力(急救包),无论谁去捡起掉在地上的急救包都可以增加50HP!
所以,我想把这个英雄插件改成普通的大家都能共享的插件,改后的插件可以增加以下指令:
amx_medkit 1 // 插件开关控制
amx_medkithealth 50 // 急救包补充的血值(默认是50)
我自己试着把插件的源代码改了一下,但无法成功地在Amxmodx1.76d下编译出来。我知道里面肯定还有很多地方没有修改好,麻烦大家帮帮忙了......:burn:
- */
-
- #include <amxmodx>
- #include <cstrike>
- #include <csx>
-
-
- // GLOBAL VARIABLES
- #define Smoke
-
- //----------------------------------------------------------------------------------------------
-
- public plugin_init()
- {
- // Plugin Info
- register_plugin("AMX Medkit","1.0","duper/Rockell")
-
- // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
- [color=red]register_cvar("amx_medkit", "1" )
- register_cvar("amx_medkithealth", "50")
- [/color]
- // REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
- // INIT
-
- register_event("ResetHUD", "newRound","b")
- register_event("DeathMsg","deathevent","a")
-
- }
- //----------------------------------------------------------------------------------------------
-
- public newRound()
- {
- new chocolate = find_ent_by_class(-1, "chocolate")
- while(chocolate) {
- remove_entity(chocolate)
- chocolate = find_ent_by_class(chocolate, "chocolate")
- }
- }
-
- //----------------------------------------------------------------------------------------------
-
- public deathevent()
- {
- new killer = read_data(1)
- new victim = read_data(2)
- if ( killer != victim )
- {
- if ( gHasBuuPower[killer] && is_user_alive(killer) )
- {
- createChocolate(victim)
- new aimvec[3]
- get_user_origin(victim, aimvec)
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(23)
- write_coord(aimvec[0])
- write_coord(aimvec[1])
- write_coord(aimvec[2])
- write_short(Smoke)
- write_byte(001)
- write_byte(65)
- write_byte(200)
- message_end()
- aimvec[2] -= 100
- set_user_origin(victim, aimvec)
-
- }
- }
- return PLUGIN_HANDLED
- }
-
- //----------------------------------------------------------------------------------------------
-
- public createChocolate(victim)
- {
- new Float:vAim[3], Float:vOrigin[3]
- entity_get_vector(victim, EV_VEC_origin, vOrigin)
- VelocityByAim(victim, random_num(2, 4), vAim)
-
- vOrigin[0] += vAim[0]
- vOrigin[1] += vAim[1]
- vOrigin[2] += 30.0
-
- new chocolate = create_entity("info_target")
- entity_set_string(chocolate, EV_SZ_classname, "chocolate")
- entity_set_model(chocolate, "models/w_medkit.mdl")
- entity_set_size(chocolate, Float:{-2.5, -2.5, -1.5}, Float:{2.5, 2.5, 1.5})
- entity_set_int(chocolate, EV_INT_solid, 2)
- entity_set_int(chocolate, EV_INT_movetype, 6)
- entity_set_vector(chocolate, EV_VEC_origin, vOrigin)
- }
-
- //----------------------------------------------------------------------------------------------
-
- public plugin_precache() {
- precache_model("models/w_medkit.mdl")
- Smoke = precache_model("sprites/wall_puff4.spr")
- }
-
- //----------------------------------------------------------------------------------------------
-
- public pfn_touch(ptr, ptd)
- {
- if(!is_valid_ent(ptd) || !is_valid_ent(ptr))
- return PLUGIN_CONTINUE
-
- if(!is_user_connected(ptd) || !is_user_alive(ptd))
- return PLUGIN_CONTINUE
-
- if( !gHasBuuPower[ptd] )
- return PLUGIN_CONTINUE
-
- new classname[32]
- entity_get_string(ptr, EV_SZ_classname, classname, 31)
- if(equal(classname, "chocolate"))
- {
- new gOrigHealth = get_user_health(ptd)
- new health = gOrigHealth + get_cvar_num("buu_chocolatehealth")
- set_user_health(ptd, health)
- remove_entity(ptr)
- }
- return PLUGIN_CONTINUE
- }
复制代码 |
|