Problem! +REP
#1

If I am in the game and I buy a car, and after use /veh displays the message: "You not a vehicle!".
But if I restart the server, command /veh works!
Код HTML:
CMD:veh(playerid, params [])
{
    new bool:found = false, msg[256], lst[19];
    for(new i = 0; i < sizeof(Veh); i++)
    {
        if(Veh[i][Owner] == pInfo[playerid][pID])
        {
            found = true;
            format(msg, sizeof(msg), "%s\n%s\t%s\t%s", msg, VehicleNames[GetVehicleModel(Veh[i][ServerID])-400], lst, Veh[i][Plate]);
        }
    }
    if(found) { ShowPlayerDialog(playerid, DIALOG_VEH, DIALOG_STYLE_TABLIST_HEADERS, "My Vehicles", msg, "Select", "Cancel"); }
    else { SendClientMessage(playerid, COLOR_DARKGRAY, "You not a vehicle!"); }
    return 1;
}
Reply
#2

I think the problem is from when you save the vehicle data.
Can you show the code to save vehicle data?
Reply
#3

Код HTML:
new vehicleid = CreateVehicle(dmodelid[playerid], 298.5601,-1536.6544,24.2187,53.8474, 1, 1, -1);
            new Float:vehx, Float:vehy, Float:vehz, Float:z_rot;
            GetVehiclePos(vehicleid, vehx, vehy, vehz); GetVehicleZAngle(vehicleid, z_rot);
            mysql_format(MySQLCon, query, sizeof(query), "INSERT INTO `vehicles` (`Owner`, `Model`, `PosX`, `PosY`, `PosZ`, `VAngle`, `Color1`, `Color2`, \
            `Value`, `Lock`, `Plate`, `Class`, `ServerID`) VALUES \
            ('%d', '%d', '%f', '%f', '%f', '%f', '%d', '%d', '%d', '%d', '%s', '%s', '%d')", pInfo[playerid][pID] \
            ,dmodelid[playerid], vehx, vehy, vehz, z_rot, 1, 1, dprice[playerid]/2, 1, GetName(playerid), "Sport", vehicleid);
            mysql_tquery(MySQLCon, query, "OnVehInsert", "id", vehicleid, playerid);
Код HTML:
forward OnVehInsert(vehicleid, playerid);
public OnVehInsert(vehicleid, playerid)
{
    Veh[vehicleid][ID] = cache_insert_id();
    new did = Veh[vehicleid][ID];
    SetVehicleNumberPlate(vehicleid, GetName(playerid));
    strmid(Veh[did][Plate], GetName(playerid), 0, strlen(GetName(playerid)), 255);
    orm_update(Veh[did][ORM_ID]);
    SetVehicleToRespawn(vehicleid);
    return 1;
}
Reply
#4

BUMP!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)