mysql car load problem [+Rep]
#1

hello guys i'm working in my own mysql car ownership system
but i got big problem cars don't loads

onplayerconnect

pawn Код:
public OnPlayerConnect(playerid)
{
    LoadVehicleForPlayer(playerid);
    return 1;
}
LoadVehicleForPlayer

pawn Код:
stock LoadVehicleForPlayer(playerid)
{
    mysql_function_query(mysql, "SELECT * FROM `pvehicles`", true,"OnPlayerLoadVehicles", ""); // we won't pass any other variables to the callback
    return 1;
}
pawn Код:
forward OnPlayerLoadVehicles(playerid);
public OnPlayerLoadVehicles(playerid)
{
    new
    idx,
    result[256],
    query[128];
    new id,owner,model,col1,col2,Float:sx,Float:sy,Float:sz,Float:sa;
    new name[MAX_PLAYER_NAME], Str[250];
    GetPlayerName(playerid, name, 24);
    mysql_format(mysql, query, sizeof(query), "SELECT * FROM `pvehicles` WHERE `vOwner` = '%s'", name);
    mysql_query(mysql, query, "", "");
    mysql_store_result();
    if(mysql_num_rows() > 0)
    {
        while(mysql_fetch_row(Str))
        {
            sscanf(Str, "p<|>is[24]iiiffff", id, owner, model, col1, col2, sx, sy, sz, sa);
            VehicleInfo[idx][vID] = id;
            VehicleInfo[idx][vOwner] = owner;
            VehicleInfo[idx][vModel] = model;
            VehicleInfo[idx][vColor1] = col1;
            VehicleInfo[idx][vColor2] = col2;
            VehicleInfo[idx][vX] = sx;
            VehicleInfo[idx][vY] = sy;
            VehicleInfo[idx][vZ] = sz;
            VehicleInfo[idx][vA] = sa;
            CreateVehicle(model, sx, sy, sz, sa, col1, col2, -1);
            //SetVehicleNumberPlate(i, str);
            SetVehicleToRespawn(idx);
            idx++; // Now increment our index!
   
        }
    }
    mysql_free_result();
    return 1;
}
//------------------------------------------------------------------------------
plz help
sorry for my bad english
Reply


Messages In This Thread
mysql car load problem [+Rep] - by simo0000 - 24.05.2015, 09:49
Re: mysql car load problem [+Rep] - by Yashas - 24.05.2015, 10:40
Re : Re: mysql car load problem [+Rep] - by simo0000 - 24.05.2015, 12:57
Re : mysql car load problem [+Rep] - by simo0000 - 24.05.2015, 13:48
Re : mysql car load problem [+Rep] - by simo0000 - 25.05.2015, 19:57

Forum Jump:


Users browsing this thread: 1 Guest(s)