14.10.2011, 23:13
So I was busy creating my own items system and I needed to create a command, where you can dynamically add an item to the mysql database.
Everything works, except I think the enums and the parameters don't go together in this way:
as IG I get: You have succesfully created the item - Type: 0 (even thoughh I entered 3, and it doesn't give the items name as it's mentioned)
Hopefully someone can work me out, looks difficult but I think it's something easy, just something I don't know yet.
Everything works, except I think the enums and the parameters don't go together in this way:
Код:
CMD:createitem(playerid, params[]) { if(playerVariables[playerid][pAdminLevel] >= 4) { new IDdeItem, TypeDeItem, NameDeItem[128], itemcreatestring[128]; if(sscanf(params, "ds", TypeDeItem, NameDeItem)) SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/createitem [Type] [Name]"); mysql_query("INSERT INTO items (itemStandard) VALUES ('1')"); IDdeItem = mysql_insert_id(); TypeDeItem = systemItems[IDdeItem][iType]; NameDeItem = systemItems[IDdeItem][iName]; format(itemcreatestring, sizeof(itemcreatestring),"You have successfully created the item %s Type: %d.", systemItems[IDdeItem][iName], systemItems[IDdeItem][iType]); SendClientMessage(playerid, COLOR_GREY, itemcreatestring); saveItem(IDdeItem); } return 1; }
Hopefully someone can work me out, looks difficult but I think it's something easy, just something I don't know yet.