AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ Solved ] message_begin , write_byte ... (https://forums.alliedmods.net/showthread.php?t=188249)

Aooka 06-24-2012 06:40

[ Solved ] message_begin , write_byte ...
 
I did not comment everything that I do not understand otherwise I would comment on each line (lol)

What's the useful to do this ?

Code:
make_ScreenFade(client,duration,holdtime,flags,r,g,b,a) // What is that ? {     message_begin(MSG_ONE,ScreenFade,_,client);     write_short(duration); // duration ?     write_short(holdtime); // holdtime ?     write_short(flags); // Flags ?     write_byte(r); // r ?     write_byte(g); // g ?     write_byte(b); // b = blue ? Why ?     write_byte(a); // a ?     message_end(); }


And what's the useful to do this too ?

Code:
public beacon(id) // What is that ? Why beacon ? lol {     if(cs_get_user_team(id) == CS_TEAM_CT)     {         static origin[3]         get_user_origin(id,origin)         message_begin(MSG_BROADCAST,SVC_TEMPENTITY) // ?         write_byte(TE_BEAMCYLINDER)         write_coord(origin[0])         write_coord(origin[1])         write_coord(origin[2]-20) // Why -20 for the origin[2] ?         write_coord(origin[0])         write_coord(origin[1])         write_coord(origin[2]+200)         write_short(beacon_sprite) // Sprite ?         write_byte(0)         write_byte(1) // Why 1 and not 100000 ?         write_byte(6)         write_byte(2) // And 2 here ?         write_byte(1)           write_byte(0) // And why we do not set write_byte(0) before write_byte(6) for example ?         write_byte(0)         write_byte(250) // And 250 ?         write_byte(200)         write_byte(0) // Why 0 ?         message_end()     }     else     {         static origin[3]         get_user_origin(id,origin)         message_begin(MSG_BROADCAST,SVC_TEMPENTITY)         write_byte(TE_BEAMCYLINDER)         write_coord(origin[0])         write_coord(origin[1])         write_coord(origin[2]-20)         write_coord(origin[0])         write_coord(origin[1])         write_coord(origin[2]+200)         write_short(beacon_sprite)         write_byte(0)           write_byte(1)         write_byte(6)         write_byte(2)         write_byte(1)         write_byte(250)         write_byte(0)         write_byte(0)         write_byte(200)         write_byte(0)         message_end()     }     set_task(1.0,"beacon",id) // Why a task here ? }


I've read and read a lots the funcwiki but I'm completely lost from there. Can someone help me please ? :D

Thanks :D It's very important for me to understand that certainly :D

Ps: I read http://www.amxmodx.org/funcwiki.php?go=func&id=262 , http://www.amxmodx.org/funcwiki.php?go=func&id=264 ... and others

Arkshine 06-24-2012 06:45

Re: [ Request ] message_begin , write_byte ...
 
Check the wiki : http://wiki.amxmodx.org/Half-Life_1_Game_Events

Aooka 06-24-2012 07:56

Re: [ Request ] message_begin , write_byte ...
 
I go look this. Thank you. :)

Aooka 06-27-2012 07:00

Re: [ Request ] message_begin , write_byte ...
 
I read it a long time and i do not undertand how it's working.

Code:
#include < amxmodx > public plugin_init( ) {     register_clcmd( "say /menu" , "CmdMenu" );         new const iMenu = menu_create( "My new menu" , "Handler_Menu" );     menu_additem( iMenu , "Test 1" , "1" , 0 );     menu_additem( iMenu , "Test 2" , "2" , 0 );     menu_additem( iMenu , "Test 3" , "3" , 0 ); } public CmdMenu( id ) {     if( !is_user_alive( id ) )         return 1;             else         menu_display( id , iMenu , 0 ); } /*     public myfunction( ... )     {         And here i whant to use it to custom my menu : <a href="http://wiki.amxmodx.org/Half-Life_1_Game_Events#ShowMenu" target="_blank" rel="nofollow noopener">http://wiki.amxmodx.org/Half-Life_1_...vents#ShowMenu</a>         But i really do not understand ... So if someone can do that it will be very helpfull for me ! Thanks all     } */

Or if it's not possible with that http://wiki.amxmodx.org/Half-Life_1_...vents#Scenario or http://wiki.amxmodx.org/Half-Life_1_Game_Events#Radar

Thank you in advance ! I look a lot's of plugin but it do not help me.

Arkshine 06-27-2012 07:10

Re: [ Request ] message_begin , write_byte ...
 
If you want to learn how to build menus, read the existing tutorials..

Aooka 06-27-2012 07:25

Re: [ Request ] message_begin , write_byte ...
 
I know how to build a menu but not with (http://forums.alliedmods.net/showthr...4#MenuCallback)
Code:
write_byte( .. )
for example

hornet 06-27-2012 07:56

Re: [ Request ] message_begin , write_byte ...
 
In relation to your first post, bytes must be sent in a certain order because they are read in a certain order.

The second piece of code you posted is a popular function used for Jailbreak ( Last Request - to show a coloured ring around the competing players ), it is, however, inefficient, the team check should only be used to determine the sprite colour bytes through a switch statement, rather than having an else and all the bytes written out again.

Aooka 06-27-2012 08:15

Re: [ Request ] message_begin , write_byte ...
 
yes thanks a lot but I would like to use this but I do not have the opportunity...

I do not know what to do as a code to use this...

<VeCo> 06-27-2012 08:25

Re: [ Request ] message_begin , write_byte ...
 
Make menus with the existing natives, not with messages.

Aooka 06-27-2012 08:31

Re: [ Request ] message_begin , write_byte ...
 
what do you mean by "existing natives" ?


All times are GMT -4. The time now is 06:17.

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