Raised This Month: $ Target: $400
 0% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
11922911
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
Old 09-16-2013 , 23:24   How do I convert a BYTE array to LONG in AMXX?
Reply With Quote #1

If anyone know that, please give me some example.
thanks in advance.
__________________
youtube:
@holla16
11922911 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-17-2013 , 00:21   Re: How do I convert a BYTE array to LONG in AMXX?
Reply With Quote #2

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
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-17-2013 at 00:23.
ConnorMcLeod is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 09-17-2013 , 05:59   Re: How do I convert a BYTE array to LONG in AMXX?
Reply With Quote #3

pawn doesn't have 64 bit integer data type
jimaway is offline
11922911
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
Old 09-17-2013 , 12:54   Re: How do I convert a BYTE array to LONG in AMXX?
Reply With Quote #4

In fact, I want to catch up Fog event, but I'm don't really understand what is happening with the fog density
__________________
youtube:
@holla16
11922911 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-17-2013 , 17:42   Re: How do I convert a BYTE array to LONG in AMXX?
Reply With Quote #5

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();

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
11922911
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
Old 09-19-2013 , 03:02   Re: How do I convert a BYTE array to LONG in AMXX?
Reply With Quote #6

Quote:
Originally Posted by ConnorMcLeod View Post
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.
__________________
youtube:
@holla16
11922911 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 18:48.


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