13.01.2015, 21:58
Hello ,
directly : after im doing the command /apark , it destroyes the vehicle and it never come back till i'll relog ( i will find the car in the last position before i'll do apark)
here is the update of mysql
here is a picture when im doing the command
here is the command apark
directly : after im doing the command /apark , it destroyes the vehicle and it never come back till i'll relog ( i will find the car in the last position before i'll do apark)
here is the update of mysql
PHP код:
Onplayerupdate( value 4 this one )
.
.
.
mysql_format(dbhandle, query, sizeof query, "INSERT INTO vehicles VALUES (%d, %d, %.2f, %.2f, %.2f, %.2f, %d, %d, %d, '%e', %d, %d, %d, %d, '%e') \
ON DUPLICATE KEY UPDATE id = LAST_INSERT_ID(id), model = VALUES(model), ",
CarInfo[idx][cdbID], CarInfo[idx][cModel], CarInfo[idx][cLocationx], CarInfo[idx][cLocationy],
CarInfo[idx][cLocationz], CarInfo[idx][cAngle], CarInfo[idx][cColorOne], CarInfo[idx][cColorTwo],
0, CarInfo[idx][cOwner], CarInfo[idx][cLock], CarInfo[idx][cPaintjob], CarInfo[idx][cVirWorld], CarInfo[idx][cCode], CarInfo[idx][cPlate]);
strcat(query, "locX = VALUES(locX), \
locY = VALUES(locY), locZ = VALUES(locZ), angle = VALUES(angle), \
color1 = VALUES(color1), color2 = VALUES(color2), ownerId = VALUES(ownerId), \
owner = VALUES(owner),\
locked = VALUES(locked), paintjob = VALUES(paintjob), \
virtualworld = VALUES(virtualworld), code = VALUES(code), plate = VALUES(plate)");
mysql_tquery_inline(dbhandle, query, using CarHandler, "");
here is the command apark
PHP код:
YCMD:apark(playerid, params[], help)
{
if(help) return SCM(playerid, COLOR_GREY, "Not supported");
if(IsPlayerConnected(playerid))
{
new Float:x,Float:y,Float:z,Float:a,carid,string[256];
carid = GetPlayerVehicleID(playerid);
GetVehiclePos(carid, x, y, z);
GetVehicleZAngle(carid, a);
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsAnOwnableCar(carid))
{
CarInfo[carid][cLocationx] = x;
CarInfo[carid][cLocationy] = y;
CarInfo[carid][cLocationz] = z;
CarInfo[carid][cAngle] = a;
format(string, sizeof(string), "~n~ You have parked your car in this location. ~n~");
GameTextForPlayer(playerid, "You have parked this car in this position. It will respawn here.", 10000, 3);
OnPropUpdate(4,carid);
DestroyVehicle(carid);
ownedcar[carid] = CreateVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz]+1.0,CarInfo[carid][cAngle],CarInfo[carid][cColorOne],CarInfo[carid][cColorTwo],60000);
if(CarInfo[carid][cPaintjob] != 999)
{
ChangeVehiclePaintjob(carid, CarInfo[carid][cPaintjob]);
}
SetVehicleModifications(carid);
PutPlayerInVehicle(playerid, carid, 0);
new lights, alarm, doors, bonnet, boot, objective;
SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1, lights, alarm, doors, bonnet, boot, objective);
engineOn[GetPlayerVehicleID(playerid)] = true;
TogglePlayerControllable(playerid, 1);
return 1;
}
else
{
SCM(playerid, COLOR_GREY, "* You can only do this on ownable cars!");
return 1;
}
}
else
{
SCM(playerid, COLOR_GREY, "* You are not authorized to use that command !");
return 1;
}
}
return 1;
}