Textdraw logic help
#1

Hello, I've got these 7 textdraw's.

What is the logic, of when I add one to the 6th line (last line), all the text moves up? (the direction of the arrow)

I've got this but it aint working
pawn Код:
function addLogLine(text[])
{
    new oldInfo[70];
    //
    for(new i = 6; i >= 0; i--)
    {
        if(i != 0)
        {
            format(oldInfo, 70, "%s", Logs[i-1]);
            TextDrawSetString(Logs[i-1], LogsInfo[i]);
            format(LogsInfo[i-1], 70, "%s", LogsInfo[i]);
        }
    }
   
    TextDrawSetString(Logs[6], text);
    format(LogsInfo[6], 70, "%s", text);
    return 1;
}
Reply
#2

This should work, untested though.
Код:
#include <a_samp>

new tdStrings[ 7 ][ 64 ];

public OnFilterScriptInit()
{
	for(new i = 0; i < 7; i++)
	{
		format(tdStrings[i], 64, "-");
                TextDrawSetString(Logs[i], tdStrings[i]);
	}
	return 1;
}

addLogLine(text[])
{
	for(new i = 0; i < 6; i++)
	{
		format(tdStrings[i], 64, "%s", tdStrings[i+1]);
		TextDrawSetString(Logs[i], tdStrings[i]);
	}

	format(tdStrings[6], 64, "%s", text);
	TextDrawSetString(Logs[6], tdStrings[6]);

	return 1;
}
Reply
#3

Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
This should work, untested though.
Код:
#include <a_samp>

new tdStrings[ 7 ][ 64 ];

public OnFilterScriptInit()
{
	for(new i = 0; i < 7; i++)
	{
		format(tdStrings[i], 64, "-");
                TextDrawSetString(Logs[i], tdStrings[i]);
	}
	return 1;
}

addLogLine(text[])
{
	for(new i = 0; i < 6; i++)
	{
		format(tdStrings[i], 64, "%s", tdStrings[i+1]);
		TextDrawSetString(Logs[i], tdStrings[i]);
	}

	format(tdStrings[6], 64, "%s", text);
	TextDrawSetString(Logs[6], tdStrings[6]);

	return 1;
}
But mine starts from bottom (index: 6) and goes to the top (index:0), or should I say, a descending order D:
Reply
#4

Quote:
Originally Posted by lukewid
Посмотреть сообщение
But mine starts from bottom (index: 6) and goes to the top (index:0), or should I say, a descending order D:
It does not matter. Did you try the code? It should work.
Reply
#5

Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
It does not matter. Did you try the code? It should work.
Well, yea, now that i swapped the order of it, it worked

Solution:
Original --- New one
Reply
#6

Dude try this:
Код:
addLogLine(text[])
{
	for(new i = 7; i => 1; i--)
	{
		format(tdStrings[i], 64, "%s", tdStrings[i+1]);
		TextDrawSetString(Logs[i], tdStrings[i]);
	}

	format(tdStrings[6], 64, "%s", text);
	TextDrawSetString(Logs[6], tdStrings[6]);

	return 1;
}
This is changing the counting from 1 to 6
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)