How can I list up to X messages and split the messages between "pages"
#1

PHP Code:
forward ListCreatedVehicles(playeridpage);
public 
ListCreatedVehicles(playeridpage)
{
    if(
page >= && page createdVehiclesCount//Check if the page is within the array maximum index and minimum index (0)
    
{
        new 
msg[128], color;
        
format(msgsizeof(msg), "Listing created vehicles, page %i"page);
        
SendClientMessage(playeridCOLOR_WHITEmsg);
        for(new 
= (page 1) * 5createdVehiclesCounti++) //i will always be equal to the number of pages minus one multiplied by five, so we can display the list to the player from the point of the page start
        
{
            new 
Float:xFloat:yFloat:zFloat:distance;
            
distance GetPlayerDistanceFromPoint(playeridxyz);
            
color COLOR_LIGHTGREY;
            if((
1) % == 0)
                
color COLOR_WHITE;
            
format(msgsizeof(msg), "ID: %i, Model: %i, Distance: %d"createdVehicles[i], GetVehicleModel(createdVehicles[i]), distance);
            
SendClientMessage(playeridcolormsg);
        }
        return 
1;
    }
    return 
0;

This is what I have been trying so far but it doesn't work, it lists all of the created vehicles in one message and I want it to list only 5 in each page.
Reply
#2

http://forum.sa-mp.com/showpost.php?...5&postcount=12

Basically, something like:

PHP Code:
if(page == 1)
        
fulllist "{FFFF00}Page 1\n";
    
    else 
format(fulllistsizeof(fulllist), "%s{FFFF00}<< Page %d\n"fulllistpage-1);
    
page--;
    
    for(new 
page*MAX_PLOG_PER_PAGErowsi++)
    {
        
count++;
        
        if(
count == MAX_PLOG_PER_PAGE 1)
        {
            
secondPage true;
            break; 
        }
        else
        {
            
cache_get_field_content(i"log_detail"logStrm_Handle256);
        
            
format(fulllistsizeof(fulllist), "%s%s\n"fulllistlogStr);  
        }
    }
    if(
secondPage)
        
format(fulllistsizeof(fulllist), "%s{FFFF00}Page %d >>\n"fulllist, (page+1)+1); 
Reply
#3

That makes perfect sense, thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)