View Single Post
Author Message
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-27-2018 , 09:23   [INC] Message Stocks
Reply With Quote #1


This .inc file contains a bunch of functions that will make your life easier. The goal of it is to make the usage of message_begin functions a piece of cake, especially the SVC_TEMPENTITY ones.

Instead of having to do all of this just to create a single beam:

PHP Code:
new iStartPos[3], iEndPos[3];
get_user_origin(idiStartPos);
get_user_origin(idiEndPos3);

message_begin(MSG_ALLSVC_TEMPENTITY);
write_byte(TE_BEAMPOINTS);
write_coord(iStartPos[0]);
write_coord(iStartPos[1]);
write_coord(iStartPos[2]);
write_coord(iEndPos[0]);
write_coord(iEndPos[1]);
write_coord(iEndPos[2]);
write_short(g_iSprite);
write_byte(0);
write_byte(30);
write_byte(10);
write_byte(10);
write_byte(0);
write_byte(0);
write_byte(0);
write_byte(255);
write_byte(75);
write_byte(0);
message_end(); 
With using this library, we can do it as simple as this:

PHP Code:
new iStartPos[3], iEndPos[3];
get_user_origin(idiStartPos);
get_user_origin(idiEndPos3);

te_create_beam_between_points(iStartPosiEndPosg_iSprite
This saves a lot of time that you would spend searching for the write_ arguments, experimenting with the numbers and having to write all 20 arguments 1 by 1 and having a huge chance of messing some of them up.

Only the mandatory arguments in the stocks are required (e.g. starting position, sprite index, etc) and all other ones have a default value and are optional.

All of the stocks share 2 same arguments - receiver and bool:reliable - both optional and the second one is always the last argument in the natives. The first one controls who will see the message and the second one controls whether or not to use the reliable channel. With this being said, if receiver is set to 0 and reliable is true, the stock will use MSG_ALL as the message destination.

__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom