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

Solved [Help] sizeof Array (iOrigins)


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-05-2018 , 16:00   Re: [Help] sizeof Array (iOrigins)
Reply With Quote #11

Yeah you have 2 for loops using sizeof, my statement applied to only the nested loop, my fault for not pointing that out
__________________

Last edited by Bugsy; 10-05-2018 at 16:00.
Bugsy is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-05-2018 , 16:05   Re: [Help] sizeof Array (iOrigins)
Reply With Quote #12

I was not pointing directly for that, and yes about TE_DLIGHT parameters. It has only three coords

Quote:
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
In the loop, he was calling write_coord the same size of data in iX, and then write_coord for y axis and more one write_coord for z axis.
__________________









Last edited by CrazY.; 10-05-2018 at 16:07.
CrazY. is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 10-05-2018 , 16:08   Re: [Help] sizeof Array (iOrigins)
Reply With Quote #13

Quote:
Originally Posted by CrazY. View Post
This doesn't make any sense to me. You're going to crash your server at this point. If you want to set a random x axis, iX[random(sizeof iX)), otherwise, I didn't got what you're trying to do.
I just want to clarify two methods you have used for that, Who said I wanted it random?

P.S:
I tried last solution but the server droped me out!
i get in consol :
Quote:
CL_SignonReply: 2
Last 32 messages parsed.
377342 0016 svc_deltapacketentities
377342 0022 svc_temp_entity
377342 0036 svc_temp_entity
377346 0008 svc_lightstyle
377346 0012 svc_time
377346 0017 svc_clientdata
377346 0020 svc_deltapacketentities
377346 0026 svc_temp_entity
377346 0040 svc_temp_entity
377352 0008 svc_time
377352 0013 svc_clientdata
377352 0016 svc_deltapacketentities
377356 0008 svc_time
377356 0013 svc_clientdata

377356 0016 svc_deltapacketentities
377356 0034 svc_temp_entity
377356 0048 svc_temp_entity
377356 0062 svc_temp_entity
377356 0076 svc_temp_entity
377361 0008 svc_time
377361 0013 svc_clientdata
377361 0016 svc_deltapacketentities
377361 0022 svc_temp_entity
377363 0008 svc_time
377363 0013 svc_clientdata
377363 0026 svc_deltapacketentities
377363 0044 svc_temp_entity
377363 0008 svc_time
377363 0013 svc_clientdata
377363 0026 svc_deltapacketentities
377363 0044 svc_temp_entity
BAD: 58:svc_bad

Wrote erroneous message to buffer.dat
Host_Error: UserMsg: Not Present on Client 160

Netchan_Clear() : reliable length not 0, reliable_sequence: 9, incoming_reliable_acknowledged: 1
__________________

Last edited by abdobiskra; 10-05-2018 at 16:22.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-05-2018 , 16:20   Re: [Help] sizeof Array (iOrigins)
Reply With Quote #14

That's why I said at end, "otherwise, I didn't got what you're trying to do.", no?
__________________








CrazY. is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 10-05-2018 , 16:24   Re: [Help] sizeof Array (iOrigins)
Reply With Quote #15

Quote:
Originally Posted by CrazY. View Post
That's why I said at end, "otherwise, I didn't got what you're trying to do.", no?
I want make all coordinates arranged ^^
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-05-2018 , 17:42   Re: [Help] sizeof Array (iOrigins)
Reply With Quote #16

This is not that confusing, what I posted here is enough to store your origins and RGB colors in an organized way.

PHP Code:

new Origins[][] = 
{
    { 
111 222 333 },
    { 
444 555 666 },
    { 
777 888 999 }
};

//The first 0 in all 3 values can be a range between 0 and 2 (or however many origins you loaded)
write_coordOrigins][ ] );
write_coordOrigins][ ] );
write_coordOrigins][ ] );

new 
RGBColors[][] = 
{
    { 
111 222 123 },
    { 
25 55 },
    { 
}
};

//The first 0 in all 3 values can be a range between 0 and 2 (or however many origins you loaded)
write_byteRGBColors][ ] );  //r
write_byteRGBColors][ ] );  //g
write_byteRGBColors][ ] );  //b 
__________________
Bugsy is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 10-06-2018 , 10:13   Re: [Help] sizeof Array (iOrigins)
Reply With Quote #17

@Bugsy
still, the server drop me .
PHP Code:
#include <amxmodx>
#include <amxmisc>

enum
{
    
x,
    
y,
    
z
}

