Raised This Month: $12 Target: $400
 3% 

cell parameters


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 09-26-2017 , 05:32   cell parameters
Reply With Quote #1

Hello, i'm wondering how can i put the parameters for the "WriteShort(Float Fade time) and "WriteShort(Float Fade duration)" for the message "ScreenFade" in the code below


so the native in sma code would be -native send_screen_fade(Index, Float:Fade, Float: Duration, Type, Red, Green, Blue, Alpha)


PHP Code:
static cell AMX_NATIVE_CALL send_screen_fadeAMX *, cell pParameters ) {
    if( 
gpGlobals -> time && !FNullEntINT_TO_EDICTpParameters] ) ) ) {
        
MESSAGE_BEGINMSG_ONE_UNRELIABLECMessages.screenfade0ENTINT_TO_EDICTpParameters] ) ) );
        
WRITE_SHORT4096 ); // this parameter
        
WRITE_SHORT2048 ); // this parameter
        
WRITE_SHORT); // and this parameter
        
WRITE_BYTEpParameters] );
        
WRITE_BYTEpParameters] );
        
WRITE_BYTEpParameters] );
        
WRITE_BYTEpParameters] );
        
MESSAGE_END( );
    }

    return 
1;


so i would send the screen fade like:

PHP Code:
public func(index)
{
     
// for exapmle  
     
send_screen_fade(index1.00,600x000025500255// id, float fade, float duration, fade type , color red, green, blue, alpha



__________________

Last edited by ghost95v; 09-26-2017 at 05:44.
ghost95v is offline
Send a message via Skype™ to ghost95v
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-26-2017 , 06:40   Re: cell parameters
Reply With Quote #2

Do it just like you would do with any other parameter? Not sure what exactly is the issue here. If you want to get the float value from a parameter you can use amx_ctof function.

Last edited by klippy; 09-26-2017 at 06:41.
klippy is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 09-26-2017 , 07:13   Re: cell parameters
Reply With Quote #3

Yes, yes solved, i just puted like the other parametters

but i still cannot send the "ScreenFade" message with duration and fade time float

like :
Code:
send_screen_fade(index, 2.00, 0.40....)
i only can:
Code:
send_screen_fade(index, (1<<12), (1<<12), ...
or:
Code:
send_screen_fade(index, (1<<12)*2, (1<<12)*4, ...
PHP Code:
static cell AMX_NATIVE_CALL send_screen_fadeAMX *, cell pParameters ) {
    if( 
gpGlobals -> time && !FNullEntINT_TO_EDICTpParameters] ) ) ) {
        
MESSAGE_BEGINMSG_ONE_UNRELIABLECMessages.screenfade0ENTINT_TO_EDICTpParameters] ) ) );
        
WRITE_SHORTpParameters] ); 
        
WRITE_SHORTpParameters] ); 
        
WRITE_SHORTpParameters] ); 
        
WRITE_BYTEpParameters] );
        
WRITE_BYTEpParameters] );
        
WRITE_BYTEpParameters] );
        
WRITE_BYTEpParameters] );
        
MESSAGE_END( );
    }

    return 
1;

__________________

Last edited by ghost95v; 09-26-2017 at 07:22.
ghost95v is offline
Send a message via Skype™ to ghost95v
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-26-2017 , 07:26   Re: cell parameters
Reply With Quote #4

1 << 12 is equal to 4096. So you can multiply 4096 by the number of (floating point) seconds and then round it to the nearest short integer.
klippy is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 09-26-2017 , 07:50   Re: cell parameters
Reply With Quote #5

Thank you i appreciate your advice.

but how can i round it in cpp like this below writted in pawn

PHP Code:

stock do_screen_fade
(idFloat:fadeTimeFloat:holdTimetyperedgreenbluealpha)

    new 
fadehold;
    
fade clamp(    floatround(     fadeTime float(1<<12)), 00xFFFF    );

    
hold clamp(     floatround(         holdTime float(1<<12)), 00xFFFF      );
        
    
// Message
    
message_begin(    MSG_ONE_UNRELIABLE"ScreenFade"_id );
    
write_short(          fade    );
    
write_short(    hold    );
    
write_short(    type   );
    
write_byte(      red    );
    
write_byte(  green    );
    
write_byte(    blue    );
    
write_byte(     alpha    );
    
message_end(    ); 
__________________

Last edited by ghost95v; 09-26-2017 at 07:56.
ghost95v is offline
Send a message via Skype™ to ghost95v
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-26-2017 , 08:51   Re: cell parameters
Reply With Quote #6

Search on Google, that's been answered too many times already.
klippy is offline
Reply


Thread Tools
Display Modes

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:04.


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