31.10.2017, 09:26
PHP Code:
forward ListCreatedVehicles(playerid, page);
public ListCreatedVehicles(playerid, page)
{
if(page - 1 >= 0 && page - 1 < createdVehiclesCount) //Check if the page is within the array maximum index and minimum index (0)
{
new msg[128], color;
format(msg, sizeof(msg), "Listing created vehicles, page %i", page);
SendClientMessage(playerid, COLOR_WHITE, msg);
for(new i = (page - 1) * 5; i < createdVehiclesCount; i++) //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:x, Float:y, Float:z, Float:distance;
distance = GetPlayerDistanceFromPoint(playerid, x, y, z);
color = COLOR_LIGHTGREY;
if((i + 1) % 2 == 0)
color = COLOR_WHITE;
format(msg, sizeof(msg), "ID: %i, Model: %i, Distance: %d", createdVehicles[i], GetVehicleModel(createdVehicles[i]), distance);
SendClientMessage(playerid, color, msg);
}
return 1;
}
return 0;
}