dongtianbao 发表于 2020-2-22 10:08:13

飞刀击中机器人就挂机

本帖最后由 dongtianbao 于 2020-2-23 16:27 编辑

L 02/21/2020 - 22:18:27: Start of error session.
L 02/21/2020 - 22:18:27: Info (map "awp_map_32") (file "addons/amxmodx/logs/error_20200221.log")
L 02/21/2020 - 22:18:27: Invalid entity 117
L 02/21/2020 - 22:18:27: Run time error 10 (plugin "throwing_knives.amxx") (native "entity_get_string") - debug not enabled!
L 02/21/2020 - 22:18:27: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).



服务器出现错误如上,刀子击中机器人就当机

下面是代码,如何修改一下呢?
**************************************************************************/

public vexd_pfntouch(pToucher, pTouched) {

        if(!get_cvar_num("amx_throwknives"))
                return PLUGIN_CONTINUE

        new Classname
        entity_get_string(pToucher, EV_SZ_classname, Classname, 31)
        new owner = entity_get_edict(pToucher, EV_ENT_owner)
        new Float:kOrigin
        entity_get_vector(pToucher, EV_VEC_origin, kOrigin)

        if(equal(Classname,"knife_pickup")) {
                check_cvars()
                new Class2
                entity_get_string(pTouched, EV_SZ_classname, Class2, 31)
                if(!equal(Class2,"player") || knifeammo >= get_cvar_num("amx_maxknifeammo"))
                        return PLUGIN_CONTINUE

                if((knifeammo + holdammo) > get_cvar_num("amx_maxknifeammo")) {
                        holdammo -= get_cvar_num("amx_maxknifeammo") - knifeammo
                        knifeammo = get_cvar_num("amx_maxknifeammo")
                        emit_sound(pToucher, CHAN_ITEM, "weapons/knife_deploy1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
                }
                else {
                        knifeammo += holdammo
                        emit_sound(pToucher, CHAN_ITEM, "weapons/knife_deploy1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
                        remove_entity(pToucher)
                }
                client_print(pTouched, print_center,"You have %i knives",knifeammo)
        }

201724 发表于 2020-3-2 14:15:34

检查pToucher entity的id是117已经不是玩家了

dongtianbao 发表于 2020-3-3 10:43:37

201724 发表于 2020-3-2 14:15
检查pToucher entity的id是117已经不是玩家了

201724前方高能,如何修改插件判断,让击中PODBOT不当机,(用Yapb就不会当机)

现在只能自己本机加机器人自娱自乐了,好怀念以前

201724 发表于 2020-3-3 11:17:45

dongtianbao 发表于 2020-3-3 10:43
201724前方高能,如何修改插件判断,让击中PODBOT不当机,(用Yapb就不会当机)

现在只能自己本机加机器 ...


//player
if(id > 0 && id < get_maxplayers())
{
}

zhangsheng 发表于 2020-3-3 16:29:06

试试这个版本的飞刀插件,切换刀按G就可以扔飞刀了。

dongtianbao 发表于 2020-3-4 02:01:03

201724 发表于 2020-3-3 11:17
//player
if(id > 0 && id < get_maxplayers())
{


                        else if (movetype != 0) {
                                if(owner == pTouched) return

                                remove_entity(pToucher)

                                if(get_cvar_num("mp_friendlyfire") == 0 && get_user_team(pTouched) == get_user_team(owner))

return

                                new pTdead
                                entity_set_float(pTouched, EV_FL_dmg_take, get_cvar_num("amx_knifedmg") * 1.0)

                                if((get_user_health(pTouched) - get_cvar_num("amx_knifedmg")) <= 0) {
                                        pTdead = 1
                                }
//player
if(id > 0 && id < get_maxplayers())
{
}

201724 发表于 2020-3-4 10:45:13

dongtianbao 发表于 2020-3-4 02:01
else if (movetype != 0) {
                                if(owner == pTouched) return



pToucher

dongtianbao 发表于 2020-3-4 11:21:36

201724 发表于 2020-3-4 10:45
pToucher

汗,不知道加到哪一行

201724 发表于 2020-3-4 11:25:32

dongtianbao 发表于 2020-3-4 11:21
汗,不知道加到哪一行



L 02/21/2020 - 22:18:27: Start of error session.
L 02/21/2020 - 22:18:27: Info (map "awp_map_32") (file "addons/amxmodx/logs/error_20200221.log")
L 02/21/2020 - 22:18:27: Invalid entity 117
L 02/21/2020 - 22:18:27: Run time error 10 (plugin "throwing_knives.amxx") (native "entity_get_string") - debug not enabled!
L 02/21/2020 - 22:18:27: To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).


public vexd_pfntouch(pToucher, pTouched) {

      if(!get_cvar_num("amx_throwknives"))
                return PLUGIN_CONTINUE

       if(!(pToucher > 0 && pToucher < get_maxplayers()))
                return PLUGIN_CONTINUE

      new Classname
      entity_get_string(pToucher, EV_SZ_classname, Classname, 31)
      new owner = entity_get_edict(pToucher, EV_ENT_owner)
      new Float:kOrigin
      entity_get_vector(pToucher, EV_VEC_origin, kOrigin)

      if(equal(Classname,"knife_pickup")) {
                check_cvars()
                new Class2
                entity_get_string(pTouched, EV_SZ_classname, Class2, 31)
                if(!equal(Class2,"player") || knifeammo >= get_cvar_num("amx_maxknifeammo"))
                        return PLUGIN_CONTINUE

                if((knifeammo + holdammo) > get_cvar_num("amx_maxknifeammo")) {
                        holdammo -= get_cvar_num("amx_maxknifeammo") - knifeammo
                        knifeammo = get_cvar_num("amx_maxknifeammo")
                        emit_sound(pToucher, CHAN_ITEM, "weapons/knife_deploy1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
                }
                else {
                        knifeammo += holdammo
                        emit_sound(pToucher, CHAN_ITEM, "weapons/knife_deploy1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
                        remove_entity(pToucher)
                }
                client_print(pTouched, print_center,"You have %i knives",knifeammo)
      }

dongtianbao 发表于 2020-3-4 12:31:58

本帖最后由 dongtianbao 于 2020-3-4 12:35 编辑

201724 发表于 2020-3-4 11:25
L 02/21/2020 - 22:18:27: Start of error session.
L 02/21/2020 - 22:18:27: Info (map "awp_map_32" ...

可以编译了,就是有5个警告,进去测试一下,发现击中机器人不当机了,但是打不死机器人了{:6_180:}
页: [1] 2
查看完整版本: 飞刀击中机器人就挂机