12.01.2015, 11:09
hello , can someone tell me what's wrong with my code of parking ..
apark used for admins only , and there is vpark used for users to park their vehicles
but when im doing apark or vpark , it parks the vehicle in bleuberry(0.0.0) and the car getting destroyed as i wrote in code but it wont respawn again .. something wrong ?
apark used for admins only , and there is vpark used for users to park their vehicles
but when im doing apark or vpark , it parks the vehicle in bleuberry(0.0.0) and the car getting destroyed as i wrote in code but it wont respawn again .. something wrong ?
PHP код:
YCMD:vpark(playerid, params[], help)
{
if(help) return SCM(playerid, COLOR_GREY, "Not supported");
new Float:x,Float:y,Float:z;
new Float:a;
new Float:health;
new carid;
new vmodel;
new panels,doors,lights,tires;
new getcarid = GetPlayerVehicleID(playerid);
if(getcarid == PlayerInfo[playerid][pPcarkey]) { carid = PlayerInfo[playerid][pPcarkey]; }
else if(getcarid == PlayerInfo[playerid][pPcarkey2]) { carid = PlayerInfo[playerid][pPcarkey2]; }
else return 1;
new playername[MAX_PLAYER_NAME];
GetVehicleHealth(carid, health);
GetPlayerName(playerid, playername, sizeof(playername));
GetVehiclePos(carid, x, y, z);
GetVehicleZAngle(carid, a);
vmodel = GetVehicleModel(carid);
GetVehicleDamageStatus(getcarid,panels,doors,lights,tires);
if(IsPlayerInVehicle(playerid,carid))
{
CarInfo[carid][cLocationx] = x;
CarInfo[carid][cLocationy] = y;
CarInfo[carid][cLocationz] = z;
CarInfo[carid][cAngle] = a;
new area[35];
GetPlayer2DZone(playerid, area, sizeof(area));
OnPropUpdate(4,carid);
DestroyVehicle(carid);
ownedcar[carid] = CreateVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz],CarInfo[carid][cAngle],CarInfo[carid][cColorOne],CarInfo[carid][cColorTwo],60000);
if(CarInfo[carid][cPaintjob] != 999)
{
ChangeVehiclePaintjob(carid, CarInfo[carid][cPaintjob]);
}
if(CarInfo[carid][cLock] == 1)
{
new e,l,a77,d77,b,bo,o;
GetVehicleParamsEx(carid,e,l,a77,d77,b,bo,o);
SetVehicleParamsEx(carid,e,l,a77,1,b,bo,o);
}
if(!isnull(CarInfo[carid][cPlate]))
{
SetVehicleNumberPlate(carid, CarInfo[carid][cPlate]);
}
SetVehicleVirtualWorld(carid, CarInfo[carid][cVirWorld]);
SetVehicleModifications(carid);
TogglePlayerControllable(playerid, 1);
SetVehicleHealth(carid, health);
UpdateVehicleDamageStatus(getcarid, panels, doors, lights, tires);
PutPlayerInVehicle(playerid, carid, 0);
if(IsModelABycicle(vmodel))
{
new alarm, bonnet, boot, objective;
SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1, lights, alarm, doors, bonnet, boot, objective);
engineOn[GetPlayerVehicleID(playerid)] = true;
}
else
{
new alarm, bonnet, boot, objective;
SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, lights, alarm, doors, bonnet, boot, objective);
engineOn[GetPlayerVehicleID(playerid)] = false;
}
}
return 1;
}
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;
}