MySQL owned vehicle system
#1

I've been trying to make a vehicle system for players using mysql (BlueG R

This is my info enums

pawn Код:
enum OWNED_CARS_INFO
{
    carID,
    carModel,
    carColor1,
    carColor2,
    Float:carParkX,
    Float:carParkY,
    Float:carParkZ,
    Float:carParkA,
    carPlate[64],
    carOwner[128],
    carOwned,
    carVehicle,
    carSpawned,
    carOn
}
new OwnedVehicles[MAX_VEHICLES][OWNED_CARS_INFO];
new PlayerVehicle[MAX_PLAYERS][MAX_PLAYER_CARS];
I have the loading function:

pawn Код:
public LoadPlayerVehicles()
{
    new rows, fields, str[128];
    new total = 0;
    cache_get_data(rows, fields);
    if(rows)
    {
        while(total < rows)
        {
            OwnedVehicles[total][carID] = cache_get_row_int(total, 0),
            OwnedVehicles[total][carModel] = cache_get_row_int(total, 1),
            OwnedVehicles[total][carColor1] = cache_get_row_int(total, 2),
            OwnedVehicles[total][carColor2] = cache_get_row_int(total, 3),
            OwnedVehicles[total][carParkX] = cache_get_row_float(total, 4),
            OwnedVehicles[total][carParkY] = cache_get_row_float(total, 5),
            OwnedVehicles[total][carParkZ] = cache_get_row_float(total, 6),
            OwnedVehicles[total][carParkA] = cache_get_row_float(total, 7),
            cache_get_row(total, 8, OwnedVehicles[total][carPlate], dbHandle, 128),
            cache_get_row(total, 9, OwnedVehicles[total][carOwner], dbHandle, 128),
            OwnedVehicles[total][carOwned] = cache_get_row_int(total, 10);
            OwnedVehicles[total][carSpawned] = 0;
            OwnedVehicles[total][carOn] = 1;
            total++;
        }
    }
    format(str,sizeof(str), "Loaded %d player owned vehicles from MySQL.", total);
    printf(str);
    return 1;
}
Now... if I want to check when player connects if he owns a vehicle by the ownername of the vehicle.
But the problem is when I do this:
pawn Код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
  for(new z = 0; z < MAX_PLAYER_CARS; z++)
  {
    if(!strcmp(GetName(playerid), OwnedVehicles[i][carOwner], true))
    {
        PlayerVehicle[playerid][z] = i;
    }
  }
}
It doesn't works..
Reply


Messages In This Thread
MySQL owned vehicle system - by PaulDinam - 11.03.2013, 19:05
Re: MySQL owned vehicle system - by Misiur - 11.03.2013, 19:54
Re: MySQL owned vehicle system - by Knappen - 11.03.2013, 20:59

Forum Jump:


Users browsing this thread: 2 Guest(s)