AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   MOVETYPE_FOLLOW + Origins (https://forums.alliedmods.net/showthread.php?t=316460)

raizo11 05-24-2019 08:07

MOVETYPE_FOLLOW + Origins
 
How to set the entity origin in front of player if i use MOVETYPE_FOLLOW ?

Any example?

Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
#include <fakemeta>
#include <hamsandwich>

#pragma tabsize 0
#pragma compress 1

#define BOT_RENAME 64

new bot, user

new const DEFAULT_NAMES[][] =
{
        "Knife",
        "Romania",
        "Albastrel"
};

public plugin_init()
{
    register_concmd("amx_target","test",ADMIN_KICK,"<user> - player")
}

bot_settings(id)
{
        set_user_info(id, "bottomcolor", "6");
        set_user_info(id, "model", "gordon");
        set_user_info(id, "rate", "8000");
        set_user_info(id, "cl_updaterate", "45");
        set_user_info(id, "cl_lw", "1");
        set_user_info(id, "cl_lc", "1");
        set_user_info(id, "cl_dlmax", "128");
        set_user_info(id, "_ah", "0");
        set_user_info(id, "_cl_autowepswitch", "1");
        set_user_info(id, "_vgui_menus", "0");
}

public test(id,level,cid)
{
    if(!cmd_access(id,level,cid,2))
    {
        return PLUGIN_HANDLED
    }
   
    new name[ 50 ];
    read_argv( 1, name, 49 );

    user = cmd_target( id, name, CMDTARGET_ALLOW_SELF );

    bot = engfunc(EngFunc_CreateFakeClient, DEFAULT_NAMES);
       
    if(!bot)
    {
        return PLUGIN_HANDLED;
    }

    engfunc(EngFunc_FreeEntPrivateData, bot);
    dllfunc(MetaFunc_CallGameEntity, "player", bot);
    bot_settings(bot);

        new reject_reason[128];
        dllfunc(DLLFunc_ClientConnect, bot, DEFAULT_NAMES, "127.0.0.1", reject_reason);
       
    if(!is_user_connected(bot))
    {
        return PLUGIN_HANDLED;
    }

    dllfunc(DLLFunc_ClientPutInServer, bot);
       
    set_pev(bot, pev_health, 100.0);
    set_pev(bot, pev_solid, SOLID_SLIDEBOX);
    set_pev(bot, pev_takedamage, DAMAGE_NO);

    if(get_user_team(user) == 1)
    {
        cs_set_user_team(bot, CS_TEAM_CT, CS_CT_GIGN);
    }
    else if(get_user_team(user) == 2)
    {
        cs_set_user_team(bot, CS_TEAM_T, CS_T_TERROR);
    }

    ExecuteHamB(Ham_CS_RoundRespawn, bot);

    set_user_godmode(bot,1)
    engfunc(EngFunc_SetOrigin, bot, Float:{ 265.0, -1105.0, -683.0 });
    set_user_rendering(bot, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0);

    static rename = 0;
    if(!(++rename % BOT_RENAME))
    {
        bot_rename();
    }

    if(is_user_alive(user))
    {
        entity_set_int(bot, EV_INT_movetype, MOVETYPE_FOLLOW) 
        entity_set_edict(bot, EV_ENT_aiment, user)
    }
 
    return PLUGIN_HANDLED
}

bot_rename()
{
        #if sizeof(DEFAULT_NAMES) > 1
        static last;
        new new_name;
        while(last == (new_name = random(sizeof(DEFAULT_NAMES)))){}
        set_user_info(bot, "name", DEFAULT_NAMES[new_name]);
        last = new_name;
        #endif
}


raizo11 11-09-2019 22:44

Re: MOVETYPE_FOLLOW + Origins
 
bump!

iNvectus 11-10-2019 05:17

Re: MOVETYPE_FOLLOW + Origins
 
You could probably just use pev_chain to parent entity before setting movetype_follow. The child entity will copy origin, angles, etc. from the parent entity. Then you can change it through entity_set_origin. Or you can use pev_aiment.

iceeedr 11-12-2019 16:40

Re: MOVETYPE_FOLLOW + Origins
 
By the way we do not support slowhacking in this forum.

JocAnis 11-12-2019 20:34

Re: MOVETYPE_FOLLOW + Origins
 
Quote:

Originally Posted by iceeedr (Post 2672753)
By the way we do not support slowhacking in this forum.

where he violated it?
Code:

set_user_info(bot, "name"
maybe you want to protect bots? :p


All times are GMT -4. The time now is 20:38.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.