02.02.2017, 19:15
I am making an inventory system and I plan on having alot of items, my way of defining their name is kinda awful if you ask me, it will take alot of space but I can't think of a better way, this is how I define item names.
If inventory empty
If player has an apple
and so on..
If inventory empty
PHP код:
if(PlayerInfo[playerid][pItem1] == 0) { test[0] = "EMPTY"; }
if(PlayerInfo[playerid][pItem2] == 0) { test[1] = "EMPTY"; }
if(PlayerInfo[playerid][pItem3] == 0) { test[2] = "EMPTY"; }
if(PlayerInfo[playerid][pItem4] == 0) { test[3] = "EMPTY"; }
if(PlayerInfo[playerid][pItem5] == 0) { test[4] = "EMPTY"; }
if(PlayerInfo[playerid][pItem6] == 0) { test[5] = "EMPTY"; }
if(PlayerInfo[playerid][pItem7] == 0) { test[6] = "EMPTY"; }
PHP код:
if(PlayerInfo[playerid][pItem1] == 1) { test[0] = "APPLE"; }
if(PlayerInfo[playerid][pItem2] == 1) { test[1] = "APPLE"; }
if(PlayerInfo[playerid][pItem3] == 1) { test[2] = "APPLE"; }
if(PlayerInfo[playerid][pItem4] == 1) { test[3] = "APPLE"; }
if(PlayerInfo[playerid][pItem5] == 1) { test[4] = "APPLE"; }
if(PlayerInfo[playerid][pItem6] == 1) { test[5] = "APPLE"; }
if(PlayerInfo[playerid][pItem7] == 1) { test[6] = "APPLE"; }