// Lets the player choose a car to spawn (in a split list which shows only 10 cars at a time) COMMAND:vcar(playerid, params[]) { // Check if the player has logged in if (APlayerData[playerid][LoggedIn] == true) { // Check if the player's admin-level is at least 1 if(PlayerInfo[playerid][pVIP] >= 2) { // Make sure the player isn't inside a vehicle if(GetPlayerVehicleID(playerid) == 0) CarList_Create(playerid); // Create a list of cars (only the first 10 cars) and show the dialog so the player can choose a car return 1; } } else return 0; // Let the server know that this was a valid command return 1; } // Lets the player choose a car to spawn (in a split list which shows only 10 cars at a time) COMMAND:car(playerid, params[]) { // Check if the player has logged in if (APlayerData[playerid][LoggedIn] == true) { // Check if the player's admin-level is at least 1 if (APlayerData[playerid][PlayerLevel] >= 1) { // Make sure the player isn't inside a vehicle if(GetPlayerVehicleID(playerid) == 0) CarList_Create(playerid); // Create a list of cars (only the first 10 cars) and show the dialog so the player can choose a car return 1; } } else return 0; // Let the server know that this was a valid command return 1; }
return 0;
return SendClientMessage(playerid, -1, "Invalid level!");
// Lets the player choose a car to spawn (in a split list which shows only 10 cars at a time) COMMAND:vcar(playerid, params[]) { // Check if the player has logged in if (APlayerData[playerid][LoggedIn] == true) { // Check if the player's admin-level is at least 1 if(PlayerInfo[playerid][pVIP] >= 2) { // Make sure the player isn't inside a vehicle if(GetPlayerVehicleID(playerid) == 0) CarList_Create(playerid); // Create a list of cars (only the first 10 cars) and show the dialog so the player can choose a car } } // Let the server know that this was a valid command return 1; }
What is the problem, that command looks good, I do not understand, try it out with this sr.
Do you have defined in your script "CarList_Create" ?. pawn Код:
|
// This function creates a list of cars, starting from the FirstCar and automatically shows the dialog
CarList_Create(playerid)
{
// Setup local variables
new Counter, CarList[500], DialogTitle[128];
// Only add 10 cars to the list, starting from the FirstCar
for (new i = APlayerData[playerid][DialogCarFirstCar]; i < sizeof(ACars); i++)
{
// Increase a counter (which holds the number of cars that have been added to the list
Counter++;
// Check if the maximum hasn't been reached yet
if (Counter <= 10)
{
// Add the carname to the list
if (strlen(CarList) == 0) // If this is the start of the list (no cars have been added yet)
format(CarList, 500, "%s", ACars[i][CarName]); // Add the name of the car at the start of the carlist
else
format(CarList, 500, "%s%s%s", CarList, "\n", ACars[i][CarName]); // Add the name of the next car to the list on the next line
}
else // 10 cars have been added to the list (now Counter = 11)
{
// Add an empty line and "Next..." to the list to let the player know there are more cars to choose from
format(CarList, 500, "%s%s%s", CarList, "\n \n", TXT_DialogEntryNext);
// Also stop the For-loop
break;
}
}
// Construct the title for the dialog (to include a page number)
format(DialogTitle, 128, TXT_DialogCarTitle, (APlayerData[playerid][DialogCarFirstCar] / 10) + 1);
// Ask which car the player wants to have by showing the dialog
ShowPlayerDialog(playerid, DialogCar, DIALOG_STYLE_LIST, DialogTitle, CarList, TXT_DialogButtonSpawn, TXT_DialogButtonCancel);
return 1;
}
COMMAND:vcar(playerid, params[])
{
if(APlayerData[playerid][LoggedIn] != true)return SendClientMessage(playerid, -1, "{ff0000}You need to be logged in to use this command");
if(PlayerInfo[playerid][pVIP] < 2)return SendClientMessage(playerid, -1, "{ff0000}You need to be a vip to use this command");
if(IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, -1, "{ff0000}You need to be out of the vehicle to use this command.");
CarList_Create(playerid);
return 1;
}
COMMAND:car(playerid, params[])
{
if (APlayerData[playerid][LoggedIn] != true)return SendClientMessage(playerid, -1, "{ff0000}You need to be logged in to use this command");
if (APlayerData[playerid][PlayerLevel] < 1)return SendClientMessage(playerid, -1, "{ff0000}You need to be ADMIN in to use this command");
if(IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, -1, "{ff0000}You need to be out of the vehicle to use this command.");
CarList_Create(playerid);
return 1;
}