#if defined _INC_od_scroll_text
#endinput
#endif
#define _INC_od_scroll_text
#include <od_stdio>
#define OD_SCROLL_LEFT 0
#define OD_SCROLL_RIGHT 1
#define OD_SCROLL_BOUNCE 2
#define OD_SCROLL_Static Scroll_Static
#define OD_SCROLL_Dynamic Scroll_Dynamic
stock Scroll_Static(text[], offset, width, prefix[] = "", suffix[] = "") {
IO_CarriageReturn();
IO_Write(prefix);
new length = strlen(text);
static spaces[] = " ";
new start = clamp(offset, 0, length);
new end = clamp(offset + width, 0, length);
if (offset < 0) {
new padding = clamp(-offset, 0, width);
for (new i = 0; i < padding; i = i + 32) {
IO_Write(spaces[clamp(32 - (padding - i), 0, 32)]);
}
}
new ch = text[end];
text[end] = '\0';
IO_Write(text[start]);
text[end] = ch;
for (new i = end - offset; i < width; i = i + 32) {
IO_Write(spaces[clamp(32 - (width - i), 0, 32)]);
}
IO_Write(suffix);
IO_Flush();
}
stock Scroll_Dynamic(text[], width, time, prefix[] = "", suffix[] = "", direction = OD_SCROLL_LEFT) {
switch (direction) {
case OD_SCROLL_LEFT: {
new end = GetTickCount();
new start = -width;
new length = strlen(text);
for ( ; ; ) {
for (new i = start; i <= length; ++i) {
Scroll_Static(text, i, width, prefix, suffix);
end = end + time;
while (GetTickCount() < end) {
}
}
}
}
case OD_SCROLL_RIGHT: {
new end = GetTickCount();
new start = -width;
new length = strlen(text);
for ( ; ; ) {
for (new i = length; i >= start; --i) {
Scroll_Static(text, i, width, prefix, suffix);
end = end + time;
while (GetTickCount() < end) {
}
}
}
}
case OD_SCROLL_BOUNCE: {
new end = GetTickCount();
new length = strlen(text);
new start = -(width - length);
for ( ; ; ) {
for (new i = 0; i >= start; --i) {
Scroll_Static(text, i, width, prefix, suffix);
end = end + time;
while (GetTickCount() < end) {
}
}
for (new i = start; i <= 0; ++i) {
Scroll_Static(text, i, width, prefix, suffix);
end = end + time;
while (GetTickCount() < end) {
}
}
}
}
}
}
#include <a_samp>
#include <od_scroll_text>
main()
{
}
public OnGameModeInit()
{
Scroll_Dynamic("hello world", 50, 150, "---:", ":---");
return 1;
}
ln -s /dev/tty ./scriptfiles/CON
I don't know how this works but this works
![]() ![]() |
How'd you do that password to start GM thingy? that'll be good for security.
|
ln -s /dev/tty ./scriptfiles/CON
You can't make a specific player wait to execute code as you can't run code for specific players, everything runs on one thread one thing after another. If that thread is paused (with a wait() function for example) the entire server will stop.
... If you want an easier way to write timer code, check out y_timers. That library decreases the amount of writing you need to do for deferred or repeated functions. |
This is so useless. And because it's useless, i fucking love it
![]() |