new const 
iOrigin[][]= {
    
    {
160, -544, -465810, -22},//iX
    
20820811201120, -1584, -2240, -356 },//iY
    
{ -1392, -1392, -1392, -1392, -1560, -1744, -1540 //iZ
}

public 
plugin_init() {
    
set_task(5.0"create_light")
}

public 
create_light()
{
    
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    
write_byte(TE_DLIGHT);
    for(new 
i=0;i<sizeof(iOrigin[]);i++)
    {
        
write_coord(iOrigin[x][i]);
    }
    for(new 
i=0;i<sizeof(iOrigin[]);i++)
    {
        
write_coord(iOrigin[y][i]);
    }
    for(new 
i=0;i<sizeof(iOrigin[]);i++)
    {
        
write_coord(iOrigin[z][i]);
    }
    
write_byte(30);  //radiis
    
write_byte(255);//r
    
write_byte(0);  //g
    
write_byte(0);  //b
    
write_byte(15); // life 
    
write_byte(20); // decay rate
    
message_end();
    
    
set_task(5.0"create_light")

__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-06-2018 , 10:24   Re: [Help] sizeof Array (iOrigins)
Reply With Quote #18

Quote:
Originally Posted by abdobiskra View Post
@Bugsy
still, the server drop me .
This is what you are doing with your arrays. You have them set up incorrectly.
PHP Code:
public create_light()
{
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    
write_byte(TE_DLIGHT);
    
    
//for(new i=0;i<sizeof(iOrigin[]);i++)
    //{
        
write_coord(160);
        
write_coord(-544);
        
write_coord(465);
        
write_coord(81);
        
write_coord(0);
        
write_coord(-2);
        
write_coord(2);
    
//}
    
    //for(new i=0;i<sizeof(iOrigin[]);i++)
    //{
        
write_coord(208);
        
write_coord(208);
        
write_coord(1120);
        
write_coord(1120);
        
write_coord(-1584);
        
write_coord(-2240);
        
write_coord(-357);
    
//}
    //for(new i=0;i<sizeof(iOrigin[]);i++)
    //{
        
write_coord(-1392);
        
write_coord(-1392);
        
write_coord(-1392);
        
write_coord(-1392);
        
write_coord(-1560);
        
write_coord(-1744);
        
write_coord(-1540);
    
//}
    
    
write_byte(30);  //radiis
    
write_byte(255);//r
    
write_byte(0);  //g
    
write_byte(0);  //b
    
write_byte(15); // life 
    
write_byte(20); // decay rate
    
message_end();
    
    
set_task(5.0"create_light")

__________________
Bugsy is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 10-06-2018 , 10:28   Re: [Help] sizeof Array (iOrigins)
Reply With Quote #19

Yes I would point out that
I think it will be so but the same problem remains
Code:
    for(new i=0;i<sizeof(iOrigin[]);i++)     {         write_coord(iOrigin[x][i]);         write_coord(iOrigin[y][i]);         write_coord(iOrigin[z][i]);     }
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-06-2018 , 10:29   Re: [Help] sizeof Array (iOrigins)
Reply With Quote #20

Quote:
Originally Posted by abdobiskra View Post
Yes I would point out that
I think it will be so but the same problem remains
Code:
    for(new i=0;i<sizeof(iOrigin[]);i++)     {         write_coord(iOrigin[x][i]);         write_coord(iOrigin[y][i]);         write_coord(iOrigin[z][i]);     }
Doesn't the message only want 1 origin? You are sending way too much information.

Try this:
PHP Code:
enum
{
    
x,
    
y,
    
z
}

new const 
iOrigin[][] = 
{
    {  
160 208 , -1392  },
    { -
544 208 ,  -1392 },
    { -
465 1120 , -1392 },
    { 
81 1120 , -1392 },
    { 
, -1584 , -1560 },
    { -
, -240 , -1744 },
    { 
, -356 , -1540 }
}

public 
create_light()
{
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    
    
write_byte(TE_DLIGHT);
    
    
write_coordiOrigin][ ] );
    
write_coordiOrigin][ ] );
    
write_coordiOrigin][ ] );
    
    
write_byte(30);  //radiis
    
write_byte(255);//r
    
write_byte(0);  //g
    
write_byte(0);  //b
    
write_byte(15); // life 
    
write_byte(20); // decay rate
    
message_end();
    
    
set_task(5.0"create_light")

__________________
Bugsy 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:48.


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