[FilterScript] Simple object analogic clock
#1

I do not know where to post this thing because it is still developing, but since I have not seen anything like that I've created something.

Object analogic clock woo

Ok basically this is a simple code that creates objects on the coordinate MainX, MainY and MainY and creates a clock


Here a sample:



Here is the filterscript:

pawn Код:
#include <a_samp>
#define MainX       772.5632
#define MainY       -1363.4158
#define MainZ       13.5263
#define Base        0.3
#define PI          3.1415
#define Object      1546
#define Hour_OBJ    3
#define Minute_OBJ  4
#define Second_OBJ  5
#define Points_OBJ  12
new
    H[Hour_OBJ],
    M[Minute_OBJ],
    S[Second_OBJ],
    P[Points_OBJ],
    Timer
;
stock DrawClock()
{
    new
        Ho,
        Mi,
        Se
    ;
    gettime(Ho, Mi, Se);
    //
    new Float:sec = -1.57 + PI * Se / 30;
    //
    new Float:minu = -1.57 + PI * Mi / 30;
    //
    new Float:hrs = -1.57 + PI * Ho / 6 + PI * Mi / 360;
    //
    for(new i = 0; i != Second_OBJ; i++) {
        S[i] = CreateObject(Object, MainX + i * Base * floatsin(sec), MainY + i * Base * floatcos(sec), MainZ, 0.0, 0.0, 0.0);
    }
    for(new i = 0; i != Minute_OBJ; i++) {
        M[i] = CreateObject(Object, MainX + i * Base * floatsin(minu), MainY + i * Base * floatcos(minu), MainZ, 0.0, 0.0, 0.0);
    }
    for(new i = 0; i != Hour_OBJ; i++) {
        H[i] = CreateObject(Object, MainX + i * Base * floatsin(hrs), MainY + i * Base * floatcos(hrs), MainZ, 0.0, 0.0, 0.0);
    }
    //
    for(new i = 0; i != Points_OBJ; i++) {
        new O;
        if(i == 0 || i == 3 || i == 6 || i == 9) O = 1486;
        else O = Object;
        P[i] = CreateObject(O, MainX + floatsin(i * 30, degrees) * 1.4, MainY + floatcos(i * 30, degrees) * 1.4, MainZ, 0.0, 0.0, 0.0);
    }
}
stock DestroyClock()
{
    for(new i = 0; i != Second_OBJ; i++) {
        DestroyObject(S[i]);
    }
    for(new i = 0; i != Minute_OBJ; i++) {
        DestroyObject(M[i]);
    }
    for(new i = 0; i != Hour_OBJ; i++) {
        DestroyObject(H[i]);
    }
    for(new i = 0; i != Points_OBJ; i++) {
        DestroyObject(P[i]);
    }
}
public OnFilterScriptInit()
{
    Timer = SetTimer("Clock",900,true);
    return 1;
}
public OnFilterScriptExit()
{
    KillTimer(Timer);
    DestroyClock();
    return 1;
}
forward Clock();
public Clock()
{
    DestroyClock();
    DrawClock();
}
Note: change MainX,MainY,MainZ where you want the clock.

This is a base code not improved just for fun

Please if you use this leave credits and you are free to improve edit..

Have fun.
Reply
#2

Interesting
Reply
#3

Weird and cool at the same time,good job :P
Reply
#4

nice
Reply
#5

Nice one.
Reply
#6

Looks cool.
Reply
#7

Yeah.. it's interesting and nice
Reply
#8

Nice Work!
Reply
#9

Something unique, nice work.
Reply
#10

Good job , it's' fun
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)