[MySQL] Faction name problem
#1

Hello again,

Today I've been setting up my Factions database and I managed to set it up in the script fine to connect and so on but when I use printf(); something is not working.

printf();
pawn Код:
printf("[Factions] Name: %s ID: %d",DynamicFactions[ idx ][ fName ],DynamicFactions[ idx ][ fType ]);
It only comes up with:
Код:
[Factions] Name: ID: 1
Here is the LoadFaction(); function:
pawn Код:
public LoadFaction()
{
  new DataString[ 128 ], String[ 128 ], Query[ 128 ], idx;

    format( Query, sizeof( Query ), "SELECT * FROM `Factions`");
    mysql_query( Query );
    mysql_store_result();

    while( mysql_fetch_row_data() )
    {
        mysql_fetch_field( "FactionID", DataString );
        DynamicFactions[ idx ][ fID ] = strval( DataString );

        mysql_fetch_field( "FactionName", String );
        DynamicFactions[ idx ][ fName ] = strval( String );

             printf("[Factions] Name: %s ID: %d",DynamicFactions[ idx ][ fName ],DynamicFactions[ idx ][ fType ]);

        idx++;
    }

    mysql_free_result();

    return 1;
}
For some strange reason the name of the faction isn't appearing. What am I doing wrong? :P

(I've edited out most of the code like the other parts of the faction)
Reply
#2

----[BUMP]----

Anyone?
Reply
#3

Bump again

I have some more information now just in case, if it helps.

The error about the printf is still there so it shows
Код:
[Factions] Name: ID: 0
But this also happens IG as well.
pawn Код:
format(string, sizeof(string), "This vehicle belongs to %s",DynamicFactions[DynamicCars[vehicleid][FactionCar]][FactionName]);
SendClientMessage(playerid,WHITE, string);
Only shows:
Код:
This vehicle blongs to
Do you have to load up text differently than loading up data and number? If so how do I do it using this code:
pawn Код:
mysql_fetch_field( "FactionName", DataString );
DynamicFactions[ idx ][ FactionName ] = strval( DataString );
If anyone can help it would be really useful
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)