SA-MP Forums Archive
[MySQL] Faction name problem - 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: [MySQL] Faction name problem (/showthread.php?tid=146313)



[MySQL] Faction name problem - Agent Smith - 06.05.2010

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)


Re: [MySQL] Faction name problem - Agent Smith - 07.05.2010

----[BUMP]----

Anyone?


Re: [MySQL] Faction name problem - Agent Smith - 09.05.2010

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