08.02.2018, 16:07
How to create a textdraw scrollbar like in this picture:
I have searched but can not find anything of it.
I have searched but can not find anything of it.
idk, this thread can be usefull > https://sampforum.blast.hk/showthread.php?tid=570213
|
stock ScrollBar(&Float:posY, &Float:height, Float:startY, Float:maxHeight, totalItems, pageSize, currentPage = 0) {
// calculate how many pages can be possible
new pages = (totalItems / pageSize) + ((totalItems % pageSize) ? 1 : 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);
}
new PlayerText:scrollPTD[MAX_PLAYERS];
public OnPlayerConnect(playerid) {
new Float:y, Float:height;
ScrollBar(y, height, 166.5, 108.0, 100, 10); // 100 items and each page handles 10 items
scrollPTD[playerid] = CreatePlayerTextDraw(playerid, 489.0000, y, "LD_SPAC:WHITE");
PlayerTextDrawFont(playerid, scrollPTD[playerid], 4);
PlayerTextDrawLetterSize(playerid, scrollPTD[playerid], 0.0000, 18.2000);
PlayerTextDrawColor(playerid, scrollPTD[playerid], -16776961);
PlayerTextDrawSetShadow(playerid, scrollPTD[playerid], 0);
PlayerTextDrawSetOutline(playerid, scrollPTD[playerid], 0);
PlayerTextDrawBackgroundColor(playerid, scrollPTD[playerid], 255);
PlayerTextDrawSetProportional(playerid, scrollPTD[playerid], 1);
PlayerTextDrawUseBox(playerid, scrollPTD[playerid], 1);
PlayerTextDrawBoxColor(playerid, scrollPTD[playerid], 150);
PlayerTextDrawTextSize(playerid, scrollPTD[playerid], 7.5000, height);
PlayerTextDrawShow(playerid, scrollPTD[playerid]);
}
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 код:
Example usage: (why not) PHP код:
|