SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 31/10/2017, 09:26 AM   #1
EtayJ
Big Clucker
 
Join Date: Oct 2013
Posts: 87
Reputation: 22
Default How can I list up to X messages and split the messages between "pages"

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.
EtayJ is offline   Reply With Quote
Old 31/10/2017, 09:55 AM   #2
Kane
Gangsta
 
Kane's Avatar
 
Join Date: Sep 2012
Posts: 822
Reputation: 130
Default Re: How can I list up to X messages and split the messages between "pages"

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); 
__________________
Los Santos Roleplay - Developer
@ls-rp.com

Former Beta Tester

Kane is offline   Reply With Quote
Old 31/10/2017, 10:13 AM   #3
EtayJ
Big Clucker
 
Join Date: Oct 2013
Posts: 87
Reputation: 22
Default Re: How can I list up to X messages and split the messages between "pages"

That makes perfect sense, thank you!
EtayJ 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
[Include] "lbc_messages" - Send complex client messages LeBoyce Includes 6 11/11/2013 09:36 PM
How to remove the "_" from all the server messages alanhutch Scripting Help 5 24/07/2013 10:00 PM
[FilterScript] Welcome Messages Basic V2- Under Development (Still adding messages and commands) xF3AR Filterscripts 11 30/03/2013 09:20 AM
My "samp-server" wont start up! Just starts for a split second. Please help! Branchy Server Support 6 14/04/2012 11:54 AM
undefined symbol "split" eDz0r Help Archive 3 03/12/2010 06:44 PM


All times are GMT. The time now is 09:33 AM.


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