Raised This Month: $32 Target: $400
 8% 

MOVETYPE_FOLLOW + Origins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 05-24-2019 , 08:07   MOVETYPE_FOLLOW + Origins
Reply With Quote #1

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
}

Last edited by raizo11; 11-09-2019 at 22:44.
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 11-09-2019 , 22:44   Re: MOVETYPE_FOLLOW + Origins
Reply With Quote #2

bump!
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
iNvectus
Member
Join Date: Sep 2014
Location: Bulgaria
Old 11-10-2019 , 05:17   Re: MOVETYPE_FOLLOW + Origins
Reply With Quote #3

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.

Last edited by iNvectus; 11-10-2019 at 05:18.
iNvectus is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 11-12-2019 , 16:40   Re: MOVETYPE_FOLLOW + Origins
Reply With Quote #4

By the way we do not support slowhacking in this forum.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
JocAnis
Veteran Member
Join Date: Jun 2010
Old 11-12-2019 , 20:34   Re: MOVETYPE_FOLLOW + Origins
Reply With Quote #5

Quote:
Originally Posted by iceeedr View Post
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
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:08.


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