AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How do I convert a BYTE array to LONG in AMXX? (https://forums.alliedmods.net/showthread.php?t=226366)

11922911 09-16-2013 23:24

How do I convert a BYTE array to LONG in AMXX?
 
If anyone know that, please give me some example.
thanks in advance.

ConnorMcLeod 09-17-2013 00:21

Re: How do I convert a BYTE array to LONG in AMXX?
 
Add bytes together displacing them 1 by 1 ?

PHP Code:

longVariable byte0 byte1<<byte2<<16 byte3<<24 

PHP Code:

    new bytes_array[4 char], longVariable;

    
longVariable bytes_array[0] | bytes_array[1]<<bytes_array[2]<<16 bytes_array[3]<<24


PHP Code:

    new bytes_array[4 char], longVariable;

    
longVariable bytes_array[3] | bytes_array[2]<<bytes_array[1]<<16 bytes_array[0]<<24


jimaway 09-17-2013 05:59

Re: How do I convert a BYTE array to LONG in AMXX?
 
pawn doesn't have 64 bit integer data type

11922911 09-17-2013 12:54

Re: How do I convert a BYTE array to LONG in AMXX?
 
In fact, I want to catch up Fog event, but I'm don't really understand what is happening with the fog density :lol:

ConnorMcLeod 09-17-2013 17:42

Re: How do I convert a BYTE array to LONG in AMXX?
 
Following stock is from some code Arkshine has posted on forum, revert it to understand the sent message.

PHP Code:

Util_Fog(idred=127green=127blue=127Float:dentity=0.001bool:clear=false)
{
    static 
msgFog 0;
    if( !
msgFog )
    {
        
msgFog get_user_msgid("Fog");
    }
    
message_begin(id MSG_ONE MSG_ALLmsgFog_id);
    
write_byte(red);
    
write_byte(green);
    
write_byte(blue);
    
write_long(_:floatclamp(dentity0.00010.25 ) * _:!clear;);
    
message_end();



11922911 09-19-2013 03:02

Re: How do I convert a BYTE array to LONG in AMXX?
 
Quote:

Originally Posted by ConnorMcLeod (Post 2036603)
Following stock is from some code Arkshine has posted on forum, revert it to understand the sent message.

PHP Code:

Util_Fog(idred=127green=127blue=127Float:dentity=0.001bool:clear=false)
{
    static 
msgFog 0;
    if( !
msgFog )
    {
        
msgFog get_user_msgid("Fog");
    }
    
message_begin(id MSG_ONE MSG_ALLmsgFog_id);
    
write_byte(red);
    
write_byte(green);
    
write_byte(blue);
    
write_long(_:floatclamp(dentity0.00010.25 ) * _:!clear;);
    
message_end();



I think this is too difficult for me,
Thank you anyway. :)


All times are GMT -4. The time now is 18:48.

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