[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


Messages In This Thread
Simple object analogic clock - by iJumbo - 18.12.2013, 23:45
Re: Simple object analogic clock - by Alphlax - 19.12.2013, 03:48
Re: Simple object analogic clock - by Gen3i - 19.12.2013, 04:21
Re: Simple object analogic clock - by rocker3410 - 19.12.2013, 04:36
Re: Simple object analogic clock - by Tamer - 19.12.2013, 04:47
Re: Simple object analogic clock - by iGetty - 19.12.2013, 04:50
Re: Simple object analogic clock - by FoxGaming - 19.12.2013, 04:50
Re: Simple object analogic clock - by KingServerIRAN - 19.12.2013, 06:06
Re: Simple object analogic clock - by iZN - 19.12.2013, 06:27
Re : Simple object analogic clock - by Ivory - 19.12.2013, 08:38

Forum Jump:


Users browsing this thread: 2 Guest(s)