29.05.2015, 21:47
pawn Код:
COMMAND:gohome(playerid, params[])
{
new HouseList[258], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
for (new i, h = MAX_HOUSES; i != h; i++)
{
if(!strcmp(AHouseData[i][Owner], pName, false))
{
new iHouse[58];
format(iHouse, sizeof(iHouse), "{00FF00}%s{FFFFFF}\n", AHouseData[i][HouseName]);
strcat(HouseList, iHouse);
}
}
ShowPlayerDialog(playerid, DialogGoHome, DIALOG_STYLE_TABLIST, "Choose your house :", HouseList, "Select", "Cancel");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DialogGoHome && response)
{
new iCount, pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
for (new i, h = MAX_HOUSES; i != h; i++)
{
if(!strcmp(AHouseData[i][Owner], pName, false))
{
if(iCount == listitem)
{
SetPlayerPos(playerid, housecordx, housecordy, housecordz);
break;
}
iCount++;
}
}
}
if(dialogid == DialogGoHome && !response) return 0;
}