forward GetCuData(playerid, campo[]); public GetCuData(playerid, campo[]) { new tmp[128]; new row[60]; format(tmp, 128, "SELECT %s FROM cucus WHERE ID= %d LIMIT 1", campo, cuInfo[playerid][cuSQLID]); mysql_query(tmp); mysql_store_result(); mysql_fetch_row(row); new id; id = strval(row); mysql_free_result(); return id; } forward AsignCuInfo(playerid); public AsignCuInfo(playerid) { CuInfo[playerid][Sabor1]=GetCuData(playerid,"Sabor1"); CuInfo[playerid][Sabor2]=GetCuData(playerid,"Sabor2"); CuInfo[playerid][Sabor3]=GetCuData(playerid,"Sabor3"); } forward OnCuCrear(playerid); public OnCuCrear(playerid) { AsignCuInfo(playerid); new stringmenu[128]; format(stringmenu, sizeof(stringmenu), "%s \n %s \n %s",CuInfo[playerid][Sabor1],CuentaInfo[playerid][Sabor2],CuentaInfo[playerid][Sabor3]); ShowPlayerDialog(playerid, CU_MENU,DIALOG_STYLE_LIST, "Elige el cucurucho que quieres comer",stringmenu, "Seleccionar", "Salir"); }
format(tmp, 128, "SELECT FROM `cucus` WHERE ID = %d ", cuInfo[playerid][cuSQLID]);
mysql_query(tmp);
forward GetCuData(playerid, campo[]);
public GetCuData(playerid, campo[])
{
new tmp[128];
new row[60];
format(tmp, 128, "SELECT %s FROM cucus WHERE ID= %d LIMIT 1", campo, cuInfo[playerid][cuSQLID]);
mysql_query(tmp);
mysql_store_result();
mysql_fetch_row(row);
mysql_free_result();
return row;
}
I want to return is only a taste, just one word, not a string
if i use return row pawno returns that error on compiling: public functions may not return arrays (symbol "GetCuentaData") T_T |
No, does not need a public function ... but is the only way I know to do, I'm beginner in pawn
![]() |
GetCuData(playerid, campo[])
{
new tmp[128];
new row[60];
format(tmp, 128, "SELECT %s FROM cucus WHERE ID= %d LIMIT 1", campo, cuInfo[playerid][cuSQLID]);
mysql_query(tmp);
mysql_store_result();
mysql_fetch_row(row);
mysql_free_result();
return row;
}
#define strcpy(%0,%1,%2) %0[0]=0;strcat(%0,%2,%1)
AsignCuInfo(playerid)
{
strcpy(CuInfo[playerid][Sabor1], 64, GetCuData(playerid, "Sabor1"));
strcpy(CuInfo[playerid][Sabor2], 64, GetCuData(playerid, "Sabor2"));
strcpy(CuInfo[playerid][Sabor3], 64, GetCuData(playerid, "Sabor3"));
}