SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 25/02/2011, 08:14 PM   #1
ajwar
Huge Clucker
 
Join Date: May 2009
Location: Norway
Posts: 321
Reputation: 2
Default Help converting to mysql

Can someone help me to convert this script to mysql? (r5 plugin)

pawn Code:
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 Code:
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?

Last edited by ajwar; 25/02/2011 at 09:01 PM.
ajwar is offline  
Old 25/02/2011, 09:02 PM   #2
ajwar
Huge Clucker
 
Join Date: May 2009
Location: Norway
Posts: 321
Reputation: 2
Default Re: Help converting to mysql

Updated topic
ajwar is offline  
Old 25/02/2011, 09:10 PM   #3
Pangea
Big Clucker
 
Join Date: Feb 2011
Posts: 71
Reputation: 9
Default Re: Help converting to mysql

Give us the errrors you're getting.
BTW: You made a typo.
pawn Code:
mysql_query("SELECT Number FROM `playerinfo` WHERE Number='%s'",PVar[playerid][pNumber]);
You had an extra " behind the PVar
Pangea is offline  
Old 25/02/2011, 09:12 PM   #4
ajwar
Huge Clucker
 
Join Date: May 2009
Location: Norway
Posts: 321
Reputation: 2
Default Re: Help converting to mysql

pawn Code:
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
ajwar is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting to 0.3c slowride326 Help Archive 22 08/01/2011 09:48 AM
Converting from DINI to mysql? Face9000 Help Archive 1 10/11/2010 09:07 AM
Converting this to mysql ihatetn931 Help Archive 12 30/09/2010 06:37 AM
Converting to MySQL issues Thomas. Help Archive 15 05/09/2010 02:16 PM
Help with converting map? DeltaAirlines12 Help Archive 11 19/12/2009 04:05 PM


All times are GMT. The time now is 09:47 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.