SA-MP Forums Archive
tag mismatch with enums - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: tag mismatch with enums (/showthread.php?tid=616345)



tag mismatch with enums - PeanutButter - 03.09.2016

Hello,

I'm trying to make a simple inventory system, but there is a problem with storing the name of the object.

These are the enums:
PHP код:
enum Obj
{
    
Object[MAX_PLAYER_OBJECTS],
}
enum objinfo
{
 
Name[126],
}
new 
Inventory[MAX_PLAYERS][Obj];
new 
InventoryInfo[MAX_PLAYERS][Obj][objinfo]; 
This is the code with the error:
PHP код:
forward LoadInventory(playerid);
public 
LoadInventory(playerid)
{
objamount cache_get_row_count();
      for(new 
iobjamounti++)
    {
        
Inventory[playerid][Object][i] = cache_get_field_content_int(i"ObjectID"); //this works
        
cache_get_field_content(i,     "Name"InventoryInfo[playerid][i][Name]); // this has warning 213: tag mismatch
    
}




Re: tag mismatch with enums - Nero_3D - 03.09.2016

Why do you want to load everything into an array if you already got everything in the database?

To remove the tag mistake add "Obj:" in from of "i" = "Obj: i"


Re: tag mismatch with enums - PeanutButter - 04.09.2016

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Why do you want to load everything into an array if you already got everything in the database?

To remove the tag mistake add "Obj:" in from of "i" = "Obj: i"
Because I thought it would be easier if I store everything in an array so I can use it later on in my script.
What would be a smarter way to do this?


Re: tag mismatch with enums - Nero_3D - 04.09.2016

I would leave it in the database because it offers you already everything you need, like sorting or searching for a specifc item