Concerns a vehicle name
#1

Hello.

Well, I have a system of vehicles, when I bought one, the vehicle added fine, but in the database in the "Owner" column, it puts "Free" instead of putting the player name.

pawn Код:
public Vehicule_data_add(playerid, model)
{
    new Requete[MAX_STRING], vehid;
    format(Requete, sizeof(Requete), "INSERT INTO lsrp_vehiculesdata SET `Model`='%d'", model);
    mysql_query(Requete);
   
    Vehiculedata_infos[vehid][v_posX] = 1364.841;
    Vehiculedata_infos[vehid][v_posX] = -2316.2483;
    Vehiculedata_infos[vehid][v_posZ] = 13.3005;
    Vehiculedata_infos[vehid][v_posA] = 270.3969;
    Vehicule_data_update(vehid);
    return 1;
}
pawn Код:
public Vehicule_data_update(id)
{
    new Requete[512], ProprioCar[24];
    mysql_real_escape_string(Vehicule_infos[id][v_Proprio], ProprioCar);
    format(Requete, sizeof(Requete), "UPDATE lsrp_vehiculesdata SET `Model`='%d', `Proprio`='%s', `X`='%f', `Y`='%f', `Z`='%f', `A`='%f', `Color1`='%d', `Color2`='%d', `Type`='%d', `mLock`='%d', `VirtualWorld`='%d', `Job`='%d', `Faction`='%d', `Prix`='%d' WHERE id=%d",
   
    Vehiculedata_infos[id][v_Model],
    ProprioCar,
    Vehiculedata_infos[id][v_posX],
    Vehiculedata_infos[id][v_posY],
    Vehiculedata_infos[id][v_posZ],
    Vehiculedata_infos[id][v_posA],
    Vehiculedata_infos[id][v_Color1],
    Vehiculedata_infos[id][v_Color2],
    Vehiculedata_infos[id][v_Type],
    Vehiculedata_infos[id][v_mLock],
    Vehiculedata_infos[id][v_VirtualWorld],
    Vehiculedata_infos[id][v_Job],
    Vehiculedata_infos[id][v_Faction],
    Vehiculedata_infos[id][v_Prix],
    id);
    mysql_query(Requete);
    return 1;
}
Help?
Reply
#2

uh i don't see anything that sets the "Owner" column in that code. I'm making the assumption that ProprioCar[24]; is the variable your using for the players name based on the fact that its array size is 24. You need to use
Quote:

GetPlayerName()

visit https://sampwiki.blast.hk/wiki/GetPlayerName for how to use that.

If you explain your problem better we may be able to assist you but i don't really understand what is being asked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)