PDA

View Full Version : [SOS]argument type mismatch (argument 3) and error 017: undefined symbol "mysql_query"


Mavis100
15/04/2014, 03:18 PM
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(params[0], params[1], string);
LoadPlayerBag(playerid);
SCM(playerid, COLOR_GREEN, "成功添加 !");
return 1;
}

MySQL error:

LoadPlayerBag(playerid)
{
for(new i = 0,j = MAX_ITEMS; i < j; i ++)
{
Bag[playerid][bagItemID][i] = 0;
Bag[playerid][bagItem][i] = 0;
Bag[playerid][bagItemAmount][i] = 0;
Bag[playerid][bagItemLoaded][i] = 0;
Bag[playerid][bagItemLoadAmount][i] = 0;
Bag[playerid][bagItemServer][i] = 0;
}
new temp[256], id = 0;
format(query, sizeof(query), "SELECT * FROM `bagitems` WHERE `Owner` = %d", GetName(playerid));
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())
{
while(mysql_retrieve_row())
{
mysql_fetch_field_row(temp, "ID"), Bag[playerid][bagItemID][id] = strval(temp);
mysql_fetch_field_row(temp, "Item"), Bag[playerid][bagItem][id] = strval(temp);
mysql_fetch_field_row(temp, "ItemAmount"), Bag[playerid][bagItemAmount][id] = strval(temp);
mysql_fetch_field_row(temp, "ItemLoaded"), Bag[playerid][bagItemLoaded][id] = strval(temp);
mysql_fetch_field_row(temp, "ItemLoadAmount"), Bag[playerid][bagItemLoadAmount][id] = strval(temp);
mysql_fetch_field_row(temp, "ItemServer"), Bag[playerid][bagItemServer][id] = strval(temp);
id ++;
}
}
mysql_free_result();
return 1;
}
stock _AddDatabaseItem(item, amount, owner)
{
format(query, sizeof(query), "INSERT INTO `bagitems`(`Owner`, `Item`, `ItemAmount`) VALUES (%d, %d, %d)", owner, item, amount);
mysql_query(query);
return 1;
}
stock _AddDatabaseItem(item, amount, owner)
{
format(query, sizeof(query), "INSERT INTO `bagitems`(`Owner`, `Item`, `ItemAmount`) VALUES (%d, %d, %d)", owner, item, amount);
mysql_query(query);
return 1;
}

stock _RemoveDatabaseItem(id)
{
format(query, sizeof(query), "DELETE FROM `bagitems` WHERE `ID` = %d", id);
mysql_query(query);
return 1;
}



What happened? Will you give me a help? btw, my ucp is 'big' bugged too, if you're fixs it, i can give some compensation about money.

pls... :)

OMonger
25/01/2015, 08:22 PM
what line does the compilation appear on?

Matess
25/01/2015, 09:14 PM
//old post............

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;
}

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;
}
stock _RemoveDatabaseItem(id)
{
new query[100];
format(query, sizeof(query), "DELETE FROM `bagitems` WHERE `ID` = %d", id);
mysql_query(query);
return 1;
}