28.06.2013, 11:52
I have a problem with my vehicle creating(ownership) when i create(/vcreate) when it saves in the mysql the ID of the creating car is same :@ look the picture the id is 4 4 4 4 4 4 4 the same and i'v created 5-6 cars and the ids are same what is the prbolem :@ ?
look the picture:

Code:
look the picture:

Code:
pawn Код:
CMD:vcreate(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You must be admin to use this command!");
new
Float:Pos[4],
ivModel,
ivPrice,
ivColors[2],
Query[256],
iMsg[128];
if(sscanf(params, "iiii", ivModel, ivPrice, ivColors[0], ivColors[1])) return SendClientMessage(playerid, -1, ""#CRED"Usage: "#CORANGE"/VCreate < Vehicle Model > < Price > < Color 1 > < Color 2 >");
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
GetPlayerFacingAngle(playerid, Pos[3]);
new
vID = GetNewVehID();
vInfo[vID][vModel] = ivModel;
vInfo[vID][vColor1] = ivColors[0];
vInfo[vID][vColor2] = ivColors[1];
vInfo[vID][vPrice] = ivPrice;
vInfo[vID][vPosX] = Pos[0];
vInfo[vID][vPosY] = Pos[1];
vInfo[vID][vPosZ] = Pos[2];
vInfo[vID][vPosA] = Pos[3];
strmid(vInfo[vID][vOwner], "Unbought", 0, 20, 20);
format(Query, sizeof(Query), "INSERT INTO `privateveh` (`vID`, `vModel`, `vColor1`, `vColor2`, `vPrice`, `vOwner`, `vPosX`, `vPosY`, `vPosZ`, `vPosA`) VALUES (%d, %d, %d, %d, %d, 'Unbought', %f, %f, %f, %f)",
vID,
ivModel,
ivColors[0],
ivColors[1],
ivPrice,
Pos[0],
Pos[1],
Pos[2],
Pos[3]);
mysql_query(Query);
new
cCar = CreateVehicle(ivModel, Pos[0], Pos[1], Pos[2], Pos[3], ivColors[0], ivColors[1], 500000);
ivCreated[cCar] = vID;
SavePrivVeh(vID);
format(iMsg, sizeof(iMsg), ""#CYELLOW"Vehicle: "#CBLUE"%i (VID: %i) "#CYELLOW"has been created. Price: "#CBLUE"$%i", ivModel, vID, ivPrice);
SendClientMessage(playerid, -1, iMsg);
return 1;
}