11.06.2015, 16:05
Hello all ,i want to make comand /park to can be used by members TCC after /tow car's
i try but i faild!
PHP код:
CMD:park(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa te loghezi mai intai.");
if(PlayerInfo[playerid][pPcarkey] == 0 && PlayerInfo[playerid][pmotokey] == 0 && PlayerInfo[playerid][phelikey] == 0 && PlayerInfo[playerid][pprcarkey] == 0) return SendClientMessage(playerid,COLOR_WHITE,"{ED2D20}You do not have a vehicle.");
if(personalcar[playerid] == 0) return SCM(playerid,COLOR_WHITE,"{ED2D20}You don't have spawned car.");
new engine,lights,alarm,doors,bonnet,boot,objective;
new Float:x,Float:y,Float:z,Float:a,getcarid;
getcarid = GetPlayerVehicleID(playerid);
GetVehiclePos(getcarid, x, y, z);
GetVehicleZAngle(getcarid, a);
if(GetPlayerVehicleID(playerid) == personalcar[playerid])
{
if(IsPlayerInVehicle(playerid,personalcar[playerid]))
{
new Float:health2;
GetVehicleHealth(getcarid, health2);
if(health2 < 600.0) return SCM(playerid,COLOR_WHITE,"{ED2D20}Please repair your car.");
if(getcarid == personalcar[playerid])
{
CarInfo[OwnedVeh(getcarid)][cLocationx] = x;
CarInfo[OwnedVeh(getcarid)][cLocationy] = y;
CarInfo[OwnedVeh(getcarid)][cLocationz] = z;
CarInfo[OwnedVeh(getcarid)][cAngle] = a;
DestroyVehicle(personalcar[playerid]);
new created = OwnedVeh(getcarid);
OwnedVeh(getcarid) = 0;
new car = CreateVehicle(CarInfo[created][cModel],CarInfo[created][cLocationx],CarInfo[created][cLocationy],CarInfo[created][cLocationz]+1.0,CarInfo[created][cAngle],CarInfo[created][cColorOne],CarInfo[created][cColorTwo],500000);
OwnedVeh(car) = created;
personalcar[playerid] = car;
PutPlayerInVehicleEx(playerid,car,0);
new carplate[25];
format(carplate, sizeof(carplate), "%s",CarInfo[OwnedVeh(car)][cLicense]);
SetVehicleNumberPlate(car, carplate);
SetVehicleHealth(car, health2);
vehEngine[car] = 0;
GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(car,VEHICLE_PARAMS_OFF,lights,alarm,CarInfo[PlayerInfo[playerid][pPcarkey]][cLock],bonnet,boot,objective);
SetPVarInt(playerid, "Engine", 0);
vUpdate(OwnedVeh(car),cLocationxx);
vUpdate(OwnedVeh(car),cLocationyx);
vUpdate(OwnedVeh(car),cLocationzx);
vUpdate(OwnedVeh(car),cAnglex);
ModVehicle(car);
SendClientMessage(playerid, COLOR_WHITE, "Car was parked successfully.");
return 1;
}
}
}
return 1;
}