Problem with decreasing...
#1

Hey guys, i decided to make a progress bar although i got confused on how to do it.

I was thinking about setting a timer for a player that repeats every 1 second and in that 1 second
it'll decrease the boxes width.

so like

Код:
When the timers started:
---------------------------------------
- ||||||||||||||||||||||||||||||||||| -
- ||||||||||||||||||||||||||||||||||| -
---------------------------------------

When the one second pasted:

---------------------------------------
- ||||||||||||||||||||||||||||||||||  -
- ||||||||||||||||||||||||||||||||||  -
---------------------------------------
As you can see it decreased its box by -2 of the actual width of the box (X - 2)

Now you see what im having trouble is with decreasing the X co-ordinate,
because its not like GetPlayerPos

Where you can go X-2 and over and over again since it saves that wont work.

ermm, i hope you get me, Thanks.
Reply
#2

TextDraws?
If yes, may you post the TextDraw codes here, (Creating), and maybe the timer, if you have got it already.
Then I can do it.
Reply
#3

pawn Код:
forward l(playerid);
public l(playerid)
{
    new count, multip = 0;

    multip++;
    count = 400.0 - 2 * multip;

    TextDrawHideForPlayer(playerid, gTextDrawData[E_REVIVE_PERCENTAGE_BOX][playerid]);
    TextDrawHideForPlayer(playerid, gTextDrawData[E_REVIVE_PERCENTAGE][playerid]);

    if(multip == 10)
    {
        SendClientMessage(playerid, COLOR_YELLOW, "hello.");
    }

    TextDrawTextSize(gTextDrawData[E_REVIVE_PERCENTAGE][playerid], count, 15.000000);

    TextDrawShowForPlayer(playerid, gTextDrawData[E_REVIVE_PERCENTAGE_BOX][playerid]);
    TextDrawShowForPlayer(playerid, gTextDrawData[E_REVIVE_PERCENTAGE][playerid]);

}
A test timer. Thats what i've used for testing, didnt exactly work though.
Reply
#4

Okey, so I suggest this:
pawn Код:
new PlayerStatus[MAX_PLAYERS];
Where the timer starts:
pawn Код:
PlayerStatus[playerid] = /*Here you enter the amount of textsize at the beginning*/;
Timer:
pawn Код:
forward l(playerid);
public l(playerid)
{
    PlayerStatus[playerid]-=/*Here the amount of lowering it.*/;
    TextDrawHideForPlayer(playerid, gTextDrawData[E_REVIVE_PERCENTAGE_BOX][playerid]);
    TextDrawHideForPlayer(playerid, gTextDrawData[E_REVIVE_PERCENTAGE][playerid]);

    if(multip <= 0)
    {
        SendClientMessage(playerid, COLOR_YELLOW, "hello.");
        return 1;
    }

    TextDrawTextSize(gTextDrawData[E_REVIVE_PERCENTAGE][playerid], PlayerStatus[playerid], 15.000000);

    TextDrawShowForPlayer(playerid, gTextDrawData[E_REVIVE_PERCENTAGE_BOX][playerid]);
    TextDrawShowForPlayer(playerid, gTextDrawData[E_REVIVE_PERCENTAGE][playerid]);
    return 1;
}

If this is not working as you wish, then please give me the two TextDraws where they get created as well.


Regards,
Jeffry
Reply
#5

Thanks, lol i never thought that method, worked. Just converted into a Float so i can configure out its decimal places.

Once again thank you
Reply
#6

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
Thanks, lol i never thought that method, worked. Just converted into a Float so i can configure out its decimal places.
Oh, yeah, forgot about this. The positions of a Textdraw are Floats. ^^

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
Once again thank you
No problem. Have fun with it.


Jeffry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)