Split() problem
#1

Hi everyone,

I have a little problem with Split().
Why isn't this script working?
When I remove the split line, I see the test line in the server window. When I test it like this the test line doesnt even show.
pawn Код:
forward LoadVehicles();
public LoadVehicles()
{
    new data[256], field[3][32];
    mysql_query("SELECT x, y, z FROM vehicles");
    mysql_store_result();

    while (mysql_fetch_row(data, "|"))
    {
        split(data, field, '|');
        print("testline");
    }
}
Thanks in advance
Reply
#2

For some reason the edit button doesn't work :S
I added the x y and z mysqlf in the database. I also tried just getting 2 text variables, but it just doesnt split them, and I dont see the testline :S
Reply
#3

-Bumpie-
Reply
#4

Quote:
Originally Posted by baske007
Посмотреть сообщение
-Bumpie-
Use Sscanf.
pawn Код:
enum vInfo
{
     Id,
     Float:x,Float:y,Float:z,Float:a,
} // Make sure the database is structured like this too. ID ( Auto inc. ) - x - y - z -a. otherwise it won't work.
new VehicleInfo[MAX_VEHICLE][vInfo];

forward LoadVehicles();
public LoadVehicles()
{
    for(new i; i < MAX_VEHICLES; i++)
    {
        new FetchLine[200];
        mysql_query("SELECT * FROM vehicles WHERE id = %d");
        mysql_store_result();
        if(mysql_fetch_row(FetchLine,"|"))
        {
            printf("%s", FetchLine); // Debugging......
            sscanf(FetchLine, "p<|>e<iffff>", VehicleInfo[i]);
            printf("%s", FetchLine); // Debugging......
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)