Getting the ID of the vehicle that has just been spawned.
#1

I am using MySQL to store vehicle data and using enum's to store the data in the script as well as the database (Just like player info), but I'm not too sure how to actually store the vehicle data into the enums, I know that I would use the vehicle's ID that has just been spawned but I'm not too sure how to actually retrieve that information without actually creating an array and saving the info to that entry in the array.

Here's the "Hypothetical" code that I have created using the previous faction and player info.
pawn Код:
stock loadfactionvehicles(iFaction)
{
    new Query[700];
    format(Query, sizeof(Query), "SELECT * FROM `vehicleinfo` WHERE `vfaction` > 0");
    mysql_query(Query);
    mysql_store_result();
    if (mysql_num_rows())
    {
        mysql_fetch_row_format(Query, "|");
        //sscanf(Query, "p<|>e<is[32]is[32]s[32]s[32]s[32]s[32]s[32]s[32]s[32]s[32]s[32]ifffffffffffffff>", VVar[*THIS IS WHAT I NEED*]); //NEEDS CHANING TO SUIT VVAR
        VVar[*THIS IS WHAT I NEED*][vfaction] = iFaction;
    }
    return 1;
}
Reply
#2

pawn Код:
stock loadfactionvehicles(iFaction)
{
    new Query[700], vehicleID;
    format(Query, sizeof(Query), "SELECT * FROM `vehicleinfo` WHERE `vfaction` > 0");
    mysql_query(Query);
    mysql_store_result();
    while(mysql_retrieve_row())
    {
        mysql_fetch_row(Query);
        sscanf(Query, "i", vehicleID); // This is assuming that ID is the first column
        sscanf(Query, "p<|>e<is[32]is[32]s[32]s[32]s[32]s[32]s[32]s[32]s[32]s[32]s[32]ifffffffffffffff>", VVar[vehicleID]); //NEEDS CHANING TO SUIT VVAR
        VVar[vehicleID][vfaction] = iFaction;
    }
    return 1;
}
Reply
#3

I mean, the Vehicle ID that is assigned in game, I think I've got it but it will most likely break so..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)