[FilterScript] Clock 3D in game
#1

Is very simple to created




windows screen capture


image upload

if you want a different location, change the location

curent location is [895.0890, -1101.9412, 35.5424]

Download link
Reply
#2

Nice one!
Reply
#3

Looking Nice.
Reply
#4

bro how to get
Reply
#5

Quote:
Originally Posted by ragu1987
Посмотреть сообщение
bro how to get
With TextDraws.
Reply
#6

Good job
Reply
#7

It will just create a new 3D text label every second without destroying the older ones. Also it's wrong to use gettime() after format().
Actually you don't need ternary operators at all to generate this string. format() allows you to limit the amount of characters you want to use to display numbers as a string.

pawn Код:
format(string, sizeof string, "{00C0FF}%02d {F300FF}: {FFAF00}%02d {F300FF}: {F81414}%02d", hours, minutes, seconds);
By the way
pawn Код:
string[512]
is too huge and just wastes useful memory...
Reply
#8

This one is very bad scripted (see BigETI's post), I made a better version, doing the same thing but much more efficiently:
pawn Код:
/*
+++++++  ++++++  +++  +++   ++   ++
  +++    + ++    +  + +  +   + +
  ++     ++++++  +++  +++   + +
*/



#include <a_samp>

new Text3D:giClock,
    giTime[ 3 ],
    gsString[ 128 ];

public OnFilterScriptInit()
{
    giClock = Create3DTextLabel( " ", 0xFFFFFFFF, 895.0890, -1101.9412, 35.5424, 200.0, 0 );

    SetTimer( "UpdateClock", 1000, true );
    return 1;
}

forward UpdateClock( );
public UpdateClock( )
{
    gettime( giTime[ 0 ], giTime[ 1 ], giTime[ 2 ] );
    format( gsString, 128, "{00C0FF}Clock {FFAF00}By {F81414}Teddy\n{00C0FF}%02d{F300FF}:{FFAF00}%02d{F300FF}:{F81414}%02d", hours, minutes, seconds );
    Update3DTextLabelText( giClock, 0xFFFFFFFF, gsString );
}
Reply
#9

Quote:
Originally Posted by BigETI
Посмотреть сообщение
It will just create a new 3D text label every second without destroying the older ones. Also it's wrong to use gettime() after format().
Actually you don't need ternary operators at all to generate this string. format() allows you to limit the amount of characters you want to use to display numbers as a string.

pawn Код:
format(string, sizeof string, "{00C0FF}%02d {F300FF}: {FFAF00}%02d {F300FF}: {F81414}%02d", hours, minutes, seconds);
By the way
pawn Код:
string[512]
is too huge and just wastes useful memory...
I respectfully disagree that the amount of memory wasted has and significant it is literally a drop in a glass of water But yes why use strings longer than needed? I wanted it to the test to see if format takes longer to format strings with the same text but different sizes it would seem string length doesn't matter but I thought it would until I tested it. Conclusion still no excuse to use excessive sized strings it really boils down to bad practice.


Try running the following code on this site:

http://slice-vps.nl:7070/

pawn Код:
#include <a_samp>

main() {
    new string1[512];
    new string2[32];
   
    new tc = GetTickCount();
   
    for(new i = 0; i < 100000; i++)
    {
        format(string1, sizeof(string1), "Testing");
    }
    printf("String1[512] tool %i ticks", GetTickCount() - tc);


    tc = GetTickCount();
   
    for(new i = 0; i < 100000; i++)
    {
        format(string2, sizeof(string2), "Testing");
    }
    printf("String2[32] tool %i ticks", GetTickCount() - tc);

}
[20:40:09] String1[512] tool 29 ticks
[20:40:09] String2[32] tool 28 ticks
Reply
#10

Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
This one is very bad scripted (see BigETI's post), I made a better version, doing the same thing but much more efficiently:
pawn Код:
/*
+++++++  ++++++  +++  +++   ++   ++
  +++    + ++    +  + +  +   + +
  ++     ++++++  +++  +++   + +
*/



#include <a_samp>

new Text3D:giClock,
    giTime[ 3 ],
    gsString[ 128 ];

public OnFilterScriptInit()
{
    giClock = Create3DTextLabel( " ", 0xFFFFFFFF, 895.0890, -1101.9412, 35.5424, 200.0, 0 );

    SetTimer( "UpdateClock", 1000, true );
    return 1;
}

forward UpdateClock( );
public UpdateClock( )
{
    gettime( giTime[ 0 ], giTime[ 1 ], giTime[ 2 ] );
    format( gsString, 128, "{00C0FF}Clock {FFAF00}By {F81414}Teddy\n{00C0FF}%02d{F300FF}:{FFAF00}%02d{F300FF}:{F81414}%02d", hours, minutes, seconds );
    Update3DTextLabelText( giClock, 0xFFFFFFFF, gsString );
}
tried this showing some error please fix it and can we use this as filter script??
Error:
input(26) : error 17: undefined symbol "hours"
Error: The compiler failed. (no error code)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)