Undefined symbol problem.
#1

So I got this piece of code from a tutorial somewhere just to try it out but this happens with all my new projects, Whenever I define something and I continue to use it down the road it gives the error that it is undefined, No one else seems to be having this problem so I am wondering if you guys could help me out.

I would be so gratefull

So here is the error report

Код:
C:\Users\Glenn\Desktop\MYSQL TEST SAMP\gamemodes\Glenn2.pwn(70) : error 017: undefined symbol "mysql"
C:\Users\Glenn\Desktop\MYSQL TEST SAMP\gamemodes\Glenn2.pwn(70) : error 017: undefined symbol "host"
C:\Users\Glenn\Desktop\MYSQL TEST SAMP\gamemodes\Glenn2.pwn(71) : error 017: undefined symbol "mysql"
C:\Users\Glenn\Desktop\MYSQL TEST SAMP\gamemodes\Glenn2.pwn(93) : error 017: undefined symbol "Name"
C:\Users\Glenn\Desktop\MYSQL TEST SAMP\gamemodes\Glenn2.pwn(93) : warning 215: expression has no effect
C:\Users\Glenn\Desktop\MYSQL TEST SAMP\gamemodes\Glenn2.pwn(93) : error 001: expected token: ";", but found "]"
C:\Users\Glenn\Desktop\MYSQL TEST SAMP\gamemodes\Glenn2.pwn(93) : error 029: invalid expression, assumed zero
C:\Users\Glenn\Desktop\MYSQL TEST SAMP\gamemodes\Glenn2.pwn(93) : fatal error 107: too many error messages on one line

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


7 Errors.
And here are the lines that get those errors:

Код:
public OnGameModeInit()
{
	mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG); //Let's enable debugging so we can detect a problem(if there is)
    mysql = mysql_connect(host, user, db, pass); //This function will connect your server to database. Remember we have defined our host, username, database and password. It's time to use it here.
    if(mysql_errno(mysql) != 0) print("Could not connect to database!"); //This will tell if your connection to database is successful or not. If it's not, check your host, username, database and password. Make sure they all right.
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}
And

Код:
public OnPlayerConnect(playerid)
{
    new query[128]; //We use this variable to format our query
    GetPlayerName(playerid, Name[playerid], 24); //Getting player's name
    GetPlayerIp(playerid, IP[playerid], 16); //Getting layer's IP
    mysql_format(mysql, query, sizeof(query),"SELECT `Password`, `ID` FROM `players` WHERE `Username` = '%e' LIMIT 1", Name[playerid]);
    // - We use mysql_format instead of format because we can use an %e specifier. %e specifier escapes a string so we can avoid sql injection which means we don't have to use mysql_real_escape_string
    // - Formatting our query; SELECT `Password`, `ID` FROM `players` WHERE `Username`='%e' means we are selecting a Password and ID's column in the table that has player's name in Username column.
    // - LIMIT 1; we only need 1 result to be shown
    mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);
    //lets execute the formatted query and when the execution is done, a callback OnAccountCheck will be called
    //You can name the callback however you like
	return 1;
}
Although all of these are defined as shown here:

Код:
static
    mysql, //This variable will be used to manage our database
    Name[MAX_PLAYERS][24], //We will use this variable to store player's name.
    IP[MAX_PLAYERS][16] //We will use this variable to store player's ip.
    ;

#define host    "localhost" //This will be your mysql host. Default for xampp is localhost
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)