SA-MP Forums Archive
Help Needed !! - 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: Help Needed !! (/showthread.php?tid=481108)



Help Needed !! - naveed - 14.12.2013

new s[500];
if(AccountExists[playerid] && !PlayerLogged[playerid] && !IsPlayerNPC(playerid))
{
if(mysql_ping() == -1)
new pName[500];
new string[156];
GetPlayerName(playerid,pName,30);
CheckMySQL();
format(string, sizeof(string), "SELECT * FROM users WHERE Name = '%s'", pName);
mysql_query(string);
mysql_store_result();

Errors : : error 029: invalid expression, assumed zero
: error 001: expected token: ")", but found "new"
: error 003: declaration of a local variable must appear in a compound block
: error 029: invalid expression, assumed zero
: fatal error 107: too many error messages on one line


Re: Help Needed !! - Tagathron - 14.12.2013

Maybe try giving us the exact lines-which line has which number?
And tell us where this chunk of code is located,use your brain-nobody can read your mind or your script without seeing it.


Re: Help Needed !! - naveed - 14.12.2013

if(mysql_ping() == -1) = error 029: invalid expression, assumed zero


new pName[500]; = error 001: expected token: ")", but found "new"
: error 003: declaration of a local variable must appear in a compound block
: error 029: invalid expression, assumed zero
: fatal error 107: too many error messages on one line


Re: Help Needed !! - Tagathron - 14.12.2013

pawn Код:
if(mysql_ping() == -1)
You don't need '== -1'
It will check the connection just with:
pawn Код:
if(mysql_ping())
You can check more about that here.

About the second error,check the line before
pawn Код:
new pName[500];
You might've missed ')' as it says.


Re: Help Needed !! - naveed - 14.12.2013

if(mysql_ping()) is above
new pName[500];

But after doing this
if(mysql_ping())

it says invalid expression assumed zero


Re: Help Needed !! - Tagathron - 14.12.2013

You might add some brackets at
pawn Код:
if(mysql_ping())
Like:
pawn Код:
new s[500];
if(AccountExists[playerid] && !PlayerLogged[playerid] && !IsPlayerNPC(playerid))
{
 if(mysql_ping() == -1)
 {
  new pName[500];
  new string[156];
  GetPlayerName(playerid,pName,30);
  CheckMySQL();
  format(string, sizeof(string), "SELECT * FROM users WHERE Name = '%s'", pName);
  mysql_query(string);
  mysql_store_result();
}