c1berlooser
Дебютант
Всем привет, столкнулся тут с одной проблемой и уже какое время не знаю как её решить, хочу обратиться сюда за помощь, в надежде что мне помогут.
Короче, делаю систему выбора скина, и все почти работает, сделал 8 мужских синов и 5 женских, сделал 2 стрелочки, стрелочка влево и стрелочка вправо, и стрелочка в право работает как надо.
Все переменные:
Дальше идёт Spawn в интерьер с выбором скина
Дальше идём к кликабельности
Вопрос каков: СТРЕЛОЧКА ВПРАВО РАБОТАЕТ ИДЕАЛЬНО, ПОКАЗЫВАЕТ ВСЕ 8 мужских и 5 женских скинов, я как понял они в переменной записаны как (0, 1, 2, 3, 4, 5, 6, 7), так вот, а стрелочка влево работает только 7, 6, 5, 4, 3, 2, 1, скин который в переменной находиться по 0, не показывается, а если правой стрелочкой дошел до скина 0, то при нажатие на левую стрелочку ничего не происходит и я получаю это.
Короче, делаю систему выбора скина, и все почти работает, сделал 8 мужских синов и 5 женских, сделал 2 стрелочки, стрелочка влево и стрелочка вправо, и стрелочка в право работает как надо.
Все переменные:
PHP:
new Text:ButtonLeft;
new Text:ButtonRight;
new Text:ButtonPrev;
new Text:ButtonNext;
new Text:ButtonSelect;
new SkinMan[8] = { 78,79,137,200,134,136,160,159 };
new SkinWooman[5] = { 151,157,196,197,198 };
new SelectSkin[MAX_PLAYERS char];
Код:
SelectSkin{playerid} = 0;
if(pInfo[playerid][pGender] == 1) SetPlayerSkin(playerid, SkinMan[SelectSkin{playerid}]);
else SetPlayerSkin(playerid, SkinWooman[SelectSkin{playerid}]);
Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(clickedid == ButtonLeft)
{
if(pInfo[playerid][pGender] == 1)
{
SelectSkin{playerid} --;
if(SelectSkin{playerid} <= 0)
{
SelectSkin{playerid} = 8;
}
SetPlayerSkin(playerid, SkinMan[SelectSkin{playerid}]);
}
else if(pInfo[playerid][pGender] == 2)
{
SelectSkin{playerid} --;
if(SelectSkin{playerid} <= 0)
{
SelectSkin{playerid} = 5;
}
SetPlayerSkin(playerid, SkinWooman[SelectSkin{playerid}]);
}
}
if(clickedid == ButtonRight)
{
if(pInfo[playerid][pGender] == 1)
{
SelectSkin{playerid} ++;
if(SelectSkin{playerid} >= 8)
{
SelectSkin{playerid} = 0;
}
SetPlayerSkin(playerid, SkinMan[SelectSkin{playerid}]);
}
else if(pInfo[playerid][pGender] == 2)
{
SelectSkin{playerid} ++;
if(SelectSkin{playerid} >= 5)
{
SelectSkin{playerid} = 0;
}
SetPlayerSkin(playerid, SkinWooman[SelectSkin{playerid}]);
}
}
if(clickedid == ButtonSelect)
{
SetPVarInt(playerid, "selectskin", 0);
pInfo[playerid][pSkin] = GetPlayerSkin(playerid);
pInfo[playerid][pMoney] = 750;
static const fmt_query[] = "INSERT INTO `users`\
(`name`, `pass`, `email`, `gender`, `skin`, `money`)\
VALUES\
('%s', '%s', '%s', '%d', '%d', '%d')";
new query[sizeof(fmt_query)+(-2+MAX_PLAYER_NAME)+(-2+32)+(-2+64)+(-2+1)+(-2+3)+(-2+11)];
format(query, sizeof(query), fmt_query,
pInfo[playerid][pName],
pInfo[playerid][pPass],
pInfo[playerid][pEmail],
pInfo[playerid][pGender],
pInfo[playerid][pSkin],
pInfo[playerid][pMoney]);
mysql_query(dbHandle, query);
SpawnPlayer(playerid);
}
if(clickedid == Text:INVALID_TEXT_DRAW)
{
SelectTextDraw(playerid, 0xFFFFFFFF);
}
return 1;
}
Код:
[06:28:27] [debug] #0 0000a490 in public OnPlayerClickTextDraw (playerid=0, Text:clickedid=0) at C:\Users\tanya\Desktop\Povtorim\gamemodes\samogon.pwn:415
[06:28:27] [debug] Run time error 4: "Array index out of bounds"
[06:28:27] [debug] Attempted to read/write array element at index 253 in array of size 8
[06:28:27] [debug] AMX backtrace:
[06:28:27] [debug] #0 0000a490 in public OnPlayerClickTextDraw (playerid=0, Text:clickedid=0) at C:\Users\tanya\Desktop\Povtorim\gamemodes\samogon.pwn:415
[06:28:28] [debug] Run time error 4: "Array index out of bounds"
[06:28:28] [debug] Attempted to read/write array element at index 252 in array of size 8
[06:28:28] [debug] AMX backtrace:
[06:28:28] [debug] #0 0000a490 in public OnPlayerClickTextDraw (playerid=0, Text:clickedid=0) at C:\Users\tanya\Desktop\Povtorim\gamemodes\samogon.pwn:415
[06:28:28] [debug] Run time error 4: "Array index out of bounds"
[06:28:28] [debug] Attempted to read/write array element at index 251 in array of size 8
[06:28:28] [debug] AMX backtrace:
[06:28:28] [debug] #0 0000a490 in public OnPlayerClickTextDraw (playerid=0, Text:clickedid=0) at C:\Users\tanya\Desktop\Povtorim\gamemodes\samogon.pwn:415
[06:28:28] [debug] Run time error 4: "Array index out of bounds"
[06:28:28] [debug] Attempted to read/write array element at index 250 in array of size 8
[06:28:28] [debug] AMX backtrace:
[06:28:28] [debug] #0 0000a490 in public OnPlayerClickTextDraw (playerid=0, Text:clickedid=0) at C:\Users\tanya\Desktop\Povtorim\gamemodes\samogon.pwn:415
[06:28:28] [debug] Run time error 4: "Array index out of bounds"
[06:28:28] [debug] Attempted to read/write array element at index 249 in array of size 8
[06:28:28] [debug] AMX backtrace:
[06:28:28] [debug] #0 0000a490 in public OnPlayerClickTextDraw (playerid=0, Text:clickedid=0) at C:\Users\tanya\Desktop\Povtorim\gamemodes\samogon.pwn:415
[06:28:28] [debug] Run time error 4: "Array index out of bounds"
[06:28:28] [debug] Attempted to read/write array element at index 248 in array of size 8
[06:28:28] [debug] AMX backtrace:
[06:28:28] [debug] #0 0000a490 in public OnPlayerClickTextDraw (playerid=0, Text:clickedid=0) at C:\Users\tanya\Desktop\Povtorim\gamemodes\samogon.pwn:415
[06:28:28] [debug] Run time error 4: "Array index out of bounds"
[06:28:28] [debug] Attempted to read/write array element at index 247 in array of size 8
[06:28:28] [debug] AMX backtrace:
[06:28:28] [debug] #0 0000a490 in public OnPlayerClickTextDraw (playerid=0, Text:clickedid=0) at C:\Users\tanya\Desktop\Povtorim\gamemodes\samogon.pwn:415
[06:28:32] [part] Winteeeeeeer_yitrt has left the server (0:1)
