Need help with MYSQL not saving gun cords..
#1

I'm trying to get a DROPGUN script to save all the objects after a restart through MYSQL. The problem is that the gun object IDs aren't saving and loading where they should. Normally I could /dw and the gun would appear on the floor and still be there after logging in and out. When I restart however, the guns disappear and don't load properly.

pawn Код:
function SavePickupWeapons()
{
    new query[256];

    ConnectToDatabase();

    format(query, sizeof query, "DELETE FROM pickup_weapons");
    mysql_query(query);
    printf("QUERY: %s", query);

    for(new w; w < maxobj; w++)
    {
        if(ObjCoords[w][0] != 0.0)
        {
            format(query, sizeof query, "INSERT INTO pickup_weapons (pickupid, weapid, ammo, x, y, z) VALUES (%d, %d, %d, '%f', '%f', '%f')",
            GunObjects[ObjectID[w][0]][0], ObjectID[w][0], ObjectID[w][1], ObjCoords[w][0],ObjCoords[w][1],ObjCoords[w][2]);
            mysql_query(query);
            printf("%s", query);
        }
    }
    printf("pickup weapons saved");
}

function LoadPickupWeapons()
{
    new resultline[256];
    new player[6][32];
    new query[256];

    ConnectToDatabase();

//    format(query, sizeof query, "SELECT * FROM pickup_weapons");
    printf("QUERY: %s",query);
    mysql_query(query);
    mysql_store_result();

    for(new f; f < maxobj; f++)
    while (mysql_fetch_row(resultline) != 0)
    {
        printf("%s", resultline);
        split(resultline, player, '|');
        ObjectID[f][0] = strval(player[1]);
        ObjectID[f][1] = strval(player[2]);
        ObjCoords[f][0] = floatstr(player[3]);
        ObjCoords[f][1] = floatstr(player[4]);
        ObjCoords[f][2] = floatstr(player[5]);
        object[f] = CreateObject(strval(player[0]),ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0);
        f++;
    }

    printf("pickup weapons loaded.");
    return 1;
}
Can someone help me please? These are the two functions that are supposed to be working.
Reply


Messages In This Thread
Need help with MYSQL not saving gun cords.. - by Snyper1 - 14.10.2010, 23:32
Re: Need help with MYSQL not saving gun cords.. - by Austin - 15.10.2010, 00:55
Re: Need help with MYSQL not saving gun cords.. - by Cameltoe - 15.10.2010, 01:17
Re: Need help with MYSQL not saving gun cords.. - by [HiC]TheKiller - 15.10.2010, 03:53
Re: Need help with MYSQL not saving gun cords.. - by Ben7544 - 13.04.2011, 08:56
Re: Need help with MYSQL not saving gun cords.. - by Voldemort - 13.04.2011, 09:37

Forum Jump:


Users browsing this thread: 1 Guest(s)