Raised This Month: $ Target: $400
 0% 

Solved [ H3LP ] Enum vectors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-05-2018 , 14:24   [ H3LP ] Enum vectors
Reply With Quote #1

Hello, I'm getting compilation error when I do this (array sizes do not match, or destination array is too small)

Code:
enum _:eVectors {     Float:ORIGIN[3],     Float:ANGLES[3], }; public something(pPlayer) {     new stVector[eVectors];     ArrayGetArray(g_arrSpawns, random(ArraySize(g_arrSpawns)), stVector);     entity_set_vector(pPlayer, EV_VEC_origin, stVector[ORIGIN]);     entity_set_vector(pPlayer, EV_VEC_origin, stVector[ANGLES]); }

I know I can simply do this:

Code:
enum _:eVectors {     Float:ORIGIN[3],     Float:ANGLES[3], }; public something(pPlayer) {     new stVector[eVectors], Float:vecOrigin[3], Float:vecAngles[3];     ArrayGetArray(g_arrSpawns, random(ArraySize(g_arrSpawns)), stVector);     vecOrigin[0] = stVector[ORIGIN][0];     vecOrigin[1] = stVector[ORIGIN][1];     vecOrigin[2] = stVector[ORIGIN][2];     vecAngles[0] = stVector[ANGLES][0];     vecAngles[1] = stVector[ANGLES][1];     vecAngles[2] = stVector[ANGLES][2];     entity_set_vector(pPlayer, EV_VEC_origin, vecOrigin);     entity_set_vector(pPlayer, EV_VEC_origin, vecAngles); }

But I want to know if it's possible to do WITHOUT create another two vectors and add to them.
__________________









Last edited by CrazY.; 06-06-2018 at 19:54.
CrazY. is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-05-2018 , 17:40   Re: [ H3LP ] Enum vectors
Reply With Quote #2

Code:
enum _:eVectors
{
    Float:ORIGIN[3],
    Float:ANGLES[3],
};
Extra comma.

Whats wrong with using xs include file
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 06-05-2018 at 17:47.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-05-2018 , 20:26   Re: [ H3LP ] Enum vectors
Reply With Quote #3

No, extra comma is not the problem here. No one problem, it's just a question.
__________________








CrazY. is offline
Garey
Member
Join Date: Feb 2008
Location: Russian Federation
Old 06-06-2018 , 16:58   Re: [ H3LP ] Enum vectors
Reply With Quote #4

I had same issue with Pawn, and i had 2 ways to solve this:
Code:
enum eVec3d
{
    ORIGIN,
    ANGLES
};

public something(pPlayer)
{
    new Float:stVector[eVec3d][3];
    entity_set_vector(pPlayer, EV_VEC_origin, stVector[ORIGIN]);
    entity_set_vector(pPlayer, EV_VEC_angles, stVector[ANGLES]);
}
and with temp var as you but use xs_vec_copy (to not assign one by one)
__________________
Sorry for my bad english
Garey is offline
Send a message via ICQ to Garey
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-06-2018 , 19:54   Re: [ H3LP ] Enum vectors
Reply With Quote #5

The first method is what I'm looking for, thanks.
__________________








CrazY. is offline
Reply


Thread Tools
Display Modes

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 04:33.


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