FIY9AL Posted April 1, 2020 Share Posted April 1, 2020 (edited) Server Side: function eyeBlink(fadeoutTime, waitTime, fadeinTime, player) -- fading time must be in seconds, waiting time must be in milliseconds. fadeCamera(player, false, fadeoutTime, 0, 0, 0) function fadeIn() fadeCamera(player, true, fadeinTime, 0, 0, 0) end setTimer(fadeIn, waitTime, 1) end To use it just write: eyeBlink(0.5, 500, 0.5, player) Have a nice day . Edited April 1, 2020 by FIY9AL Link to comment
The_GTA Posted April 2, 2020 Share Posted April 2, 2020 Hello FIY9AL, I think this is a working function, cool! What you could improve though is setting the internal fadeIn function to be a local function, like this: local function fadeIn() fadeCamera(player, true, fadeinTime, 0, 0, 0) end Then the function does not leak to the global namespace. If we were to discuss the user friendliness, I could argue that you'd reorder function arguments so that player is the first argument and then default the waitTime and fadeinTime argument to be the same as fadeoutTime (of course multiply waitTime by 1000 to get ms time). This is because then you could simply write: eyeBlink(player, 0.5) 1 Link to comment
FIY9AL Posted April 2, 2020 Author Share Posted April 2, 2020 2 minutes ago, The_GTA said: Hello FIY9AL, I think this is a working function, cool! What you could improve though is setting the internal fadeIn function to be a local function, like this: local function fadeIn() fadeCamera(player, true, fadeinTime, 0, 0, 0) end Then the function does not leak to the global namespace. If we were to discuss the user friendliness, I could argue that you'd reorder function arguments so that player is the first argument and then default the waitTime and fadeinTime argument to be the same as fadeoutTime (of course multiply waitTime by 1000 to get ms time). This is because then you could simply write: eyeBlink(player, 0.5) Nice job upgrading my function i will use it, thank you for your time Link to comment
The_GTA Posted April 2, 2020 Share Posted April 2, 2020 1 minute ago, FIY9AL said: Nice job upgrading my function i will use it, thank you for your time You're welcome! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now