Help converting to mysql - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help converting to mysql (
/showthread.php?tid=231478)
Help converting to mysql -
ajwar - 25.02.2011
Can someone help me to convert this script to mysql? (r5 plugin)
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
if (PVar[i][pNumber] == PVar[playerid][pNumber] && i != playerid) return 1;
if (fexist("numbers_used.txt"))
{
new File:ftw = fopen("numbers_used.txt", io_read);
new tmp[7];
while(fread(ftw, tmp))
{
printf("[%d]", strval(tmp));
if (strval(tmp) == PVar[playerid][pNumber]) return 1;
}
fclose(ftw);
}
return 0;
Tried so but it has some errors:
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
if (PVar[i][pNumber] == PVar[playerid][pNumber] && i != playerid) return 1;
mysql_query("SELECT Number FROM `playerinfo` WHERE Number='%s'",PVar[playerid][pNumber]");
mysql_store_result();
if(mysql_num_rows() > 0)
{
}
else
{
return 1;
}
mysql_free_result()
Can any onehelp?
Re: Help converting to mysql -
ajwar - 25.02.2011
Updated topic
Re: Help converting to mysql -
Pangea - 25.02.2011
Give us the errrors you're getting.
BTW: You made a typo.
pawn Код:
mysql_query("SELECT Number FROM `playerinfo` WHERE Number='%s'",PVar[playerid][pNumber]);
You had an extra " behind the PVar
Re: Help converting to mysql -
ajwar - 25.02.2011
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
if (PVar[i][pNumber] == PVar[playerid][pNumber] && i != playerid) return 1;
mysql_query("SELECT Number FROM `playerinfo` WHERE Number='%s'",PVar[playerid][pNumber]);
mysql_store_result();
if(mysql_num_rows() > 0)
{
}
else
{
return 1;
}
mysql_free_result();
return 0;
Now it compiles, but i am not sure that the script is right converted