Перемещение предметов по слотам. -
DeViLsS - 05.01.2015
Как сделать перемещение предметов по слотам.
Code:
for(new i; i < 48; i++)
{
if(playertextid == InvSlot[playerid][i])
{
if(GetPVarInt(playerid, "SelectSlot") == -1)
{
if(PlayerInfo[playerid][pInvSlot][i] != -1)
{
SetPVarInt(playerid, "SelectSlot", i);
PlayerTextDrawBackgroundColor(playerid, InvSlot[playerid][i], 0xf2ddc6ff);
PlayerTextDrawShow(playerid, InvSlot[playerid][i]);
}
}
else if(GetPVarInt(playerid, "SelectSlot") != -1)
{
if(PlayerInfo[playerid][pInvSlot][i] == -1)
{
SetPVarInt(playerid, "NewSelectSlot", i);
PlayerTextDrawBackgroundColor(playerid, InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")], -1061109505);
PlayerTextDrawShow(playerid, InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")]);
PlayerTextDrawSetPreviewModel(playerid,InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")], 1649);
PlayerTextDrawSetPreviewRot(playerid, InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")], 0.000000, 0.000000, 90.000000, 2.000000);
PlayerTextDrawSetPreviewModel(playerid,InvSlot[playerid][GetPVarInt(playerid,"NewSelectSlot")], Items_All[PlayerInfo[playerid][pInvSlot][GetPVarInt(playerid,"ChangeSlot") - 1]][invObject]);
PlayerTextDrawSetPreviewRot(playerid, InvSlot[playerid][GetPVarInt(playerid,"NewSelectSlot")], 0.000000, 0.000000, 0.000000, 1.000000);
SetPVarInt(playerid, "SelectSlot", -1);
SetPVarInt(playerid, "NewSelectSlot", -1);
}
}
new string[10];
format(string, sizeof(string), "Clot %i", i);
SendClientMessage(playerid, -1, string);
}
}
В чем ошибка, в моем коде?
Re: Перемещение предметов по слотам. -
valych - 09.01.2015
Что именно у тебя не работает?
Re: Перемещение предметов по слотам. -
Daea - 09.01.2015
Эмм...
Code:
for(new i; i < 48; i++)
{
if(playertextid == InvSlot[playerid][i])
{
if(GetPVarInt(playerid, "SelectSlot") == -1)
{
if(PlayerInfo[playerid][pInvSlot][i] != -1)
{
SetPVarInt(playerid, "SelectSlot", i);
PlayerTextDrawBackgroundColor(playerid, InvSlot[playerid][i], 0xf2ddc6ff);
PlayerTextDrawShow(playerid, InvSlot[playerid][i]);
}
}
else if(GetPVarInt(playerid, "SelectSlot") != -1)
{
if(PlayerInfo[playerid][pInvSlot][i] == -1)
{
SetPVarInt(playerid, "NewSelectSlot", i);
PlayerTextDrawBackgroundColor(playerid, InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")], -1061109505);
PlayerTextDrawShow(playerid, InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")]);
PlayerTextDrawSetPreviewModel(playerid,InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")], 1649);
PlayerTextDrawSetPreviewRot(playerid, InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")], 0.000000, 0.000000, 90.000000, 2.000000);
PlayerTextDrawSetPreviewModel(playerid,InvSlot[playerid][GetPVarInt(playerid,"NewSelectSlot")], Items_All[PlayerInfo[playerid][pInvSlot][GetPVarInt(playerid,"ChangeSlot") - 1]][invObject]);
PlayerTextDrawSetPreviewRot(playerid, InvSlot[playerid][GetPVarInt(playerid,"NewSelectSlot")], 0.000000, 0.000000, 0.000000, 1.000000);
InvSlot[playerid][GetPVarInt(playerid,"NewSelectSlot")] = InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")];
InvSlot[playerid][GetPVarInt(playerid,"SelectSlot")] = 0;
SetPVarInt(playerid, "SelectSlot", -1);
SetPVarInt(playerid, "NewSelectSlot", -1);
}
}
new string[10];
format(string, sizeof(string), "Clot %i", i);
SendClientMessage(playerid, -1, string);
}
}
Re: Перемещение предметов по слотам. -
Daea - 09.01.2015
А вообще, думаю лучше сделать так:
Code:
new NewSelectSlot = GetPVarInt(playerid,"NewSelectSlot"), SelectSlot = GetPVarInt(playerid,"SelectSlot");
И использовать в данном коде не GetPVarInt(playerid,"NewSelectSlot"), а NewSelectSlot. Просто мне кажется, что каждый раз делать запрос через PVar - плохо. Просто так думаю...