Animated TEXT_DRAW_FONT_MODEL_PREVIEW
#1

Yeah, I know that it's cool new stuff, but I was wondering if there is a way to animate the object/vehicle. There is function TextDrawSetPreviewRot, but to see its effect I have to hide and then show again the textdraw. There is lag between this, so I've decided to create another textdraw which will fill the time gaps. This works, but if the animation speed is too high, then CPU goes crazy

pawn Код:
static Text:txt[2];
static tmp = 0;
forward Shadow();
forward Rotate();
forward Ghost();

#define TIME        (1000)

public OnFilterScriptInit() {
    Build(txt[0]);
    TextDrawHideForAll(txt[0]);
    Build(txt[1]);
   
    SetTimer("Shadow", TIME - 60, 1);
    return 1;
}
public Shadow() {
    TextDrawShowForAll(txt[1]);
    SetTimer("Rotate", 60, 0);
}

public Rotate() {
    tmp += 1;
    tmp %= 360;
    SetTimer("Ghost", 50, 0);
    TextDrawHideForAll(txt[0]);
    TextDrawSetPreviewRot(txt[0], -20.0, 0.0, float(tmp), 1.0);
    TextDrawShowForAll(txt[0]);
    return 1;
}

public Ghost() {
    TextDrawHideForAll(txt[1]);
    TextDrawSetPreviewRot(txt[1], -20.0, 0.0, float(tmp), 1.0);
    return 1;
}

stock Build(&Text:who) {   
    who = TextDrawCreate(320.0, 240.0, "_");
    TextDrawFont(who, TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawBackgroundColor(who, 0x00000000);
    TextDrawBoxColor(who, 0xFFFFFFFF);
    TextDrawTextSize(who, 100.0, 100.0);
    TextDrawSetPreviewVehCol(who, 0, 0);
    TextDrawSetPreviewModel(who, 411);
    TextDrawSetPreviewRot(who, -20.0, 0.0, float(tmp), 1.0);
    return 1;
}

public OnFilterScriptExit() {
    TextDrawDestroy(txt[0]);
    TextDrawDestroy(txt[1]);
    return 1;
}
I just want to rotate the model (but quite often). How can I achieve it?
Reply


Messages In This Thread
Animated TEXT_DRAW_FONT_MODEL_PREVIEW - by Misiur - 23.02.2013, 21:12
Re: Animated TEXT_DRAW_FONT_MODEL_PREVIEW - by MP2 - 23.02.2013, 21:31
Re: Animated TEXT_DRAW_FONT_MODEL_PREVIEW - by Misiur - 23.02.2013, 21:34

Forum Jump:


Users browsing this thread: 3 Guest(s)