Jump to content
  • 0

pomoc Inventar


Vankus

Dotaz

Popis problému:

Mám inventár cez texdrawy a dám hráčovi napr.Hamburger cez AddItem,ale neviem ako mám kontrolovať či klikol na ten hamburger..

 

Chyby/varování kompilátoru a při běhu:

--

 

Kód:

 

stock ShowInventory(playerid)
{
new iteminv[9];
for(new i = 0; i < 9;i++)
{
iteminv[i] = InvInfo[playerid][iSlot][i];
if(InvInfo[playerid][iSlot][i] == 0)
{
iteminv[i] = 18631;
PlayerTextDrawSetPreviewModel(playerid,InvItem[i][playerid],iteminv[i]);
}

}
PlayerTextDrawShow(playerid,InvItem[0][playerid]);
PlayerTextDrawShow(playerid,InvItem[1][playerid]);
PlayerTextDrawShow(playerid,InvItem[2][playerid]);
PlayerTextDrawShow(playerid,InvItem[3][playerid]);
PlayerTextDrawShow(playerid,InvItem[4][playerid]);
PlayerTextDrawShow(playerid,InvItem[5][playerid]);
PlayerTextDrawShow(playerid,InvItem[6][playerid]);
PlayerTextDrawShow(playerid,InvItem[7][playerid]);
PlayerTextDrawShow(playerid,InvItem[8][playerid]);
PlayerTextDrawShow(playerid,Textdraw0[playerid]);
PlayerTextDrawShow(playerid,Textdraw1[playerid]);
PlayerTextDrawShow(playerid,Textdraw2[playerid]);
PlayerTextDrawShow(playerid,Textdraw3[playerid]);
PlayerTextDrawShow(playerid,Textdraw4[playerid]);
PlayerTextDrawShow(playerid,Box[0][playerid]);
PlayerTextDrawShow(playerid,Box[1][playerid]);
PlayerTextDrawShow(playerid,Box[2][playerid]);
PlayerTextDrawShow(playerid,Box[3][playerid]);
PlayerTextDrawShow(playerid,Box[4][playerid]);
PlayerTextDrawShow(playerid,Box[5][playerid]);
PlayerTextDrawShow(playerid,Box[6][playerid]);
PlayerTextDrawShow(playerid,Box[7][playerid]);
PlayerTextDrawShow(playerid,Box[8][playerid]);
PlayerTextDrawShow(playerid,Box[19][playerid]);
return 1;
}
stock AddItem(playerid,modelid)
{
for(new i = 0;i<9;i++)
{
if(InvInfo[playerid][iSlot][i] == 0)
{
InvInfo[playerid][iSlot][i] = modelid;
PlayerTextDrawSetPreviewModel(playerid,InvItem[i][playerid],modelid);
break;
}
}
return 1;
}
stock RemoveItem(playerid,modelid)
{
for(new i = 0;i<9;i++)
{
if(InvInfo[playerid][iSlot][i] == modelid)
{
InvInfo[playerid][iSlot][i] = 0;
ShowInventory(playerid);
break;
}
}
return 1;
}
stock ResetInventory(playerid)
{
for(new i = 1 ; i <9;i++) InvInfo[playerid][iSlot][i] = 0;
return 1;
}

stock HideInventory(playerid)
{
    PlayerTextDrawHide(playerid,InvItem[0][playerid]);
PlayerTextDrawHide(playerid,InvItem[1][playerid]);
PlayerTextDrawHide(playerid,InvItem[2][playerid]);
PlayerTextDrawHide(playerid,InvItem[3][playerid]);
PlayerTextDrawHide(playerid,InvItem[4][playerid]);
PlayerTextDrawHide(playerid,InvItem[5][playerid]);
PlayerTextDrawHide(playerid,InvItem[6][playerid]);
PlayerTextDrawHide(playerid,InvItem[7][playerid]);
PlayerTextDrawHide(playerid,InvItem[8][playerid]);
PlayerTextDrawHide(playerid,Textdraw0[playerid]);
PlayerTextDrawHide(playerid,Textdraw1[playerid]);
PlayerTextDrawHide(playerid,Textdraw2[playerid]);
PlayerTextDrawHide(playerid,Textdraw3[playerid]);
PlayerTextDrawHide(playerid,Textdraw4[playerid]);
PlayerTextDrawHide(playerid,Box[0][playerid]);
PlayerTextDrawHide(playerid,Box[1][playerid]);
PlayerTextDrawHide(playerid,Box[2][playerid]);
PlayerTextDrawHide(playerid,Box[3][playerid]);
PlayerTextDrawHide(playerid,Box[4][playerid]);
PlayerTextDrawHide(playerid,Box[5][playerid]);
PlayerTextDrawHide(playerid,Box[6][playerid]);
PlayerTextDrawHide(playerid,Box[7][playerid]);
PlayerTextDrawHide(playerid,Box[8][playerid]);
PlayerTextDrawHide(playerid,Box[9][playerid]);
PlayerTextDrawHide(playerid,Box[10][playerid]);
PlayerTextDrawHide(playerid,Box[11][playerid]);
PlayerTextDrawHide(playerid,Box[12][playerid]);
PlayerTextDrawHide(playerid,Box[13][playerid]);
PlayerTextDrawHide(playerid,Box[14][playerid]);
PlayerTextDrawHide(playerid,Box[15][playerid]);
PlayerTextDrawHide(playerid,Box[16][playerid]);
PlayerTextDrawHide(playerid,Box[17][playerid]);
PlayerTextDrawHide(playerid,Box[18][playerid]);
PlayerTextDrawHide(playerid,Box[19][playerid]);
CancelSelectTextDraw(playerid);
return 1;
}

 

 

 

Dodatečné poznámky:

--

Link to comment
Share on other sites

3 odpovědí na tuto otázku

Recommended Posts

  • 0

Ja to mám clickable a v OnPlayerClickTextdraw mám niečo na štýl:

for(new i = 0; i < 9;i++)
{
    if(playertextid == InvItem[i][playerid])
    {

    }
}

Lenže toto kontroluje,že hráč klikol na jedno z políčok inventára,lenže ako mám detekovať že klikol presne na Hamburger?

Link to comment
Share on other sites

  • 0
Zdravím,

Prakticky jednoduše bud vložíš do daného TD kontrolu pokud se model ID rovná burgeru

Nebo si např můžeš udělat stock

 

 



stock PouzitItem(playerid,modelid)
{
//Zde vložíš podmínku pokud se to rovná modelu burgeru tak to splní ukol.
//Pokud se to tedy rovná doplníš hlad nebo  co má burger dělat
return 1;
}


 

 

Protože tohle tam není jen tak bez důvodu aby to ukazovalo models

 



InvInfo[playerid][iSlot][i] = modelid


 

 

Jen rada místo Break můžeš používat i Return ale to už je na tobě.

 

 

Pak jen do daného okna v TDClicktable neboli do tvého codu

viz:

 

 



for(new i = 0; i < 9;i++)
{
    if(playertextid == InvItem[i][playerid])
    {


    }
}


 

Vložíš ten stock pouzititem 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...