SA-MP Forums Archive
[FilterScript] Simple object analogic clock - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Simple object analogic clock (/showthread.php?tid=482030)



Simple object analogic clock - iJumbo - 18.12.2013

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.


Re: Simple object analogic clock - Alphlax - 19.12.2013

Interesting


Re: Simple object analogic clock - Gen3i - 19.12.2013

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


Re: Simple object analogic clock - rocker3410 - 19.12.2013

nice


Re: Simple object analogic clock - Tamer - 19.12.2013

Nice one.


Re: Simple object analogic clock - iGetty - 19.12.2013

Looks cool.


Re: Simple object analogic clock - FoxGaming - 19.12.2013

Yeah.. it's interesting and nice


Re: Simple object analogic clock - KingServerIRAN - 19.12.2013

Nice Work!


Re: Simple object analogic clock - iZN - 19.12.2013

Something unique, nice work.


Re : Simple object analogic clock - Ivory - 19.12.2013

Good job , it's' fun