Is this possible in a dialog? -
AphexCCFC - 30.04.2014
Is it even possible to teleport to a house ID displayed in a dialog if the houses are being looped?
pawn Код:
CMD:houses(playerid, params[])
{
new string[500];
if(!IsPlayerLoggedIn(playerid))
{
SendClientMessage(playerid, COLOR_RED, "Error"White": You are restricted from using commands until you log in.");
return 1;
}
if(PlayerInfo[playerid][pAdminLevel] < 1)
{
SendClientMessage(playerid, COLOR_RED, "Error"White": You do not have the authority to use this command.");
return 1;
}
if(!AdminDuty[playerid])
{
SendClientMessage(playerid, COLOR_RED, "Error"White": You are not on duty as an Administrator (/aduty).");
return 1;
}
for(new i = 1; i < MAX_HOUSES; i++)
{
if(HouseInfo[i][hHouseID] == i)
{
format(string, sizeof(string), "%sID: %d - Address: %s - Owner: %s\n", string, HouseInfo[i][hHouseID], HouseInfo[i][hAddress], HouseInfo[i][hOwner]);
}
}
ShowPlayerDialog(playerid, DIALOG_HOUSES, DIALOG_STYLE_LIST, ""Lightblue"House List", string, "Visit", "Cancel");
return 1;
}
I need it so when an administrator clicks "Visit", it teleports them to the house they select in the list.
I can sort everything else out just not sure if it's possible, and if it is possible how do I know how many switch cases to make under OnDialogResponse?
Re: Is this possible in a dialog? -
Aerotactics - 01.05.2014
I don't think it would work
that way, but I would recommend using sscanf to ask the admin for a houseid, so the command would be "/visit [houseid]" because if you have 250+ houses, you wouldn't want to have to search the whole list for the right house. This way, you could assign the house a name, or even an address, so if I wanted to go to "5555 West Los Santos Avenue" I could input the command "/goto 5555" assuming every house has a different house number.
Re: Is this possible in a dialog? -
JoeMercury - 01.05.2014
I have a thought on how you could have an infinite number of houses. For example; Set up about 50 house icons on the map with each having an x,y,z marker location. Joe_Mercury comes up and buys a house at x,y,z and that is recorded to your dbase file as x,y,z under the owner's home and which interior should be used.
Now if John_Smith buys the same house at the same location how would Joe_Mercury even know? You end up with houses available for all the players. If the players house x,y,z location is 0.0,0.0,0.0 then they don't own a home.
This eliminates the need to record 250+ houses. The real trick would be avoiding overlap when you teleport them "inside" the home since there are actually very few interiors in the game.
Re: Is this possible in a dialog? -
Luis- - 01.05.2014
You could do this by using listitem, i've done it with a similar thing before.
Re: Is this possible in a dialog? -
milanosie - 01.05.2014
This is more than definitely possible, you'll want to catch the "listitem" and use it as the house ID (Or in most cases listitem + 1, depending on wether you have house ID 0 or 1).
AW: Is this possible in a dialog? -
Nero_3D - 01.05.2014
You should use sscanf and extract the houseid from inputtext (or strfind)
Re: Is this possible in a dialog? -
AphexCCFC - 01.05.2014
Thanks guys, was a bad idea listing houses in dialogs cause it only displays 10 at a time ha