25.01.2015, 20:14
//old post............
PHP код:
CMD:bagitem(playerid, params[])
{
new string[128];
if(!CheckAdmin(playerid, HIGH_ADMIN_LEVEL)) return NotAuthMSG(playerid);
if(sscanf(params, "dd", params[0], params[1]))
{
SendClientMessage(playerid, COLOR_RED, "/bagitem [itemID] [itemAmount]");
return 1;
}
if(GetBagItemCount(playerid) >= MAX_ITEMS) return SCM(playerid, COLOR_RED, "数量已经超出最大物品限制");
//format(string, sizeof(string), "%s", GetName(playerid));
_AddDatabaseItem(strval(params[0]), strval(params[1]), playerid);//
LoadPlayerBag(playerid);
SCM(playerid, COLOR_GREEN, "成功添加 !");
return 1;
}
PHP код:
stock _AddDatabaseItem(item, amount, owner)
{
new query[200];
format(query, sizeof(query), "INSERT INTO `bagitems`(`Owner`, `Item`, `ItemAmount`) VALUES (%s, %d, %d)", GetName(owner), item, amount);
mysql_query(query);
return 1;
}
PHP код:
stock _RemoveDatabaseItem(id)
{
new query[100];
format(query, sizeof(query), "DELETE FROM `bagitems` WHERE `ID` = %d", id);
mysql_query(query);
return 1;
}