14.04.2013, 02:24
This has been aggravating me the past hour or two now, and yes I'll def. give you a rep.
It doesn't update, period. Nothing within the tables for the vehicle is changed.
Anyone have a clue why?
pawn Код:
if(strcmp(cmd, "/editcar", true)==0)
{
new a_vehicle[256];
a_vehicle = strtok(cmdtext, idx);
if(PlayerInfo[playerid][pDeveloper] != 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use this command.");
return 1;
}
if(!strlen(a_vehicle))
{
SendClientMessage(playerid, COLOR_YELLOW, "EDIT CAR - SERVER VEHICLES ONLY, WILL NOT WORK ON OWNED VEHICLES");
SendClientMessage(playerid, COLOR_WHITE, "{00FF00}Park:{FFFFFF} Saves vehicle position.");
return 1;
}
if(strcmp(a_vehicle,"park",true)==0)
{
new vehicle = GetPlayerVehicleID(playerid);
new Float:x, Float:y, Float:z, Float:angle;
GetVehiclePos(vehicle,x, y, z);
DynamicCars[vehicle][CarX] = x;
DynamicCars[vehicle][CarY] = y;
DynamicCars[vehicle][CarZ] = z;
GetVehicleZAngle(vehicle, angle);
DynamicCars[vehicle][CarAngle] = angle;
SaveServerVehicles();
return 1;
}
}
forward SaveServerVehicles(vehicle);
public SaveServerVehicles(vehicle)
{
new query[1024];
printf("Saving Vehicle: %d.",vehicle);
format(query, sizeof(query), "UPDATE Vehicles SET CarX=%f, CarY=%f, CarZ=%f, CarAngle=%f WHERE carid=%d",
DynamicCars[vehicle][CarX],
DynamicCars[vehicle][CarY],
DynamicCars[vehicle][CarZ],
DynamicCars[vehicle][CarAngle],vehicle);
mysql_query(query);
printf("Vehicle %d saved.", vehicle);
}
Anyone have a clue why?