axeqwer
Новичок
Парни, не могу понять в чем проблема, создаю через команду дом с 6 айди, создается пикап, я на него наступаю, а мне показывает диалог 5 дома, что за черт? 0 пикап вообще не работает, встаю на 1 - показывает 0 пикап...
Выложу сюда побольше, на всякий случай)
OnPlayerPickUpPickup
В чем косяк?
Выложу сюда побольше, на всякий случай)
PHP:
new TotalHouses = -1;
PHP:
public HouseLoad()
{
new rows, fields, time = GetTickCount();
cache_get_data(rows, fields);
for(new i = 0; i < rows; i++)
{
hInfo[i][ID] = cache_get_field_content_int(i, "ID", mysql);
cache_get_field_content(i, "Owner", hInfo[i][Owner], mysql, 24);
cache_get_field_content(i, "Renter", hInfo[i][Renter], mysql, 24);
hInfo[i][Price] = cache_get_field_content_int(i, "Price", mysql);
hInfo[i][EnterX] = cache_get_field_content_float(i, "EnterX", mysql);
hInfo[i][EnterY] = cache_get_field_content_float(i, "EnterY", mysql);
hInfo[i][EnterZ] = cache_get_field_content_float(i, "EnterZ", mysql);
hInfo[i][ExitX] = cache_get_field_content_float(i, "ExitX", mysql);
hInfo[i][ExitY] = cache_get_field_content_float(i, "ExitY", mysql);
hInfo[i][ExitZ] = cache_get_field_content_float(i, "ExitZ", mysql);
hInfo[i][CarX] = cache_get_field_content_float(i, "CarX", mysql);
hInfo[i][CarY] = cache_get_field_content_float(i, "CarY", mysql);
hInfo[i][CarZ] = cache_get_field_content_float(i, "CarZ", mysql);
hInfo[i][CarA] = cache_get_field_content_float(i, "CarA", mysql);
hInfo[i][Lock] = cache_get_field_content_int(i, "Lock", mysql);
hInfo[i][Class] = cache_get_field_content_int(i, "Class", mysql);
hInfo[i][Int] = cache_get_field_content_int(i, "Int", mysql);
hInfo[i][Status] = cache_get_field_content_int(i, "Status", mysql);
if(hInfo[i][Status] == 0)
{
hInfo[i][Pickup] = CreatePickup(1273, 23, hInfo[i][EnterX], hInfo[i][EnterY], hInfo[i][EnterZ], 0);
hInfo[i][Icon] = CreateDynamicMapIcon(hInfo[i][EnterX], hInfo[i][EnterY], hInfo[i][EnterZ], 31, COLOR_WHITE, 0, -1, -1);
}
else
{
hInfo[i][Pickup] = CreatePickup(1272, 23, hInfo[i][EnterX], hInfo[i][EnterY], hInfo[i][EnterZ], 0);
hInfo[i][Icon] = CreateDynamicMapIcon(hInfo[i][EnterX], hInfo[i][EnterY], hInfo[i][EnterZ], 32, COLOR_WHITE, 0, -1, -1);
}
TotalHouses++;
}
return 1;
}
PHP:
CMD:addhouse(playerid, params[])
{
if(pInfo[playerid][Admin] != 5) return 1;
if(sscanf(params, "dd",params[0], params[1])) return SendClientMessage(playerid, COLOR_WHITE, "Введите: /addhouse [класс]");
TotalHouses++;
printf("%d", TotalHouses);
new Float: posX, Float: posY, Float: posZ, string[336], prand[4], intrand[4];
GetPlayerPos(playerid, posX, posY, posZ);
hInfo[TotalHouses][EnterX] = posX;
hInfo[TotalHouses][EnterY] = posY;
hInfo[TotalHouses][EnterZ] = posZ;
hInfo[TotalHouses][Lock] = 1;
hInfo[TotalHouses][Class] = params[0];
if(hInfo[TotalHouses][Class] == 0)
{
prand[0] = random(4);
intrand[0] = random(2);
switch(intrand[0])
{
case 0: { hInfo[TotalHouses][Int] = 12; hInfo[TotalHouses][ExitX] = 2324.419921; hInfo[TotalHouses][ExitY] = -1145.568359; hInfo[TotalHouses][ExitZ] = 1050.710083; }
case 1: { hInfo[TotalHouses][Int] = 3; hInfo[TotalHouses][ExitX] = 1527.229980; hInfo[TotalHouses][ExitY] = -11.574499; hInfo[TotalHouses][ExitZ] = 1002.097106; }
}
switch(prand[0])
{
case 0: hInfo[TotalHouses][Price] = 5000;
case 1: hInfo[TotalHouses][Price] = 6000;
case 2: hInfo[TotalHouses][Price] = 7000;
case 3: hInfo[TotalHouses][Price] = 8000;
}
}
hInfo[TotalHouses][Pickup] = CreatePickup(1273, 23, hInfo[TotalHouses][EnterX], hInfo[TotalHouses][EnterY], hInfo[TotalHouses][EnterZ],-1);
hInfo[TotalHouses][Icon] = CreateDynamicMapIcon(hInfo[TotalHouses][EnterX], hInfo[TotalHouses][EnterY], hInfo[TotalHouses][EnterZ], 31, COLOR_WHITE, 0, -1, -1);
SendClientMessage(playerid,COLOR_WHITE,"Дом создан. Используйте /carpos");
strmid(hInfo[TotalHouses][Owner], "The State", 0, strlen("The State"), 32);
strmid(hInfo[TotalHouses][Renter], "None", 0, strlen("None"), 32);
format(string, sizeof(string), "INSERT INTO `house` (`EnterX`, `EnterY`, `EnterZ`, `Lock`, `Class`, `ExitX`, `ExitY`, `ExitZ`, `Int`, `Price`, `ID`, `Owner`, `Renter`) VALUES ('%f', '%f', '%f', '0', '%d', '%f', '%f', '%f', '%d', '%d', '%d', '%s', '%s')",
hInfo[TotalHouses][EnterX],hInfo[TotalHouses][EnterY],hInfo[TotalHouses][EnterZ],params[0],hInfo[TotalHouses][ExitX],hInfo[TotalHouses][ExitY],hInfo[TotalHouses][ExitZ],hInfo[TotalHouses][Int], hInfo[TotalHouses][Price], TotalHouses, hInfo[TotalHouses][Owner], hInfo[TotalHouses][Renter]);
mysql_tquery(mysql, string, "", "");
return 1;
}
PHP:
for(new h = 0; h < TotalHouses; h++)
{
if(pickupid == hInfo[h][Pickup])
{
printf("%d", h);
if(hInfo[h][Status] == 1)
{
string[64];
format(string, sizeof(string), "Номер дома: {FFFF00}%d",h);
ShowPlayerDialogEx(playerid,3,DIALOG_STYLE_MSGBOX, "Дом занят",string, "Войти", "Отмена");
return 1;
}
else
{
string[64];
format(string, sizeof(string), "Номер дома: {FFFF00}%d",h);
ShowPlayerDialogEx(playerid,4,DIALOG_STYLE_MSGBOX, "Дом свободен",string, "Войти", "Отмена");
return 1;
}
}
}
Последнее редактирование:
