Need help with car system
#1

Now it's about 1 month working on vehicle system. When i load vehicles with sscanf from MYSQL every thing works fine and cars spawn's in server, but when i want to check if any car is locked i use enum variables, but enum is empty, it has no information longer. So that's my system i am working on:
pawn Код:
enum Cars
{
Id,
Owner[25],
Model,
Float:X,
Float:Y,
Float:Z,
Float:Angle,
Fuel,
Color1,
Color2,
Lock,
A,
tune0,
tune1,
tune2,
tune3,
tune4,
tune5,
tune6,
tune7,
tune8,
tune9,
tune10,
tune11,
tune12,
tune13,
Paintjob,
Data[20],
Name[20],
}
new vInfo[MAX_VEHICLES][Cars];
Then i load vehicles in OnGameModeInit with this stock:
pawn Код:
stock LoadVehicles()
{
    new Query[256];
    for(new id; id < MAX_VEHICLES; id++) // Makes an loop so all vehicles get loaded.
    {
        format(Query, sizeof(Query), "SELECT * FROM vehicles WHERE `ID`= '%d' LIMIT 1", id);
        mysql_query(Query); // Querys the "Query" Variable.
        mysql_store_result(); // Stores the result from Query
        if(mysql_num_rows()) // Checks if theres anyrow.
        if(mysql_fetch_row_format(Query,"|"))
        {
            sscanf(Query, "p<|>e<ds[25]dffffdddddddddddddddddddds[20]s[20]>",vInfo[id]);
           
            new car = CreateVehicle(vInfo[id][Model],vInfo[id][X],vInfo[id][Y],vInfo[id][Z],vInfo[id][Angle],vInfo[id][Color1],vInfo[id][Color2], -1);
            ChangeVehiclePaintjob(car,strval(vInfo[ id ][ Paintjob ]));
            AddVehicleComponent(car,vInfo[ id ][ tune0 ]);
            AddVehicleComponent(car,vInfo[ id ][ tune1 ]);
            AddVehicleComponent(car,vInfo[ id ][ tune2 ]);
            AddVehicleComponent(car,vInfo[ id ][ tune3 ]);
            AddVehicleComponent(car,vInfo[ id ][ tune4 ]);
            AddVehicleComponent(car,vInfo[ id ][ tune5 ]);
            AddVehicleComponent(car,vInfo[ id ][ tune6 ]);
            AddVehicleComponent(car,vInfo[ id ][ tune7 ]);
            AddVehicleComponent(car,vInfo[ id ][ tune8 ]);
            AddVehicleComponent(car,vInfo[ id ][ tune9 ]);
            AddVehicleComponent(car,vInfo[ id ][ tune10 ]);
            AddVehicleComponent(car,vInfo[ id ][ tune11 ]);
            AddVehicleComponent(car,vInfo[ id ][ tune12 ]);
            AddVehicleComponent(car,vInfo[ id ][ tune13 ]);
        }
       
     }

}
So, until here it's no problem, but now when i want to check if the car is locked in OnPlayerEnterVehicle Enum has no information. I try to do so:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
        printf(vInfo[ vehicleid ][ Locked ]);
        printf(vInfo[ vehicleid ][ X ]);
        printf(vInfo[ vehicleid ][ Y ]);
        printf(vInfo[ vehicleid ][ Z ]);
}
This returns:
0
0.00000
0.00000
0.00000.


Any suggestions ?
Reply


Messages In This Thread
Need help with car system - by ajwar - 28.12.2010, 18:28
Re: Need help with car system - by ajwar - 04.01.2011, 20:36
Re: Need help with car system - by [BFT]eagles22 - 05.01.2011, 04:09

Forum Jump:


Users browsing this thread: 1 Guest(s)