SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 13/12/2016, 09:09 AM   #1
OneDay
Huge Clucker
 
Join Date: Sep 2015
Posts: 293
Reputation: 134
Default od_scroll_text.inc - Make moving text in the console.

PHP Code:
#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[], offsetwidthprefix[] = ""suffix[] = "") {
    
IO_CarriageReturn();
    
IO_Write(prefix);
    new 
length strlen(text);
    static 
spaces[] = "                                ";
    new 
start clamp(offset0length);
    new 
end clamp(offset width0length);
    if (
offset 0) {
        new 
padding clamp(-offset0width);
        for (new 
0padding32) {
            
IO_Write(spaces[clamp(32 - (padding i), 032)]);
        }
    }
    new 
ch text[end];
    
text[end] = '\0';
    
IO_Write(text[start]);
    
text[end] = ch;
    for (new 
end offsetwidth32) {
        
IO_Write(spaces[clamp(32 - (width i), 032)]);
    }
    
IO_Write(suffix);
    
IO_Flush();
}

stock Scroll_Dynamic(text[], widthtimeprefix[] = ""suffix[] = ""direction OD_SCROLL_LEFT) {
    switch (
direction) {
        case 
OD_SCROLL_LEFT: {
            new 
end GetTickCount();
            new 
start = -width;
            new 
length strlen(text);
            for ( ; ; ) {
                for (new 
start<= length; ++i) {
                    
Scroll_Static(textiwidthprefixsuffix);
                    
end end time;
                    while (
GetTickCount() < end) {
                    }
                }
            }
        }
        case 
OD_SCROLL_RIGHT: {
            new 
end GetTickCount();
            new 
start = -width;
            new 
length strlen(text);
            for ( ; ; ) {
                for (new 
length>= start; --i) {
                    
Scroll_Static(textiwidthprefixsuffix);
                    
end end time;
                    while (
GetTickCount() < end) {
                    }
                }
            }
        }
        case 
OD_SCROLL_BOUNCE: {
            new 
end GetTickCount();
            new 
length strlen(text);
            new 
start = -(width length);
            for ( ; ; ) {
                for (new 
0>= start; --i) {
                    
Scroll_Static(textiwidthprefixsuffix);
                    
end end time;
                    while (
GetTickCount() < end) {
                    }
                }
                for (new 
start<= 0; ++i) {
                    
Scroll_Static(textiwidthprefixsuffix);
                    
end end time;
                    while (
GetTickCount() < end) {
                    }
                }
            }
        }
    }

It can make moving text in the console. Call "Scroll_Static" a lot or call "Scroll_Dynamic" once.

Hello World example:

PHP Code:
#include <a_samp>
#include <od_scroll_text>

main()
{
}

public 
OnGameModeInit()
{
    
Scroll_Dynamic("hello world"50150"---:"":---");
    return 
1;



To make work on Linux type:

PHP Code:
ln -/dev/tty ./scriptfiles/CON 
Uses od_stdio.inc:

http://forum.sa-mp.com/showthread.ph...22#post3812622

Password for server example:

http://forum.sa-mp.com/showthread.ph...24#post3812624

If it makes the triangle:


Last edited by OneDay; 04/04/2017 at 02:15 PM.
OneDay is offline   Reply With Quote
Old 13/12/2016, 09:18 AM   #2
Eoussama
High-roller
 
Eoussama's Avatar
 
Join Date: Jul 2016
Location: Kingdom of Morocco // Tangier
Posts: 1,071
Reputation: 281
Default Re: od_scroll_text.inc - Make moving text in the console.

WOW, awesome, +rep
__________________

|===[Web taxi]===|
List of my work
Github
Pastebin

|===[Interesting topics]===|
Semantic Versioning
Eoussama is online now   Reply With Quote
Old 14/12/2016, 03:21 PM   #3
OneDay
Huge Clucker
 
Join Date: Sep 2015
Posts: 293
Reputation: 134
Default Re: od_scroll_text.inc - Make moving text in the console.

If it makes the triangle:

OneDay is offline   Reply With Quote
Old 14/12/2016, 04:05 PM   #4
Swedky
Banned
 
Join Date: Jun 2013
Location: Argentina.
Posts: 2,042
Reputation: 827
Default Re: od_scroll_text.inc - Make moving text in the console.

I don't know how this works but this works can you explain how you're doing this, how "CON" file is annexed to server_log.txt/samp-server.exe? It looks interesting
Swedky is offline   Reply With Quote
Old 14/12/2016, 04:46 PM   #5
coool
Gangsta
 
coool's Avatar
 
Join Date: Feb 2013
Location: Republic of Pakistan
Posts: 602
Reputation: 54
Default Re: od_scroll_text.inc - Make moving text in the console.

Awesome work. Just seen some thing fabulous again!!! +Rep
__________________
coool is offline   Reply With Quote
Old 14/12/2016, 04:49 PM   #6
ISmokezU
Gangsta
 
Join Date: Aug 2016
Posts: 543
Reputation: 73
Default Re: od_scroll_text.inc - Make moving text in the console.

How'd you do that password to start GM thingy? that'll be good for security.
ISmokezU is offline   Reply With Quote
Old 14/12/2016, 04:55 PM   #7
OneDay
Huge Clucker
 
Join Date: Sep 2015
Posts: 293
Reputation: 134
Default Re: od_scroll_text.inc - Make moving text in the console.

Quote:
Originally Posted by Eoussama View Post
WOW, awesome, +rep
Thanks

Quote:
Originally Posted by Swedky View Post
I don't know how this works but this works can you explain how you're doing this, how "CON" file is annexed to server_log.txt/samp-server.exe? It looks interesting
It is special in Windows - CON and CONIN$ and CONOUT$ means console.

Quote:
Originally Posted by coool View Post
Awesome work. Just seen some thing fabulous again!!! +Rep
Thanks

Quote:
Originally Posted by ISmokezU View Post
How'd you do that password to start GM thingy? that'll be good for security.
http://forum.sa-mp.com/showthread.ph...24#post3812624
OneDay is offline   Reply With Quote
Old 14/12/2016, 06:03 PM   #8
ISmokezU
Gangsta
 
Join Date: Aug 2016
Posts: 543
Reputation: 73
Default Re: od_scroll_text.inc - Make moving text in the console.

Download?
ISmokezU is offline   Reply With Quote
Old 22/12/2016, 07:47 PM   #9
OneDay
Huge Clucker
 
Join Date: Sep 2015
Posts: 293
Reputation: 134
Default Re: od_scroll_text.inc - Make moving text in the console.

It is in the first post.
OneDay is offline   Reply With Quote
Old 04/04/2017, 02:16 PM   #10
OneDay
Huge Clucker
 
Join Date: Sep 2015
Posts: 293
Reputation: 134
Default Re: od_scroll_text.inc - Make moving text in the console.

updated with fixed hooks
nice functions names
works on Linux with:

PHP Code:
ln -/dev/tty ./scriptfiles/CON 
also does many directions and both directions (bounces across the screen)
OneDay is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] [REL] Console Colored Text 0.2 (New version) cosmy Plugin Development 54 14/03/2014 10:55 AM
[Tutorial] How to Disable Server-Log.txt and enable the text in the console Apenmeeuw Tutorials 5 03/05/2013 02:51 AM
How to input text into player console? Haron Help Archive 2 24/02/2010 08:29 PM
How to make Moving Text Draw [WSM]Deadly_Evil Help Archive 2 31/12/2009 09:10 AM


All times are GMT. The time now is 10:28 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.