Need Help with MySQL
#1

hi guys sorry for inconvenience but I need help in Onqueryfinish callback..

it giving me some errors :

Код:
Desktop\UF - Copy\gamemodes\UFXD.pwn(24729) : error 002: only a single statement (or expression) can follow each "case"
Desktop\UF - Copy\gamemodes\UFXD.pwn(24729) : warning 215: expression has no effect
Desktop\UF - Copy\gamemodes\UFXD.pwn(24730) : warning 209: function "OnQueryFinish" should return a value
Desktop\UF - Copy\gamemodes\UFXD.pwn(24732) : error 010: invalid function or declaration
Desktop\UF - Copy\gamemodes\UFXD.pwn(24734) : error 010: invalid function or declaration
Desktop\UF - Copy\gamemodes\UFXD.pwn(24737) : error 054: unmatched closing brace ("}")
Desktop\UF - Copy\gamemodes\UFXD.pwn(24739) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
The Callback

Код:
forward OnQueryFinish(resultid, extraid, handleid);
public OnQueryFinish(resultid, extraid, handleid)
{
  new rows, fields;
	if(resultid != SENDDATA_THREAD) {
		if(extraid != INVALID_PLAYER_ID) {
			if(g_arrQueryHandle{extraid} != -1 && g_arrQueryHandle{extraid} != handleid) return 0;
		}
		cache_get_data(rows, fields, MainPipeline);
	}
	switch(resultid)
	{
		case LOADUSERDATA_THREAD:
		{
			if(IsPlayerConnected(extraid))
			{
     			new szField[MAX_PLAYER_NAME], szResult[64];

				for(new row;row < rows;row++)
				{
					cache_get_field_content(row, "Name", szField, MainPipeline);

					if(strcmp(szField, GetName(extraid), true) != 0)
					{
						return 1;
                    }

					cache_get_field_content(row, "ID", szResult, MainPipeline); PlayerInfo[extraid][ID] = strval(szResult);
					cache_get_field_content(row, "Score", szResult, MainPipeline); PlayerInfo[extraid][Score] = strval(szResult);
					cache_get_field_content(row, "Cash", szResult, MainPipeline); PlayerInfo[extraid][Cash] = strval(szResult);
					cache_get_field_content(row, "Level", szResult, MainPipeline); PlayerInfo[extraid][Level] = strval(szResult);
					cache_get_field_content(row,  "Kills", szResult, MainPipeline); PlayerInfo[extraid][Kills] = strval(szResult);
					cache_get_field_content(row,  "Deaths", szResult, MainPipeline); PlayerInfo[extraid][Deaths] = strval(szResult);
					cache_get_field_content(row,  "pMute", szResult, MainPipeline); PlayerInfo[extraid][pMute] = strval(szResult);
					cache_get_field_content(row,  "Warns", szResult, MainPipeline); PlayerInfo[extraid][Warns] = strval(szResult);
					cache_get_field_content(row,  "posx", szResult, MainPipeline); PlayerInfo[extraid][PosX] = strval(szResult);
					cache_get_field_content(row,  "posy", szResult, MainPipeline); PlayerInfo[extraid][PosY] = strval(szResult);
					cache_get_field_content(row,  "posz", szResult, MainPipeline); PlayerInfo[extraid][PosZ] = strval(szResult);
					cache_get_field_content(row,  "posa", szResult, MainPipeline); PlayerInfo[extraid][PosA] = strval(szResult);
					}
				}
			
			return 1;
		}


     case LOGIN_THREAD:
		{
			for(new i;i < rows;i++)
			{
				new
					szPass[129],
					szResult[129],
					szBuffer[129];

				cache_get_field_content(i, "Name", szResult, MainPipeline);
				if(strcmp(szResult, GetName(extraid), true) != 0)
				{
					//g_mysql_AccountAuthCheck(extraid);
					return 1;
				}

                GetPVarString(extraid, "PassAuth", szBuffer, sizeof(szBuffer));
				WP_Hash(szPass, sizeof(szPass), szBuffer);

    			if((isnull(szPass)) || (isnull(szResult)) || (strcmp(szPass, szResult) != 0)) {
					// Invalid Password - Try Again!
						SendClientMessage(extraid, COLOR_RED, "SERVER: Wrong password, you have been kicked out automatically.");
						Kick(extraid);
					}
					return 1;
				}
				DeletePVar(extraid, "PassAuth");
			g_mysql_LoadAccount(extraid);
			}
			return 1;
		}

		case REGISTER_THREAD:
		{
			if(IsPlayerConnected(extraid))
			{
				g_mysql_AccountLoginCheck(extraid);
			}
	}
return 1;
}
pls help me out.
Reply
#2

