// Define your spawnpoints
new Float:spawnPoints[][3] = {
{x1, y1, z1}, // coordinates of spawnpoint 1
{x2, y2, z2}, // coordinates of spawnpoint 2
// add more spawnpoints as needed
};
// Dialog ID for the spawnpoint selection dialog
#define DIALOG_SPAWNPOINT 1
// Create a function to show the spawnpoint selection dialog
ShowSpawnpointDialog(playerid) {
ShowPlayerDialog(playerid, DIALOG_SPAWNPOINT, DIALOG_STYLE_LIST, "Select a Spawnpoint", "Select", "Cancel", -1);
// Add spawnpoint options to the dialog
for (new i = 0; i < sizeof(spawnPoints); i++) {
AddDialogComponentString(DIALOG_SPAWNPOINT, i + 1, "Spawnpoint " + (i + 1));
}
// Show the dialog to the player
SendDialog(playerid, DIALOG_SPAWNPOINT, DIALOG_STYLE_LIST, "Select a Spawnpoint");
}
// Handle dialog response
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
if (dialogid == DIALOG_SPAWNPOINT && response) {
// Player selected a spawnpoint
new spawnpointIndex = listitem - 1;
SetPlayerPos(playerid, spawnPoints[spawnpointIndex][0], spawnPoints[spawnpointIndex][1], spawnPoints[spawnpointIndex][2]);
SendClientMessage(playerid, COLOR_YELLOW, "You have been spawned at spawnpoint " + (spawnpointIndex + 1));
return 1;
}
return 0;
}