Raised This Month: $51 Target: $400
 12% 

Solved GetEntPropVector unable to work with 'vector' netprop?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 11-29-2019 , 01:35   GetEntPropVector unable to work with 'vector' netprop?
Reply With Quote #1

RE-EDIT: Oh my god, I'm completely dumb. I put in the size of the vector as an element.
EDIT: Thanks to BHaType for solving a small problem + asherkin for explaining m_vecMins and m_vecMaxs.

Here's some code but I doubt anyone needs it now:
PHP Code:
void SpawnFirstAidKit(int entity)
{
    if (!
IsValidEntity(entity)) return;
    
float fPos[3];
    
float fAng[3];
    
GetEntPropVector(entityProp_Send"m_vecOrigin"fPossizeof(fPos));
    
GetEntPropVector(entityProp_Send"m_angRotation"fAngsizeof(fAng));
    
    
int first_aid_kit CreateEntityByName("weapon_first_aid_kit_spawn");
    
TeleportEntity(first_aid_kitfPosfAngNULL_VECTOR);
    
DispatchKeyValue(first_aid_kit"model""models/w_models/weapons/w_eq_medkit.mdl");
    
DispatchKeyValue(first_aid_kit"spawnflags""3");
    
DispatchSpawn(first_aid_kit);
    
ActivateEntity(first_aid_kit);
}

void TestFunc(int entity)
{
    
float vecMins[3];
    
float vecMaxs[3];
    
float fPos[3];
    
float fAng[3];
    
GetEntPropVector(entityProp_Send"m_vecOrigin"fPossizeof(fPos));
    
GetEntPropVector(entityProp_Send"m_angRotation"fAngsizeof(fAng));
    
    
int commentary_dummy CreateEntityByName("commentary_dummy");
    
TeleportEntity(first_aid_kitfPosfAngNULL_VECTOR);
    
DispatchKeyValue(commentary_dummy"model""models/survivors/survivor_gambler.mdl");
    
GetEntPropVector(commentary_dummyProp_Send"m_vecMins"vecMinssizeof(vecMins));
    
GetEntPropVector(commentary_dummyProp_Send"m_vecMaxs"vecMaxssizeof(vecMaxs));
    
DispatchSpawn(commentary_dummy);
    
ActivateEntity(commentary_dummy);

__________________
ragdoll spam, that is all

Steam profile, where I game, obviously.
Youtube channel, where I do Stick Death Maze animations and some other stuff.
no plugin requests, sorry


My Plugins:
-search list-
Modified Plugins:
1 | 2 | 3 | 4

Last edited by Shadowysn; 12-20-2019 at 04:22.
Shadowysn is offline
BHaType
Great Tester of Whatever
Join Date: Jun 2018
Old 11-29-2019 , 01:38   Re: GetEntPropVector unable to work with 'vector' that only has 2 elements?
Reply With Quote #2

Quote:
Originally Posted by Shadowysn View Post
Also, how do you set a vector on SetEntPropVector without creating a float vector[3]? Am I doing it right?
PHP Code:
SetEntPropVector(entityProp_Send"m_vecMins", {-16, -160}); 
PHP Code:
view_as<float>({0.00.00.0}) 
__________________
cry
BHaType is offline
Send a message via AIM to BHaType
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 12-19-2019 , 06:31   Re: GetEntPropVector unable to work with 'vector' netprop that only has 2 elements?
Reply With Quote #3

A "vector" type property always has 3 elements, and the ones in m_Collision there are not arrays, just 2 single vector props.

Looking at the SM code, I think the only way to get the error you're hitting is if you're passing something non-0 as the offset param to GetEntPropVector - but it is hard to tell as you haven't included your code.

The correct usage would look something like:
Code:
	float mins[3];
	GetEntPropVector(entity, Prop_Send, "m_vecMins", mins);
	PrintToServer("[%.2f %.2f %.2f]", mins[0], mins[1], mins[2]);
__________________

Last edited by asherkin; 12-19-2019 at 06:32.
asherkin 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 06:37.


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