clan system bug
#1

Actually, I have a bug....

I have 5 clans in my server...


But when I open the first clan(i.e [iBon]), the options of the last clan(i.e [NE]) is opened!!


Other clan menu are normal....( i.e if i open [BS] it works...)


My code is this

Код:
createClanMenuDialog(playerid)
{
    new clanID = GetPVarInt(playerid,"dialogV");
    if(clanID == 0)
	{
		SendLangMessage(playerid, _COLOR_RED, "Es ist ein Fehler aufgetreten.","There has been an error processing your request.","Ha habido un error al al solicitar tu pedido.");
		return createClanDialog(playerid);
	}
	new query[60],string[10];
	mysql_format(mysql,query,sizeof(query),"SELECT `clan` FROM `clans` WHERE `Id` = %d",clanID);
	mysql_query(mysql,query);//,true,"","");
	if(cache_num_rows() == 1)
	{
	for(new id = 0; id < cache_get_row_count(); id++)
	cache_get_field_content(id,"clan",string);//cache_get_row(0,0,string);//mysql_fetch_field_row(string,"|");
	printf("Testclan: %s", string);
	}
	switch(Sprache[playerid])
	{
		case 0: format(query,sizeof(query),"Hauptmenь - %s",string), ShowPlayerDialog(playerid, 2003, DIALOG_STYLE_LIST, query, "Info\nNews\nMitglieder\nNachrichten\nStatistiken\nOptionen", "Akzeptieren", "Zurьck");
		case 1: format(query,sizeof(query),"Main menu - %s",string), ShowPlayerDialog(playerid, 2003, DIALOG_STYLE_LIST, query, "Info\nNews\nMembers\nMessages\nStatistics\nOptions", "Accept", "Back");
		case 2: format(query,sizeof(query),"Menu principal - %s",string), ShowPlayerDialog(playerid, 2003, DIALOG_STYLE_LIST, query, "Informacion\nNoticias\nMiembros\nMeensajes\nEstadisticas\nOpciones", "Aceptar", "Atras");
	}
	return 1;
}
Reply
#2

Can you show the code which sets dialogV PVar? Also add printf("CLAN ID: %d",clanID); just after GetPVarInt.

Pass the clanid as an argument to the function instead of storing it in a PVar. PVars are slow because lot of strcmps are involved to find the correct key.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)