SA-MP Forums Archive
Compile Errors [+rep] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Compile Errors [+rep] (/showthread.php?tid=548434)



Compile Errors [+rep] - KingPersona - 29.11.2014

Hello
i have problem when i compile

i use mysql r39-2
pawn Код:
CMD:members(playerid, params[])
{
    if(playerVariables[playerid][pGroup] >= 1 && playerVariables[playerid][pGroupRank] >= 6)
    {
        new aim[1500];
        new last[256];
        format(aim, 256,"{FFB300}%s {FFFFFF}members: \n",groupVariables[playerVariables[playerid][pGroup]][gGroupName]);
        mysql_format(handle,query, sizeof(tquery), "SELECT playerName,playerGroupRank,playerCarWeapon3,playerLastLogin, playerDays FROM playeraccounts WHERE playerGroup = %d ORDER BY playerGroupRank DESC LIMIT 25",playerVariables[playerid][pGroup]);
        mysql_query(handle, query);
        cache_get_data(rows, fields, handle);
        new memid;
        new stringg[256];
        mysql_format(handle, stringg, sizeof(stringg), "SELECT * FROM `playeraccounts` WHERE `playerGroup` = %d",playerVariables[playerid][pGroup]);
        new test[256], query[256], test2[256], test3[256], days[256];
        new Cache: result12 = mysql_query (handle, stringg);
        for ( new i, j = cache_get_row_count ( ); i != j; ++i )
        {
            cache_get_field_content(i, "playerName", query);
            format(Selected[memid][snume],24, query);

            cache_get_field_content(i, "playerGroupRank", test);
            Selected[memid][srank] = strval(test);

            cache_get_field_content(i, "playerCarWeapon3", test2);
            Selected[memid][swarn] = strval(test2);

            cache_get_field_content(i, "playerLastLogin", test3);
            format(last,256, test3);

            cache_get_field_content(i, "playerDays", days);
            Selected[memid][sdays] = strval(days);
            new id = GetPlayerID(Selected[memid][snume]);
            if(id != INVALID_PLAYER_ID)
            {
                format(aim, sizeof(aim), "%s%s - Rank: %s - FW: %s/3 - online right now - %s days\n",aim,query, test,test2, days);
            }
            else
            {
                format(aim, sizeof(aim), "%s%s - Rank: %s - FW: %s/3 - last login: %s - %s days\n",aim,query, test,test2, test3, days);
            }
            memid ++;
        }
        cache_delete(result12);
        ShowPlayerDialog(playerid,DIALOG_MEMBERS,DIALOG_STYLE_LIST,"Members:",aim,"Select","Cancel");
    }
}
Errors:
Код:
(27213) : error 017: undefined symbol "query"
(27213) : error 017: undefined symbol "query"
(27213) : error 029: invalid expression, assumed zero
(27213) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: Compile Errors [+rep] - PowerPC603 - 29.11.2014

It's because you use the variale "query" first in this line:
pawn Код:
mysql_format(handle,query, sizeof(tquery), "SELECT playerName,playerGroupRank,playerCarWeapon3,playerLastLogin, playerDays FROM playeraccounts WHERE playerGroup = %d ORDER BY playerGroupRank DESC LIMIT 25",playerVariables[playerid][pGroup]);
Then afterwards, you create it:
pawn Код:
new test[256], query[256], test2[256], test3[256], days[256];
You should first declare your variables before you use them.

BTW, you use the "query" variable to store your info, then use "sizeof(tquery)" for it's size.
That should be "query" as well.


Re: Compile Errors [+rep] - KingPersona - 29.11.2014

Quote:
Originally Posted by PowerPC603
Посмотреть сообщение
It's because you use the variale "query" first in this line:
pawn Код:
mysql_format(handle,query, sizeof(tquery), "SELECT playerName,playerGroupRank,playerCarWeapon3,playerLastLogin, playerDays FROM playeraccounts WHERE playerGroup = %d ORDER BY playerGroupRank DESC LIMIT 25",playerVariables[playerid][pGroup]);
Then afterwards, you create it:
pawn Код:
new test[256], query[256], test2[256], test3[256], days[256];
You should first declare your variables before you use them.

BTW, you use the "query" variable to store your info, then use "sizeof(tquery)" for it's size.
That should be "query" as well.
Thx dude, +rep.