30.09.2012, 17:39
pawn Код:
CMD:vlock(playerid, params[])
{
new oldcar = LastCar[playerid];
new Float:cX, Float:cY, Float:cZ;
GetVehiclePos(oldcar, cX, cY, cZ);
new string[128];
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(oldcar, engine, lights, alarm, doors, bonnet, boot, objective);
if(!IsPlayerInRangeOfPoint(playerid, 4, cX, cY, cZ))
{
SendClientMessage(playerid,red,"You're not in range/in the Vehicle you last drove!");
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid, 4, cX, cY, cZ))
{
if(doors != 1)
{
doors = 1;
SetVehicleParamsEx(oldcar,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
SendClientMessage(playerid, 0xFFFFFFAA, " You've locked the vehicle!");
return 1;
}
else
{
doors = 0;
SetVehicleParamsEx(oldcar,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
SendClientMessage(playerid, 0xFFFFFFAA, " You've unlocked the vehicle!");
return 1;
}
}
return doors;
}
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
LastCar[playerid] = vehicleid;
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
LastCar[playerid] = vehicleid;
return 1;
}