27.02.2013, 15:07
The guy above me is right. ^
pawn Код:
CMD:lock(playerid, params[])
{
new engine, lights, alarm, doors, bonnet, boot, objective;
new keycar = PlayerInfo[playerid][pPcarkey];
if(keycar != 9999)
{
new Float:X,Float:Y,Float:Z;
GetVehiclePos(keycar,X,Y,Z);
if(IsPlayerInRangeOfPoint(playerid, 10,X,Y,Z))
{
if(CarInfo[keycar][cLock] == 1)
{
SCM(playerid, COLOR_LIGHTBLUE, "Vehicle Unlocked!");
CarInfo[keycar][cLock] = 0;
GetVehicleParamsEx(keycar, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(keycar, engine, lights, alarm, 0, bonnet, boot, objective);
OnPropUpdate(4,keycar);
return 1;
}
else if(CarInfo[keycar][cLock] == 0)
{
SCM(playerid, COLOR_LIGHTBLUE, "Vehicle Locked!");
CarInfo[keycar][cLock] = 1;
GetVehicleParamsEx(keycar, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(keycar, engine, lights, alarm, 1, bonnet, boot, objective);
OnPropUpdate(4,keycar);
return 1;
}
}
// Car 2
new keycar2 = PlayerInfo[playerid][pPcarkey2];
if(keycar2 != 9999)
{
new Float:X2,Float:Y2,Float:Z2;
GetVehiclePos(keycar2,X2,Y2,Z2);
if(IsPlayerInRangeOfPoint(playerid, 10,X2,Y2,Z2))
{
if(CarInfo[keycar2][cLock] == 1)
{
SCM(playerid, COLOR_LIGHTBLUE, "Vehicle 2 Unlocked!");
CarInfo[keycar2][cLock] = 0;
GetVehicleParamsEx(keycar2, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(keycar2, engine, lights, alarm, 0, bonnet, boot, objective);
OnPropUpdate(4,keycar2);
return 1;
}
else if(CarInfo[keycar2][cLock] == 0)
{
SCM(playerid, COLOR_LIGHTBLUE, "Vehicle 2 Locked!");
CarInfo[keycar2][cLock] = 1;
GetVehicleParamsEx(keycar2, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(keycar2, engine, lights, alarm, 1, bonnet, boot, objective);
OnPropUpdate(4,keycar2);
return 1;
}
}
}
else
{
SCM(playerid, COLOR_GREY,"* You must be near or in your vehicle to lock it!");
return 1;
}
}
else
{
SCM(playerid, COLOR_GREY, "* You don't have a vehicle at slot 1/2!");
return 1;
}
return 1;
}