PDA

View Full Version : Change player size


.Dare Devil.
05-25-2013, 10:36
Hello, i saw somewhere that this is impossible but there are many things what should be impossible but are possible now with some trick.

Anyway here is code:

public plugin_init() register_forward(FM_SetAbsBox,"i_sizeupdate")
public i_sizeupdate(id)
{
static Float:a[3], Float:b[3]
if(id == 1 ) // its me :)
{
a[0] = -5.0; a[1] = -5.0; a[2] = -10.0;
b[0] = 5.0; b[1] = 5.0; b[2] = 10.0;
engfunc(EngFunc_SetSize,id,a,b)

set_pev(id,pev_mins,a)
set_pev(id,pev_maxs,b)
set_pev(id,pev_absmin,a)
set_pev(id,pev_absmax,b)
dllfunc(DLLFunc_SetAbsBox,id)
}
}


Anyway the game will crash just after game has starded ( I can also see my map for a sec :) )
What is the problem or what i am doing here anyway?
I dont understand it at all, i found this somewhere in this forum.

And as always, thanks!

11922911
05-25-2013, 11:51
Good to see this thread, i also want to make something like this.
It would be really cool If someone can make it possible.

liran530
05-25-2013, 13:49
i think because the model is big the players cant to see the player in small i think you need to create special model to this option i only think i dont sure but this can to be the answer

sorry for my bad english if you dont understand me i say to you what i am think with google translate

bcKq
05-25-2013, 19:08
public plugin_init() register_forward(FM_SetAbsBox,"i_sizeupdate")
public i_sizeupdate(id)
{
if(!is_user_alive(id) || !is_user_connected(id)) return PLUGIN_CONTINUE;

static Float:a[3], Float:b[3]
if(id == 1 ) // its me :)
{
a[0] = -5.0; a[1] = -5.0; a[2] = -10.0;
b[0] = 5.0; b[1] = 5.0; b[2] = 10.0;
engfunc(EngFunc_SetSize,id,a,b)

set_pev(id,pev_mins,a)
set_pev(id,pev_maxs,b)
set_pev(id,pev_absmin,a)
set_pev(id,pev_absmax,b)
dllfunc(DLLFunc_SetAbsBox,id)
}
}

Maybe Baby

ConnorMcLeod
05-25-2013, 19:25
Why don't you supercede ?

.Dare Devil.
05-26-2013, 04:58
Why don't you supercede ?
Wont help it. still same situation.

ConnorMcLeod
05-26-2013, 05:56
Only thing i've managed to do is following code, unfortunately it has no effect, can see wanted sizes in server_frame and PreThink, but collisions remain the same as default.
Anyway, if someone find a way, there are still lot of places where values are hardcoded, see SetupVisibility in client.cll for example.

#include < amxmodx >

// #include < amxmisc >
// #include < xs >
// #include < hlsdk_const >

#include < engine >
// #include < engine_stocks >
#include < fakemeta >
// #include < fakemeta_stocks >
#include < hamsandwich >
// #include < cstrike >
// #include < fun >
// #include < csx >

#pragma semicolon 1

#define PLUGIN ""
#define VERSION "0.0.1"

#define VECTOR_PRINT_ARGS(%0) %0[0] , %0[1] , %0[2]


new const Float:our_VEC_DUCK_HULL_MIN[3] = {-2.0, -2.0, -2.0 };
new const Float:our_VEC_DUCK_HULL_MAX[3] = { 2.0, 2.0, 2.0 };
new const Float:our_VEC_DUCK_VIEW[3] = { 0.0, 0.0, 12.0 };

new const Float:our_VEC_HULL_MIN[3] = {-1.0, -1.0, -1.0 };
new const Float:our_VEC_HULL_MAX[3] = { 1.0, 1.0, 1.0 };
new const Float:our_VEC_VIEW[3] = { 0.0, 0.0, 18.0 };

new HamHook:g_iHhPlr_SetObjectCollisionBox;

new g_iMaxPlayers;
#define IsPlayer(%0) ( 1 <= (%0) <= g_iMaxPlayers )

public plugin_init()
{
register_plugin( PLUGIN, VERSION, "ConnorMcLeod" );

RegisterHam(Ham_SetObjectCollisionBox, "player", "OnCBP_SetObjectCollisionBox", false);
// register_forward(FM_SetSize, "OnSetSize");

g_iMaxPlayers = get_maxplayers();
}

public OnCBP_SetObjectCollisionBox( id )
{
if( is_user_alive(id) )
{
if( pev(id, pev_flags) & FL_DUCKING )
{
set_pev(id, pev_mins, our_VEC_DUCK_HULL_MIN);
set_pev(id, pev_maxs, our_VEC_DUCK_HULL_MAX);
}
else
{
set_pev(id, pev_mins, our_VEC_HULL_MIN);
set_pev(id, pev_maxs, our_VEC_HULL_MAX);
}

return HAM_HANDLED;
}
return HAM_IGNORED;
}

public OnSetSize( id )
{
if( IsPlayer(id) && is_user_alive(id) )
{
DisableHamForward(g_iHhPlr_SetObjectCollision Box);
if( pev(id, pev_flags) & FL_DUCKING )
{
engfunc(EngFunc_SetSize, id, our_VEC_DUCK_HULL_MIN, our_VEC_DUCK_HULL_MAX);
// set_pev(id, pev_view_ofs, our_VEC_DUCK_VIEW);
}
else
{
engfunc(EngFunc_SetSize, id, our_VEC_HULL_MIN, our_VEC_HULL_MAX);
// set_pev(id, pev_view_ofs, our_VEC_VIEW);
}
EnableHamForward(g_iHhPlr_SetObjectCollisionB ox);
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}

public server_frame()
{
static const id = 1;
if( is_user_alive(id) )
{
static Float:maxs[3];
pev(id, pev_maxs, maxs);
server_print("%.1f %.1f %.1f server_frame", VECTOR_PRINT_ARGS(maxs));
}
}

public client_PreThink(id)
{
if( is_user_alive(id) )
{
static Float:maxs[3];
pev(id, pev_maxs, maxs);
server_print("%.1f %.1f %.1f client_PreThink", VECTOR_PRINT_ARGS(maxs));
}
}


Also, when sending SetSize in SetObjectCollisionBox (or AbsBox, that one calls the other one), server is crashing (infinite loop i would say), that's because SetSize calls AbsBox, but even trying to disable the hook (with bool variable or using DisableHamForward) to get rid of recursivity, server is crashing.
Have no other idea.

Also, hooking SetSize seems to only takes effect when crouched.