black screen fade function
i want to fade a players screen to black (just like fade to black)
i know i have to use this so i wrote these functions PHP Code:
PHP Code:
PHP Code:
PHP Code:
can you please explain? also i want that the first function blacks it out infinitly until i call the second function that removes the black screen EDIT: i just noticed Note: Duration and HoldTime is in special units. 1 second is equal to (1<<12) i.e. 4096 units. so lets say i want it for 2 seconds, i do 4096*2 ?? bu ti want it not to stop any help?? thank you in advance |
Re: black screen fade function
Following stocks let you choose time in seconds (and contains formulas if you want to rip code).
http://forums.alliedmods.net/showthread.php?t=87623 UTIL_FadeToBlack( id ) |
Re: black screen fade function
I know i can use this, i have already came across it before while searching. But i really want to understand what they do and how to use them (the three write_short() i mean). Plus if i use this, i will have to get the .inc to compile my code, and i want it to be able to compile without any additions.
I tried to check the code inside the .inc, i got a bit lost :( Since you used them in the .inc, can you please explain? Thanks again EDIT: I have managed to get this far, did i do it correctly? PHP Code:
|
Re: black screen fade function
This is more correct than your first post, but flags to unfade would more be FFADE_IN and alpha 255 (except if the way you wrote it FFADE_OUT + alpha 0 makes a smooth effect).
If you still don't know why the formula of duration is FixedUnsigned16(seconds , 1<<12), it's because the value of 1 second is 1<<12 (or 4096), but the argument is a short, so the max value you can pass as argument is max value of an unsigned short (unisigned16) (65535 or 0xFFFF), so the max duration you can use is 65535 / 4096 = 15.999 seconds, if you want more duration you need a workaround like using STAYOUT flag or re-send the message after some time. |
Re: black screen fade function
Now i understood better, thank you a lot :D
So i will replace FFADE_OUT by FFADE_IN and i am good to go :D |
Re: black screen fade function
May be the way you wrote it works, dunno i haven't tested, or may be it works if you add MODULATE flag.
Also, you can copy/paste the whole .inc in your .sma if you have any doubt. But for your plugin, you don't need to clamp values because you use STAYOUT flag, you can put write_short(1), write_short(1), write_short( FFLAG_STAYOUT ) and it'll work fine. Default fade to black effect duration is 3 sec so : PHP Code:
|
Re: black screen fade function
alright now i ran into another problem, the screen fade worked perfectly but it dissapears when the players press space (to change view mode when he is dead, the screen fade is only applicable when dead btw) the black screen is gone, Also when the player press E (when this small square windows comes up on the top left corner of your screen).
how can i block that? I want to ask also, if when a player is respawned (after round end for example) does the screen fade goes away by it self? EDIT: i just noticed your edited response :D thank you, and when a player disconnects, it automatically refresh the info (recalculates the players who have the same ip), i can leave it until next round, when he dies he doesnt get blacked out :D and how can i also disable the players from resetting the screen by typing fullupdate? you don't have to right the code for me, just lead me in the direction (link to a thread, another plugin maybe that has the same functionality, ...) I know you might get frustrated from me, but its my first week in coding with amxmodx :( EDIT2: just thought of this, maybe i can use this? register_clcmd("fullupdate", "BlackoutFullupdate""; and then inside BlackoutFullupdate i check if he one of the sameips and stuff like that? but still i donno how to block the change view mode thingy :( EDIT3: came up with this function, will it work? is it recommended or not? PHP Code:
|
Re: black screen fade function
You can block message :
PHP Code:
I'm not sure if the client uses fadetoblack cvar value or another system to know if the screen can be reset, so there should be more efficient ways to achieve what you want, but this method should work. Also, see in which order i made the checks : if( g_bSameIPs[id] && !is_user_alive(id) ) It's better to check variables first and to use natives after, so you can save some natives calls. You should find usefull links on there : http://forums.alliedmods.net/showthread.php?t=172936 One of them : http://wiki.amxmodx.org/Optimizing_P...X_Scripting%29 Also, if you know more in C than in pawn, you should have a look on pawn guide, page 133 : http://www.compuphase.com/pawn/Pawn_Language_Guide.pdf |
Re: black screen fade function
On second thought, the screenfade goes away in like 3 to 5 seconds, i guess ill post the whole code:
I decided simply to use your include, cause i thought i was doing something wrong :( PHP Code:
------------------------------------------------------------------------------------------- I did not understand this: PHP Code:
so RegisterMessage is a function that you created, and you defined that function here right? cause at first i thought its a native --------------------------------------------------------------------------------------------- Let me get it straight, this will block the message when the view mode is changed and when client type fullupdate? excuse me, but it's 6 AM here so im pretty tired, i think imma go to sleep :D waiting for your answer 2morrow :D PHP Code:
|
Re: black screen fade function
Alright now all is good i hope :D i only have 1 more problem, players are visible when switched to overview mode.
Is there a way to disable overview? or something of that sort? EDIT: sorry didn't notice my post, should have edited the previous one |
| All times are GMT -4. The time now is 06:05. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.