El_Novik
Новичок
Здравствуй форум!
тут такая проблема, перевёл систему домов на r41.
и диалог покупки дома открывается только у дома под id 1.
В чём проблема? помогите пожалуйста.
тут такая проблема, перевёл систему домов на r41.
и диалог покупки дома открывается только у дома под id 1.
В чём проблема? помогите пожалуйста.
PHP:
f_public load_house()
{
new rows;
cache_get_row_count(rows);
for(new idx = 1; idx <= rows; idx++)
{
cache_get_value_name_int(idx-1, "hId", h_info[idx][h_id]);
cache_get_value_name(idx-1, "hOwner", h_info[idx][h_owner]);
cache_get_value_name_float(idx-1, "hEnterX", h_info[idx][h_enter][0]);
cache_get_value_name_float(idx-1, "hEnterY", h_info[idx][h_enter][1]);
cache_get_value_name_float(idx-1, "hEnterZ", h_info[idx][h_enter][2]);
cache_get_value_name_float(idx-1, "hExitX", h_info[idx][h_exit][0]);
cache_get_value_name_float(idx-1, "hExitY", h_info[idx][h_exit][1]);
cache_get_value_name_float(idx-1, "hExitZ", h_info[idx][h_exit][2]);
cache_get_value_name_int(idx-1, "hInt", h_info[idx][h_int]);
cache_get_value_name_int(idx-1, "hPrice", h_info[idx][h_price]);
cache_get_value_name_int(idx-1, "hLock", h_info[idx][h_lock]);
cache_get_value_name_int(idx-1, "hBuy", h_info[idx][h_buy]);
cache_get_value_name_float(idx-1, "hCarX", h_info[idx][h_car][0]);
cache_get_value_name_float(idx-1, "hCarY", h_info[idx][h_car][1]);
cache_get_value_name_float(idx-1, "hCarZ", h_info[idx][h_car][2]);
cache_get_value_name_float(idx-1, "hCarA", h_info[idx][h_car][3]);
if(!strcmp(h_info[idx][h_owner],"None",true))
{
h_info[idx][h_icon] = CreateDynamicMapIcon(h_info[idx][h_enter][0], h_info[idx][h_enter][1], h_info[idx][h_enter][2], 31, 0,-1,-1,-1,200.0);
h_info[idx][h_pick] = CreatePickup(1273, 1, h_info[idx][h_enter][0], h_info[idx][h_enter][1], h_info[idx][h_enter][2]);
}
else
{
h_info[idx][h_icon] = CreateDynamicMapIcon(h_info[idx][h_enter][0], h_info[idx][h_enter][1], h_info[idx][h_enter][2], 32, 0,-1,-1,-1,200.0);
h_info[idx][h_pick] = CreatePickup(1272, 1, h_info[idx][h_enter][0], h_info[idx][h_enter][1], h_info[idx][h_enter][2]);
}
h_info[idx][h_text] = Create3DTextLabel(""W"Чтобы войти - "B"/exit\n"W"Панель дома - "B"/hpanel", -1, h_info[idx][h_exit][0], h_info[idx][h_exit][1], h_info[idx][h_exit][2] + 0.6,5.0,idx,1);
house_total++;
}
return printf("[ Загрузил домов ]: [ %d ].", house_total);
}
PHP:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
for(new idx = 1; idx <= house_total; idx++)
{
if(newkeys & KEY_WALK)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, h_info[idx][h_enter][0], h_info[idx][h_enter][1], h_info[idx][h_enter][2]))
{
static const fmt_str[] = ""W"- Дом №:\t\t\t%d\n- Стоимость дома:\t\t%d$\n\n * Для покупки нажмите \t''"B"Купить"W"''.";
new str[sizeof fmt_str + 10 + 10];
static fmt_str1[] = ""W"- Дом №:\t\t\t%d\n- Владелец:\t\t\t%s | %s\n\n * Чтобы войти нажмите \t''"B"Войти"W"''.";
new str1[sizeof fmt_str1 + 10 + MAX_PLAYER_NAME*2 + 10];
SetPVarInt(playerid, "PlayerHouse", idx);
if(!strcmp(h_info[idx][h_owner], "None", true))
{
format(str, sizeof(str), fmt_str, idx, h_info[idx][h_price]);
ShowPlayerDialog(playerid, d_home, 0, ""Y"Дом", str, "Купить", "Отмена");
return true;
}
else
{
new honline[13+8] = ""R"Оффлайн";
for(new i=0; i<MAX_PLAYERS; i++)
{
if(!strcmp(GN(i), h_info[idx][h_owner]))
{
honline = ""G"Онлайн";
break;
}
}
format(str1, sizeof(str1), fmt_str1, idx, h_info[idx][h_owner], honline);
ShowPlayerDialog(playerid, d_home, 0,""Y"Дом", str1, "Войти", "Отмена");
return true;
}
}
}
return true;
}
return 1;
}
