PlayerInfo[p][VehicleReg] always = 0 ... -
Hey, i have a problem.
I make private car system to my server, and i need to attribute Vehicle Registration to PlayerInfo[playerid][VR]
Код:
stock CreatePlayerCar(p, pVR[])
{
mysql_real_escape_string(pVR, pVR);
new query[256], query2[256];
format(query, sizeof(query),"SELECT * FROM `vehicles` WHERE `VR`='%d' AND `PID`='%d'", pVR, PlayerInfo[p][PID]);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
format(query2, sizeof(query2),"SELECT `VID`, `VR`, `c0`, `c1`, `c2`, `c3`, `c4`, `c5`, `c6`, `c7`, `c8`, `c9`, `c10`,`c11`, `c12` FROM `vehicles` WHERE `VR`='%d'", pVR);
mysql_query(query2);
mysql_store_result();
new Float:x, Float:y, Float:z, Float:a;
GetPlayerFacingAngle(p, y);
GetPlayerPos(p, x, y, z);
while(mysql_fetch_row(query2, "|"))
{
new fetchVal[256], carname[256];
//Labele
format(carname, sizeof(carname), "{bdbdbd}Owner:{ffcc33} %s", GetPlayerNick(p));
PlayerInfo[p][pCarLabel] = Create3DTextLabel(carname, 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, 0);
Attach3DTextLabelToVehicle(PlayerInfo[p][pCarLabel] , PlayerInfo[p][pCar], 0.0, 0.0, 2.0);
//Sety
mysql_fetch_field("VID", fetchVal);
PlayerInfo[p][pCar] = CreateVehicle(strval(fetchVal), x, y, z, a, 0, 1, 600); //AUTO -----
PutPlayerInVehicle(p, PlayerInfo[p][pCar], 0);
mysql_fetch_field("VR", fetchVal);
PlayerInfo[p][VR] = strval(fetchVal);
mysql_fetch_field("c0", fetchVal);
AddVehicleComponent(PlayerInfo[p][pCar], strval(fetchVal));
mysql_fetch_field("c1", fetchVal);
AddVehicleComponent(PlayerInfo[p][pCar], strval(fetchVal));
mysql_fetch_field("c2", fetchVal);
AddVehicleComponent(PlayerInfo[p][pCar], strval(fetchVal));
mysql_fetch_field("c3", fetchVal);
AddVehicleComponent(PlayerInfo[p][pCar], strval(fetchVal));
mysql_fetch_field("c4", fetchVal);
AddVehicleComponent(PlayerInfo[p][pCar], strval(fetchVal));
mysql_fetch_field("c5", fetchVal);
AddVehicleComponent(PlayerInfo[p][pCar], strval(fetchVal));
mysql_fetch_field("c6", fetchVal);
AddVehicleComponent(PlayerInfo[p][pCar], strval(fetchVal));
mysql_fetch_field("c7", fetchVal);
AddVehicleComponent(PlayerInfo[p][pCar], strval(fetchVal));
mysql_fetch_field("c8", fetchVal);
AddVehicleComponent(PlayerInfo[p][pCar], strval(fetchVal));
mysql_fetch_field("c9", fetchVal);
AddVehicleComponent(PlayerInfo[p][pCar], strval(fetchVal));
mysql_fetch_field("c10", fetchVal);
AddVehicleComponent(PlayerInfo[p][pCar], strval(fetchVal));
mysql_fetch_field("c11", fetchVal);
AddVehicleComponent(PlayerInfo[p][pCar], strval(fetchVal));
mysql_fetch_field("c12", fetchVal);
AddVehicleComponent(PlayerInfo[p][pCar], strval(fetchVal));
SendClientMessage(p, -1, "{ffcc33}** {bdbdbd}You get you private car");
mysql_free_result();
}
}else SendClientMessage(p, -1, "the vehicle does not exist");
mysql_free_result();
return 1;
}
`VR` is Vehicle Registration, but PlayerInfo[playerid][VR] always = 0 ...
in DataBase `VR` = maybe .. 7, but in variable always 0 ...
Thanks for help.
PS. And The 3D text doesn't work . . ;/
Re: PlayerInfo[p][VehicleReg] always = 0 ... -