02.08.2014, 02:23
PPC_Trucking
COMMAND:comboio(playerid, params[])
{
// Setup local variables
new ConvoyList[750], Name[24], NumMembers, ConvoyStatus[10];
// Send the command to all admins so they can see it
SendAdminText(playerid, "/comboio", params);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Create the list of convoys with all their data
for (new i; i < MAX_CONVOYS; i++)
{
// Check if this is an empty convoy (not created yet by a player)
if (AConvoys[i][Status] == CONVOY_EMPTY)
{
// Setup data for an empty convoy (one which hasn't been chosen yet)
NumMembers = 0;
format(Name, 24, "nenhum");
format(ConvoyStatus, 10, "vazio");
}
else
{
// Get the name of the convoy-leader
GetPlayerName(AConvoys[i][Members][0], Name, sizeof(Name));
// Calculate the members in the convoy
NumMembers = Convoy_CountMembers(i);
// Set the status of the convoy
switch (AConvoys[i][Status])
{
case CONVOY_OPEN: format(ConvoyStatus, 10, "Aberto");
case CONVOY_FULL: format(ConvoyStatus, 10, "Cheio");
case CONVOY_CLOSED: format(ConvoyStatus, 10, "Fechado");
}
}
// Put all data together to form the content of the entire dialog
format(ConvoyList, sizeof(ConvoyList), "%sLнder: {FFFF00}%s{FFFFFF}, membros: {FFFF00}%i{FFFFFF}, Status: {FFFF00}%s{FFFFFF}\n", ConvoyList, Name, NumMembers, ConvoyStatus);
}
// Show the dialog
ShowPlayerDialog(playerid, DialogSelectConvoy, DIALOG_STYLE_LIST, "Selecione o comboio:", ConvoyList, "Selecionar", "Cancelar");
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}
COMMAND:comboio(playerid, params[])
{
// Setup local variables
new ConvoyList[750], Name[24], NumMembers, ConvoyStatus[10];
// Send the command to all admins so they can see it
SendAdminText(playerid, "/comboio", params);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Create the list of convoys with all their data
for (new i; i < MAX_CONVOYS; i++)
{
// Check if this is an empty convoy (not created yet by a player)
if (AConvoys[i][Status] == CONVOY_EMPTY)
{
// Setup data for an empty convoy (one which hasn't been chosen yet)
NumMembers = 0;
format(Name, 24, "nenhum");
format(ConvoyStatus, 10, "vazio");
}
else
{
// Get the name of the convoy-leader
GetPlayerName(AConvoys[i][Members][0], Name, sizeof(Name));
// Calculate the members in the convoy
NumMembers = Convoy_CountMembers(i);
// Set the status of the convoy
switch (AConvoys[i][Status])
{
case CONVOY_OPEN: format(ConvoyStatus, 10, "Aberto");
case CONVOY_FULL: format(ConvoyStatus, 10, "Cheio");
case CONVOY_CLOSED: format(ConvoyStatus, 10, "Fechado");
}
}
// Put all data together to form the content of the entire dialog
format(ConvoyList, sizeof(ConvoyList), "%sLнder: {FFFF00}%s{FFFFFF}, membros: {FFFF00}%i{FFFFFF}, Status: {FFFF00}%s{FFFFFF}\n", ConvoyList, Name, NumMembers, ConvoyStatus);
}
// Show the dialog
ShowPlayerDialog(playerid, DialogSelectConvoy, DIALOG_STYLE_LIST, "Selecione o comboio:", ConvoyList, "Selecionar", "Cancelar");
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}