Already Exist
#1

What is wrong with this ?

Код HTML:
enum clanE
{
    cClanName[64],
	cClanMOTD[128],
	cClanRankName1[32],
	cClanRankName2[32],
	cClanRankName3[32],
	cClanRankName4[32],
	cClanRankName5[32],
	cClanRankName6[32],
	cClanRankName7[32],
	cClanTag[32],
	cClanTagType,
	cClanID,
	cClanExpire,
	cClanActive,
	cClanSlots,
	cClanColor[10],
};
new ClanInfo[MAX_CLANS][clanE];
Код HTML:
if(dialogid == DIALOG_CHOOSECLANTAG)
	{
	    if(response)
	    {
	        new clantag[32];
			if(ExistClan(clantag) == 1)
			{
				if(strlen(inputtext) >= 2 && strlen(inputtext) <= 15)
				{
		    		new clanname[25],strings[256];
					mysql_real_escape_string(inputtext, clanname);
					strcpy(ClanInfo[PlayerInfo[playerid][pClan]][cClanTag], clanname, sizeof(clanname));
					mysql_format(SQL, strings, sizeof(strings), "UPDATE clans SET `clanTag`='%s' WHERE `clanID`='%d'", clanname, PlayerInfo[playerid][pClan]);
					mysql_tquery(SQL,strings,"","");
					format(strings, sizeof(strings), "Clan tag: %s.", clanname);
					SendClientMessage(playerid, COLOR_GENANNOUNCE, strings);
					mysql_format(SQL, strings, sizeof(strings), "SELECT * FROM `clans`");
					mysql_tquery(SQL, strings, "LoadClanInfo", "");
		  	 	}
				else
				{
					ShowPlayerDialog(playerid, DIALOG_CHOOSECLANTAG, DIALOG_STYLE_INPUT, "Clan tag", "Insert clan tag in the box below:\nMinimum 2 characters and maximum 15 characters.\n(You can't change it after that!)", "Ok", "");
					return 1;
				}
			}
			else
			{
				ShowPlayerDialog(playerid, DIALOG_CHOOSECLANTAG, DIALOG_STYLE_INPUT, "Clan tag", "Clan already exist:\nMinimum 2 characters and maximum 15 characters.\n(You can't change it after that!)", "Ok", "");
				return 1;
			}
  		}
	}
Код HTML:
function ExistClan(clantag[])
{
	new string[256], existclan=0;
	format(string, sizeof(string), "SELECT `ID` FROM `clans` WHERE `clanTag` = '%e' LIMIT 1", clantag);
	new Cache: existclanresult = mysql_query(SQL, string);
	for(new i, j = cache_get_row_count (); i != j; ++i)
	{
		existclan++;
	}
	cache_delete(existclanresult);
	return existclan;
}
why i can create more than 1 clan with the same Tag ?
Reply
#2

try this one:

PHP код:
function ExistClan(clantag[])
{
    new 
string[256], existclan=0;
    
format(stringsizeof(string), "SELECT `clanTag` FROM `clans` WHERE `clanTag` = '%e' LIMIT 1"clantag);
    new 
Cacheexistclanresult mysql_query(SQLstring);
    for(new 
icache_get_row_count (); != j; ++i)
    {
        
existclan++;
    }
    
cache_delete(existclanresult);
    return 
existclan;

instead of `ID` you had to use `clanTag`
Reply
#3

still dosen't work i still can create another clan with same Tag

edit: i did something and now i can't create with any Tag , you have some other ideas?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)