Doni_Dit
Умник
И снова здравствуйте! Смотри такая ошибка, при покупке скина, если ты сразу выбираешь стрелочку "налево" то скин меняется, но выдается ошибка
А если "направо" то все отлично, скин и цена меняется, ошибки нет.
Что касаемо кода
Куда указывает ошибка:
Массив где хранятся скины:
Начало работы:
Код:
[03:28:34] [debug] Run time error 4: "Array index out of bounds"
[03:28:34] [debug] Attempted to read/write array element at index 72 in array of size 39
[03:28:34] [debug] AMX backtrace:
[03:28:34] [debug] #0 00043214 in public OnPlayerClickTextDraw (playerid=0, Text:clickedid=7) at c:\Users\HOMEPC\Desktop\TestRP\gamemodes\testrp.pwn:7891
Что касаемо кода
Куда указывает ошибка:
Код:
if(clickedid == BuySkin[1])
{
new string[170];
if(ClothesRound{playerid} == 2)
{
if(pInfo[playerid][pSex] == 1)
{
if(SelectCharPlace{playerid} == 0) SelectCharPlace{playerid} = sizeof(JoinShopM)-1;
else SelectCharPlace{playerid}--;
SetPlayerSkin(playerid, JoinShopM[SelectCharPlace{playerid}][0]);
}
else
{
if(SelectCharPlace{playerid} == 0) SelectCharPlace{playerid} = sizeof(JoinShopF)-1;
else SelectCharPlace{playerid}--;
SetPlayerSkin(playerid, JoinShopF[SelectCharPlace{playerid}][0]);
}
format(string,sizeof(string),"%d руб", JoinShopF[SelectCharPlace{playerid}][1]);
PlayerTextDrawSetString(playerid, BuySkins[playerid],string);
SendMes(playerid, COLOR_RED, "[BETA] Цена: %d", JoinShopF[SelectCharPlace{playerid}][1]);
}
}
Код:
static const stock JoinShopF[][2] = {
{31, 2000},
{13, 2000},
{198, 2000},
{38, 2500},
{201, 2500},
{39, 6000},
{207, 10000},
{131, 15000},
{195, 15000},
{9, 20000},
{10, 20000},
{238, 20000},
{151, 50000},
{152, 90000},
{69, 90000},
{192, 100000},
{237, 140000},
{193, 150000},
{190, 160000},
{226, 180000},
{169, 250000},
{90, 280000},
{214, 300000},
{55, 300000},
{56, 300000},
{141, 300000},
{211, 300000},
{11, 300000},
{150, 350000},
{263, 350000},
{12, 350000},
{172, 400000},
{194, 400000},
{91, 450000},
{216, 450000},
{219, 450000},
{296, 450000},
{93, 500000},
{233, 550000}
};
Код:
stock BuySkinss(playerid)
{
if(ClothesRound{playerid} == 2)
{
new string[100];
SendClientMessage(playerid, COLOR_LIME, "Для отмены покупки используйте ESC.");
SetPlayerPos(playerid,2006.1174,-1131.8086,3012.3682);
SetPlayerFacingAngle(playerid,270.9297);
SetPlayerCameraPos(playerid, 2011.4735, -1131.9086, 3013.3640);
SetPlayerCameraLookAt(playerid, 2010.4751, -1131.9054, 3013.2900);
SetPlayerVirtualWorld(playerid, playerid);
SetPlayerInterior(playerid, 1);
TogglePlayerControllable(playerid, 0);
for(new i; i != 4; i++) TextDrawShowForPlayer(playerid, BuySkin[i]);
SelectTextDraw(playerid, 0xBF3030AA);
PlayerTextDrawShow(playerid, BuySkins[playerid]);
SelectCharPlace{playerid} = 0;
if(pInfo[playerid][pSex] == 1)
{
SetPlayerSkin(playerid, JoinShopM[SelectCharPlace{playerid}][0]);
}
else
{
SetPlayerSkin(playerid, JoinShopF[SelectCharPlace{playerid}][0]);
}
format(string,sizeof(string),"%d руб", JoinShopF[SelectCharPlace{playerid}][1]);
PlayerTextDrawSetString(playerid, BuySkins[playerid],string);
}
return 1;
}
