Textdraw scrollbar
#5

posY - this will store your textdraw Y position
height - this will be your textdraw height (TextSize)
startY - put in your default position of scrollbar (where the scroll bar starts from)
maxHeight - maximum height the scollbar can have, expand your scrollbar to max and note the TextSize of Y
totalItems - how many items are there in your list
pageSize - how many items a page can display
currentPage - by default your scrollbar will start from 0, you can set this to whatever page you wish to start from

PHP код:
stock ScrollBar(&Float:posY, &Float:heightFloat:startYFloat:maxHeighttotalItemspageSizecurrentPage 0) {
    
// calculate how many pages can be possible
    
new pages = (totalItems pageSize) + ((totalItems pageSize) ? 0);
    
// scrollbar height (Y-axis)
    
height = (maxHeight pages);
    
    
// scrollbar position (Y-axis)
    // the position adjust with the page number you set in "currentPage" (0 = startY)
    
posY startY;
    
posY += (height currentPage);

Note: Use font type 4 for making scrollbar textdraw, the algorithm works perfectly for it. Recommended to use "LD_SPAC:WHITE" or "LD_SPAC:BLACK" sprites.

Example usage: (why not)
PHP код:
new PlayerText:scrollPTD[MAX_PLAYERS];
public 
OnPlayerConnect(playerid) {
    new 
Float:yFloat:height;
    
ScrollBar(yheight166.5108.010010); // 100 items and each page handles 10 items
    
    
scrollPTD[playerid] = CreatePlayerTextDraw(playerid489.0000y"LD_SPAC:WHITE");
    
PlayerTextDrawFont(playeridscrollPTD[playerid], 4);
    
PlayerTextDrawLetterSize(playeridscrollPTD[playerid], 0.000018.2000);
    
PlayerTextDrawColor(playeridscrollPTD[playerid], -16776961);
    
PlayerTextDrawSetShadow(playeridscrollPTD[playerid], 0);
    
PlayerTextDrawSetOutline(playeridscrollPTD[playerid], 0);
    
PlayerTextDrawBackgroundColor(playeridscrollPTD[playerid], 255);
    
PlayerTextDrawSetProportional(playeridscrollPTD[playerid], 1);
    
PlayerTextDrawUseBox(playeridscrollPTD[playerid], 1);
    
PlayerTextDrawBoxColor(playeridscrollPTD[playerid], 150);
    
PlayerTextDrawTextSize(playeridscrollPTD[playerid], 7.5000height);
    
PlayerTextDrawShow(playeridscrollPTD[playerid]);

Reply


Messages In This Thread
Textdraw scrollbar - by jasperschellekens - 08.02.2018, 16:07
Re: Textdraw scrollbar - by Mugala - 08.02.2018, 16:48
Re: Textdraw scrollbar - by jasperschellekens - 08.02.2018, 19:13
Re: Textdraw scrollbar - by solstice_ - 08.02.2018, 19:42
Re: Textdraw scrollbar - by Gammix - 08.02.2018, 21:07
Re: Textdraw scrollbar - by jasperschellekens - 09.02.2018, 00:37

Forum Jump:


Users browsing this thread: 1 Guest(s)