[FilterScript] SAMP Clock
#1

SAMP Clock

Not my first piece of code, but first public release. Its very simple and took me just 10 mins. Hope you like it


Download Link:
http://pastebin.com/iPZ62fVk
Reply
#2

Why timer = 6 sec?
And this:
PHP код:
        TextDrawShowForPlayer(playeridClock[0]);
        
TextDrawShowForPlayer(playeridClock[1]); 
PHP код:
    for(new 0MAX_PLAYERSi++)
    {
                
TextDrawHideForPlayer(iClock[0]);
                
TextDrawHideForPlayer(iClock[1]);
                
TextDrawShowForPlayer(iClock[0]);
                
TextDrawShowForPlayer(iClock[1]);
    } 
Change to:
PHP код:
for(new t!= 2t++) TextDrawShowForPlayer(playeridClock[t]); 
PHP код:
    for(new 0MAX_PLAYERSi++)
    {
                for(new 
t!= 2t++) TextDrawHideForPlayer(iClock[t]),TextDrawShowForPlayer(iClock[t]);
    } 
Reply
#3

Quote:
Originally Posted by WASD
Посмотреть сообщение
Why timer = 6 sec?
And this:
PHP код:
        TextDrawShowForPlayer(playeridClock[0]);
        
TextDrawShowForPlayer(playeridClock[1]); 
PHP код:
    for(new 0MAX_PLAYERSi++)
    {
                
TextDrawHideForPlayer(iClock[0]);
                
TextDrawHideForPlayer(iClock[1]);
                
TextDrawShowForPlayer(iClock[0]);
                
TextDrawShowForPlayer(iClock[1]);
    } 
Change to:
PHP код:
for(new t!= 2t++) TextDrawShowForPlayer(playeridClock[t]); 
PHP код:
    for(new 0MAX_PLAYERSi++)
    {
                for(new 
t!= 2t++) TextDrawHideForPlayer(iClock[t]),TextDrawShowForPlayer(iClock[t]);
    } 
1. Don't force him to do anything, his version is fine and faster than yours.
2. Are you really still using MAX_PLAYERS as a loop's upper bound? It's 2015, use GetPlayerPoolSize.
3. Using commas to continue a statement is supposed to only work in returns, but either way it is bad coding practice. In fact, I think Y-Less says something about it in a comment on his old Code Optimisations thread.
Reply
#4

Quote:
Originally Posted by WASD
Посмотреть сообщение
Why timer = 6 sec?
And this:
PHP код:
        TextDrawShowForPlayer(playeridClock[0]);
        
TextDrawShowForPlayer(playeridClock[1]); 
PHP код:
    for(new 0MAX_PLAYERSi++)
    {
                
TextDrawHideForPlayer(iClock[0]);
                
TextDrawHideForPlayer(iClock[1]);
                
TextDrawShowForPlayer(iClock[0]);
                
TextDrawShowForPlayer(iClock[1]);
    } 
Change to:
PHP код:
for(new t!= 2t++) TextDrawShowForPlayer(playeridClock[t]); 
PHP код:
    for(new 0MAX_PLAYERSi++)
    {
                for(new 
t!= 2t++) TextDrawHideForPlayer(iClock[t]),TextDrawShowForPlayer(iClock[t]);
    } 
You should avoid using loops for such matters (hiding/showing textdraws), they are actually slower than allotting them internally.

Want proof?

1 variable alternated 50,000 times in two different manners.



Reply
#5

Quote:
Originally Posted by Crayder
Посмотреть сообщение
1. Don't force him to do anything, his version is fine and faster than yours.
2. Are you really still using MAX_PLAYERS as a loop's upper bound? It's 2015, use GetPlayerPoolSize.
3. Using commas to continue a statement is supposed to only work in returns, but either way it is bad coding practice. In fact, I think Y-Less says something about it in a comment on his old Code Optimisations thread.
Sorry about the max player thing, I personally use foreach so I forgot about that. About the third point can you give an example. I will be very thankful.
Reply
#6

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
You should avoid using loops for such matters (hiding/showing textdraws), they are actually slower than allotting them internally.

Want proof?

1 variable alternated 50,000 times in two different manners.



You are right it is faster to execute plain code than loops.
Reply
#7

Keep up the great work I say!
Reply
#8

Great work!
Reply
#9

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
You should avoid using loops for such matters (hiding/showing textdraws), they are actually slower than allotting them internally.

Want proof?

1 variable alternated 50,000 times in two different manners.



I see that you have a very beautiful PAWN Editor there, mind if you share it with us?
Reply
#10

Quote:
Originally Posted by dionisak0s
Посмотреть сообщение
I see that you have a very beautiful PAWN Editor there, mind if you share it with us?
Are you serious, you've never heard of Sublime Text?
Reply
#11

Nice
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)