Hi all,
I trying to made a simple menu with all name for all player who has the same item on my db.
it's my request sql "SELECT `name` FROM `xprpg_data` WHERE `item` = %d"
But on my function 'submenuitem(id, menu, item)'. How i can take the name on the line choosing for remove this item ( UPDATE `xprpg_data` SET `item` = '0' WHERE `name` = %s )
(resume: create menu with all player who has item = on the player who open menu and choosing player for remove this item).
PHP Code:
public Remove_Item(id)
{
new Data[1]
Data[0] = id
new szTemp[512]
format(szTemp,charsmax(szTemp), "SELECT `name` FROM `xprpg_data` WHERE `item` = %d", HasItem[id])
SQL_ThreadQuery(g_SqlTuple,"Sql_List",szTemp,Data,1)
return PLUGIN_CONTINUE;
}
public Sql_List(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
if(FailState == TQUERY_CONNECT_FAILED)
log_amx("Load - Could not connect to SQL database. [%d] %s", Errcode, Error);
else if(FailState == TQUERY_QUERY_FAILED)
log_amx("Load Query failed. [%d] %s", Errcode, Error);
new id = Data[0]
new name[32]
new menu = menu_create("Choose player", "submenuitem")
while(SQL_MoreResults(Query))
{
SQL_ReadResult(Query, 0, name, charsmax(name))
menu_additem(menu, "\w%s", name)
SQL_NextRow(Query)
}
menu_display(id, menu, 0)
return PLUGIN_HANDLED
}
public submenuitem(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED;
// ???
}
}