Here

pawn Код:
forward OnQueryFinish(resultid, extraid, handleid);
public OnQueryFinish(resultid, extraid, handleid)
{
    new rows, fields;
    if(resultid != SENDDATA_THREAD) {
        if(extraid != INVALID_PLAYER_ID) {
            if(g_arrQueryHandle{extraid} != -1 && g_arrQueryHandle{extraid} != handleid) return 0;
        }
        cache_get_data(rows, fields, MainPipeline);
    }
    switch(resultid)
    {
        case LOADUSERDATA_THREAD:
        {
            if(IsPlayerConnected(extraid))
            {
                new szField[MAX_PLAYER_NAME], szResult[64];
                for(new row;row < rows;row++)
                {
                    cache_get_field_content(row, "Name", szField, MainPipeline);
                    if(strcmp(szField, GetName(extraid), true) != 0)
                    {
                        return 1;
                    }
                    cache_get_field_content(row, "ID", szResult, MainPipeline); PlayerInfo[extraid][ID] = strval(szResult);
                    cache_get_field_content(row, "Score", szResult, MainPipeline); PlayerInfo[extraid][Score] = strval(szResult);
                    cache_get_field_content(row, "Cash", szResult, MainPipeline); PlayerInfo[extraid][Cash] = strval(szResult);
                    cache_get_field_content(row, "Level", szResult, MainPipeline); PlayerInfo[extraid][Level] = strval(szResult);
                    cache_get_field_content(row,  "Kills", szResult, MainPipeline); PlayerInfo[extraid][Kills] = strval(szResult);
                    cache_get_field_content(row,  "Deaths", szResult, MainPipeline); PlayerInfo[extraid][Deaths] = strval(szResult);
                    cache_get_field_content(row,  "pMute", szResult, MainPipeline); PlayerInfo[extraid][pMute] = strval(szResult);
                    cache_get_field_content(row,  "Warns", szResult, MainPipeline); PlayerInfo[extraid][Warns] = strval(szResult);
                    cache_get_field_content(row,  "posx", szResult, MainPipeline); PlayerInfo[extraid][PosX] = strval(szResult);
                    cache_get_field_content(row,  "posy", szResult, MainPipeline); PlayerInfo[extraid][PosY] = strval(szResult);
                    cache_get_field_content(row,  "posz", szResult, MainPipeline); PlayerInfo[extraid][PosZ] = strval(szResult);
                    cache_get_field_content(row,  "posa", szResult, MainPipeline); PlayerInfo[extraid][PosA] = strval(szResult);
                }
            }
            return 1;
        }
        case LOGIN_THREAD:
        {
            for(new i;i < rows;i++)
            {
                new
                    szPass[129],
                    szResult[129],
                    szBuffer[129];

                cache_get_field_content(i, "Name", szResult, MainPipeline);
                if(strcmp(szResult, GetName(extraid), true) != 0)
                {
                    //g_mysql_AccountAuthCheck(extraid);
                    return 1;
                }
                GetPVarString(extraid, "PassAuth", szBuffer, sizeof(szBuffer));
                WP_Hash(szPass, sizeof(szPass), szBuffer);
                if((isnull(szPass)) || (isnull(szResult)) || (strcmp(szPass, szResult) != 0)) {
                    // Invalid Password - Try Again!
                        SendClientMessage(extraid, COLOR_RED, "SERVER: Wrong password, you have been kicked out automatically.");
                        Kick(extraid);
                }
                return 1;
            }
            DeletePVar(extraid, "PassAuth");
            g_mysql_LoadAccount(extraid);
            return 1;
        }
        case REGISTER_THREAD:
        {
            if(IsPlayerConnected(extraid))
            {
                g_mysql_AccountLoginCheck(extraid);
            }
        }
    }
    return 1;
}
Reply
#3

thanks bro it worked btw what u changed in it ?
and + repped
Reply
#4

The last case was misplaced and a few more brackets were added.
Reply
#5

k thanks bro I appreciate it thanks again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)